* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #0078d7;
    --primary-dark: #005a9e;
    --primary-light: #50a0e8;
    --secondary-orange: #ffa500;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --warning-yellow: #ffc107;
    --bg-light: #f0f2f5;
    --bg-white: #ffffff;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.1);

    /* Sidebar specific */
    --sidebar-width: 260px;
    --sidebar-bg: #1e1e1e;
    --sidebar-hover: #191e23;
    --sidebar-text: #f0f0f1;
    --sidebar-active: #0073aa;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    /* display: flex; REMOVED - causing layout issues with fixed sidebar */
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    background: #000000;
    text-align: center;
    border-bottom: 1px solid #333;
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand span.icon {
    font-size: 1.4rem;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #b0b0b0;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
}

.sidebar-menu li a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-active);
}

.sidebar-menu li a.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-menu li a i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.user-panel {
    padding: 15px 20px;
    background: var(--sidebar-hover);
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    font-size: 0.85rem;
    color: #fff;
}

.btn-logout {
    background: transparent;
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #ff4d4d;
    color: white;
}

/* Main Content Area */
.main-content-wrapper {
    margin-left: var(--sidebar-width);
    padding: 30px;
    /* width: calc(100% - var(--sidebar-width)); REMOVED - block element automatically takes remaining width */
    width: auto;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.page-title {
    font-size: 1.8rem;
    color: #1d2327;
    margin: 0;
    font-weight: 400;
}

.current-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Components */
.container {
    max-width: 100%;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-white);
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-blue);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card.orange {
    border-left-color: var(--secondary-orange);
}

.stat-card.green {
    border-left-color: var(--success-green);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-dark);
}

/* Forms */
.form-section {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-section h2 {
    color: var(--text-dark);
    margin-bottom: 25px;
    font-size: 1.3rem;
    font-weight: 500;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 992px) {
    .form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--bg-white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.form-group input[readonly] {
    background: #f9f9f9;
    color: #666;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success-green);
    color: white;
}

.btn-success:hover {
    filter: brightness(0.9);
}

.btn-danger {
    background: var(--danger-red);
    color: white;
}

.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Tables */
.table-container {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-header {
    background: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.table-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.search-box {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 250px;
    font-size: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    border-bottom: 1px solid #ddd;
}

tbody tr {
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background: #fcfcfc;
}

tbody td {
    padding: 12px 15px;
    font-size: 0.9rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-icon:hover {
    background: #f0f0f1;
    border-color: #ddd;
}

.btn-whatsapp:hover {
    color: #25D366;
    border-color: #25D366;
}

.btn-email:hover {
    color: #0078d7;
    border-color: #0078d7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
    font-size: 0.9rem;
}

.alert.show {
    display: block;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-green);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-red);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--primary-blue);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }

    .sidebar.mobile-open {
        width: 260px;
    }

    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }

    .mobile-menu-toggle {
        display: block;
        position: fixed;
        left: 15px;
        top: 15px;
        z-index: 1001;
        background: #333;
        color: white;
        padding: 10px;
        border-radius: 4px;
        border: none;
        cursor: pointer;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Payslip Details Modal Styles */
.payslip-details-header {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.details-item {
    font-size: 0.9rem;
}

.details-item strong {
    color: var(--text-muted);
    font-weight: 500;
}

.payslip-view-table {
    width: 100%;
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.payslip-view-table table {
    width: 100%;
    border-collapse: collapse;
}

.payslip-view-table th {
    background: #f1f3f5;
    padding: 10px 15px;
    text-align: left;
    font-size: 0.95rem;
    color: var(--primary-blue);
}

.payslip-view-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.payslip-view-table .section-title {
    background: #fdfdfe;
    font-weight: bold;
    color: #444;
}

.payslip-view-table .total-row {
    background: #f8f9fa;
    font-weight: bold;
}

.amount-col {
    text-align: right;
    font-weight: 500;
}

.grand-total-banner {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

.grand-total-banner h2 {
    margin: 0;
    font-size: 1.8rem;
    color: white;
}

.grand-total-banner p {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-style: italic;
}