:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #6c757d;
    --success: #2ec4b6;
    --danger: #e71d36;
    --warning: #ff9f1c;
    --info: #4cc9f0;
    --dark: #1a1a2e;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #a8b2d1;
    --sidebar-active: #4361ee;
    --body-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --border-color: #e1e5eb;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1050;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h4 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    font-size: 1.25rem;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.sidebar-nav {
    padding: 16px 0;
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    padding: 12px 24px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(168, 178, 209, 0.5);
    font-weight: 600;
}

.sidebar-nav .nav-item {
    margin: 2px 12px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-nav .nav-link:hover {
    background: rgba(67, 97, 238, 0.1);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-user {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.sidebar-user .user-name {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-user .user-role {
    color: var(--sidebar-text);
    font-size: 0.7rem;
    text-transform: capitalize;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: var(--transition);
}

/* ============ TOPBAR ============ */
.topbar {
    background: var(--card-bg);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
}

.topbar-title h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-notif {
    position: relative;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.topbar-notif .badge {
    position: absolute;
    top: -5px;
    right: -8px;
    font-size: 0.6rem;
    padding: 2px 5px;
}

/* ============ PAGE CONTENT ============ */
.page-content {
    padding: 24px 28px;
}

/* ============ STAT CARDS ============ */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon.bg-primary-soft { background: rgba(67, 97, 238, 0.1); color: var(--primary); }
.stat-icon.bg-success-soft { background: rgba(46, 196, 182, 0.1); color: var(--success); }
.stat-icon.bg-warning-soft { background: rgba(255, 159, 28, 0.1); color: var(--warning); }
.stat-icon.bg-danger-soft { background: rgba(231, 29, 54, 0.1); color: var(--danger); }
.stat-icon.bg-info-soft { background: rgba(76, 201, 240, 0.1); color: var(--info); }

/* ============ CARDS ============ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    font-weight: 700;
}

.card-body {
    padding: 24px;
}

/* ============ TABLES ============ */
.table {
    margin: 0;
}

.table thead th {
    background: var(--body-bg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.table tbody tr:hover {
    background: rgba(67, 97, 238, 0.02);
}

/* ============ STATUS BADGE ============ */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* ============ BUTTONS ============ */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 8px 20px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* ============ FORMS ============ */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============ CHAT ============ */
.chat-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: var(--body-bg);
    border-radius: var(--radius);
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
}

.chat-message.sent {
    flex-direction: row-reverse;
}

.chat-bubble {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
}

.chat-message.received .chat-bubble {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.chat-message.sent .chat-bubble {
    background: var(--primary);
    color: #fff;
}

.chat-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============ INVOICE ============ */
.invoice-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 40px;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary);
}

/* ============ ALERTS ============ */
.alert {
    border-radius: 8px;
    border: none;
    font-size: 0.88rem;
    font-weight: 500;
}

/* ============ PAGINATION ============ */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
}

/* ============ MOBILE RESPONSIVE ============ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .page-content {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .topbar {
        padding: 12px 16px;
    }
}

/* ============ PROGRESS TRACKER ============ */
.progress-tracker {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.progress-step .step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 2;
}

.progress-step.active .step-icon {
    background: var(--primary);
    color: #fff;
}

.progress-step.completed .step-icon {
    background: var(--success);
    color: #fff;
}

.progress-step .step-label {
    font-size: 0.7rem;
    margin-top: 6px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 600;
}

.progress-connector {
    width: 60px;
    height: 3px;
    background: var(--border-color);
    margin: 0 8px;
    margin-bottom: 20px;
}

.progress-connector.active {
    background: var(--success);
}

/* ============ AUTH PAGES ============ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.auth-card .brand-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .brand-logo h2 {
    color: var(--primary);
    font-weight: 800;
}

.auth-card .brand-logo p {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ============ ANIMATION ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    font-weight: 700;
    margin-bottom: 8px;
}
