﻿:root {
    /* --- LIGHT THEME (DEFAULT) --- */
    --bg-body: #fafafa;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #09090b;
    --text-secondary: #3f3f46;
    --text-muted: #71717a;
    --text-sidebar: #71717a;
    --text-sidebar-hover: #09090b;
    --primary-accent: #0070f3;
    --primary-hover: #005ae0;
    --btn-dark: #09090b;
    --btn-dark-hover: #27272a;
    --btn-dark-text: #ffffff;
    --success: #059669;
    --success-bg: #dcfce7;
    --danger: #e11d48;
    --danger-bg: #ffe4e6;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --border-light: #e4e4e7;
    --border-sidebar: #e4e4e7;
    --border-focus: #0070f3;
    --table-header: #fafafa;
    --table-hover: #f4f4f5;
    --input-bg: #ffffff;
    --sidebar-hover-bg: #f4f4f5;
    --sidebar-active-bg: #f4f4f5;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-focus: 0 0 0 3px rgba(0, 112, 243, 0.2);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* --- DARK THEME OVERRIDES --- */
[data-theme="dark"] {
    --bg-body: #000000;
    --bg-card: #121214;
    --bg-sidebar: #09090b;
    --text-main: #ededed;
    --text-secondary: #a1a1aa;
    --text-muted: #888888;
    --text-sidebar: #a1a1aa;
    --text-sidebar-hover: #ededed;
    --primary-accent: #3291ff;
    --primary-hover: #0070f3;
    --btn-dark: #ededed;
    --btn-dark-hover: #ffffff;
    --btn-dark-text: #000000;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #f43f5e;
    --danger-bg: rgba(244, 63, 94, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --border-light: #27272a;
    --border-sidebar: #27272a;
    --border-focus: #3291ff;
    --table-header: #121214;
    --table-hover: #1f1f22;
    --input-bg: #09090b;
    --sidebar-hover-bg: rgba(255,255,255,0.06);
    --sidebar-active-bg: #1f1f22;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- MOBILE TOP HEADER --- */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    z-index: 40;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
}

    .mobile-header .brand-text {
        font-weight: 600;
        color: var(--text-main);
        font-size: 16px;
        letter-spacing: -0.02em;
    }

.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
    z-index: 1000;
    border-right: 1px solid var(--border-sidebar);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 30px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-sidebar);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .brand img {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
        background: var(--border-light);
        border: 1px solid var(--border-sidebar);
    }

    .brand span {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-main);
        letter-spacing: -0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

    .sidebar-close-btn:hover {
        color: var(--text-main);
    }

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

    .nav-menu li {
        margin-bottom: 6px;
    }

    .nav-menu a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        color: var(--text-sidebar);
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
        border-radius: var(--radius-sm);
        transition: all 0.2s ease;
    }

        .nav-menu a i {
            font-size: 15px;
            width: 20px;
            text-align: center;
        }

        .nav-menu a:hover {
            background-color: var(--sidebar-hover-bg);
            color: var(--text-sidebar-hover);
        }

        .nav-menu a.active {
            background-color: var(--sidebar-active-bg);
            color: var(--text-main);
            font-weight: 600;
        }

.theme-toggle-btn, .btn-logout {
    background: transparent;
    border: 1px solid var(--border-sidebar);
    color: var(--text-sidebar);
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    transition: 0.2s;
}

    .theme-toggle-btn:hover {
        background: var(--sidebar-hover-bg);
        color: var(--text-main);
    }

.btn-logout {
    margin-bottom: 0;
}

    .btn-logout:hover {
        background: rgba(225, 29, 72, 0.1);
        color: var(--danger);
        border-color: rgba(225, 29, 72, 0.3);
    }

/* --- MAIN CONTENT --- */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease;
    max-width: 1600px;
    margin-right: auto;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.page-title h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.page-title span {
    font-size: 14px;
    color: var(--text-muted);
    display: block;
}

/* --- LAYOUTS --- */
.profile-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.dashboard-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* --- CARDS --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
    transition: background-color 0.3s, border-color 0.3s;
}

.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

    .stat-header i {
        font-size: 14px;
        color: var(--text-muted);
    }

.stat-title {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.stat-value {
    color: var(--text-main);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

    .card-header h3 {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-main);
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

.card-body {
    padding: 24px;
}

/* PROFILE IDENTITY */
.identity-card {
    text-align: center;
    padding: 40px 24px;
}

.profile-img-box {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 20px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-subtle);
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

    .profile-img-box:hover::after {
        content: 'Change';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,0.6);
        color: white;
        font-size: 11px;
        padding: 4px 0;
        font-weight: 600;
    }

.profile-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.profile-roll {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* BUTTONS */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--btn-dark);
    border: 1px solid var(--btn-dark);
    color: var(--btn-dark-text);
    width: auto;
    padding: 8px 16px;
}

    .btn-primary:hover {
        background: var(--btn-dark-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-card);
    }

.btn-accent {
    background: var(--primary-accent);
    border: 1px solid var(--primary-accent);
    color: white;
    width: auto;
    padding: 8px 16px;
}

    .btn-accent:hover {
        background: var(--primary-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-card);
    }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-main);
    width: auto;
    padding: 8px 16px;
}

    .btn-outline:hover {
        background: var(--table-hover);
    }

/* INFO GRID */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    margin-bottom: 0;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
    word-break: break-word;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-green {
    background: var(--success-bg);
    color: var(--success);
}

.badge-red {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-yellow {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-dark {
    background: var(--btn-dark);
    color: var(--btn-dark-text);
}

.badge-gray {
    background: var(--table-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* LIST ITEMS */
.list-group {
    list-style: none;
}

.list-group-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

    .list-group-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

.list-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.list-content h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 4px;
}

.list-content p {
    font-size: 13px;
    color: var(--text-muted);
}

/* --- SECTION TOGGLING --- */
.content-section {
    display: none;
    animation: fadeSlideUp 0.3s ease-out;
}

    .content-section.active {
        display: block;
    }

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- TABLE STYLES --- */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

    .data-table th, .data-table td {
        padding: 14px 20px;
        text-align: left;
        border-bottom: 1px solid var(--border-light);
    }

    .data-table th {
        background-color: var(--table-header);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .data-table td {
        font-size: 13px;
        color: var(--text-main);
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table tbody tr {
        transition: background-color 0.2s;
    }

        .data-table tbody tr:hover {
            background-color: var(--table-hover);
        }

/* MODAL STYLING */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal-box {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-light);
    transform: scale(0.98);
    animation: popUp 0.2s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popUp {
    to {
        transform: scale(1);
    }
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-main);
    background: var(--input-bg);
    transition: all 0.2s;
    outline: none;
}

    .form-input:focus {
        border-color: var(--border-focus);
        box-shadow: var(--shadow-focus);
    }

/* --- EDIT PROFILE TOGGLE LOGIC --- */
.edit-field, .edit-field-flex, .edit-actions {
    display: none;
}

#profile.edit-mode .editable-text {
    display: none !important;
}

#profile.edit-mode .edit-field {
    display: block;
    margin-top: 4px;
}

#profile.edit-mode .edit-field-flex {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

#profile.edit-mode .edit-actions {
    display: inline-flex;
}

#profile.edit-mode .view-actions {
    display: none !important;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1024px) {
    .profile-grid, .dashboard-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 84px 20px 30px;
    }

    .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 16px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.active {
            transform: translateX(0);
        }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .sidebar-close-btn {
        display: block;
    }
}
