/* ==========================================================================
   APP.CSS - Core Global Styles, Design Tokens, Sidebar, Navbar & Base Dark Mode
   ========================================================================== */

:root {
    --primary: #075e34;
    --primary-hover: #064e2b;
    --primary-light: #ecfdf5;
    --primary-gradient: linear-gradient(135deg, #082042 0%, #075e34 60%, #059669 100%);
    --secondary-gradient: linear-gradient(135deg, #082042 0%, #075e34 50%, #f59e0b 100%);
    --accent-gold: #f59e0b;
    --accent-gold-hover: #d97706;
    --accent-navy: #082042;
    --accent-emerald: #10b981;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #eef1f4;
    --border-subtle: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #8896ab;
    --text-sub: #475569;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --shadow-subtle: 0 2px 12px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== OVERLAY ===== */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.overlay.show {
    display: block;
}

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

.sidebar .brand {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar .brand .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #082042, #075e34);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(7, 94, 52, 0.3);
}

.sidebar .brand h2 {
    font-size: 18px;
    font-weight: 800;
    color: #082042;
    letter-spacing: -0.5px;
}

.sidebar .brand h2 span {
    color: #f59e0b;
}

.sidebar .brand small {
    font-size: 11px;
    color: #075e34;
    font-weight: 700;
    display: block;
    margin-top: 2px;
}

.sidebar .nav {
    padding: 12px 14px;
    flex: 1;
    overflow-y: auto;
}

.sidebar .nav .nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 14px 10px 6px;
}

.sidebar .nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9.5px 14px;
    color: var(--text-sub);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    margin-bottom: 3px;
    transition: all 0.2s ease;
}

.sidebar .nav a i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.2s ease;
}

.sidebar .nav a:hover {
    background: #f0fdf4;
    color: #075e34;
}

.sidebar .nav a:hover i {
    color: #075e34;
}

.sidebar .nav a.active {
    background: linear-gradient(135deg, #075e34 0%, #059669 100%);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(7, 94, 52, 0.35);
}

.sidebar .nav a.active i {
    color: #fde68a;
}

/* ===== MAIN WRAPPER ===== */
.main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* ===== NAVBAR ===== */
.navbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
    backdrop-filter: blur(10px);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.navbar .nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar .nav-left .hamburger {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-sub);
    cursor: pointer;
    display: none;
    padding: 4px;
}

.navbar .nav-left .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar .nav-left .breadcrumb span {
    color: var(--text-main);
    font-weight: 600;
}

.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.navbar .nav-right .search-box {
    position: relative;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 220px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.navbar .nav-right .search-box:focus-within {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.12);
}

.navbar .nav-right .search-box i {
    color: var(--text-muted);
    font-size: 13px;
}

.navbar .nav-right .search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--text-main);
    width: 100%;
}

.navbar .nav-right .notif-btn,
.navbar .nav-right .dark-mode-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #f1f5f9;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--text-sub);
    font-size: 16px;
    transition: all 0.2s ease;
}

.navbar .nav-right .notif-btn:hover,
.navbar .nav-right .dark-mode-toggle:hover {
    background: #e2e8f0;
    color: var(--text-main);
    transform: scale(1.05);
}

.navbar .nav-right .notif-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.navbar .nav-right .dark-mode-toggle .sun-icon {
    display: none;
    color: #f59e0b;
}

body.dark-mode .navbar .nav-right .dark-mode-toggle .moon-icon {
    display: none;
}

body.dark-mode .navbar .nav-right .dark-mode-toggle .sun-icon {
    display: block;
}

.navbar .nav-right .profile-wrap {
    position: relative;
}

.navbar .nav-right .profile-wrap .profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
    user-select: none;
}

.navbar .nav-right .profile-wrap .profile-btn:hover {
    background: #f1f5f9;
}

.navbar .nav-right .profile-wrap .profile-btn img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.navbar .nav-right .profile-wrap .profile-btn .info .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.navbar .nav-right .profile-wrap .profile-btn .info .role {
    font-size: 11px;
    color: var(--text-muted);
}

.navbar .nav-right .profile-wrap .profile-btn .arrow {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.navbar .nav-right .profile-wrap .profile-btn .arrow.open {
    transform: rotate(180deg);
}

.navbar .nav-right .profile-wrap .dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 190px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

.navbar .nav-right .profile-wrap .dropdown.show {
    display: flex;
}

.navbar .nav-right .profile-wrap .dropdown a {
    padding: 10px 16px;
    font-size: 13px;
    color: #475569;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease;
}

.navbar .nav-right .profile-wrap .dropdown a:hover {
    background: #f8fafc;
    color: var(--text-main);
}

.navbar .nav-right .profile-wrap .dropdown .divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.navbar .nav-right .profile-wrap .dropdown a.logout {
    color: #ef4444;
}

.navbar .nav-right .profile-wrap .dropdown a.logout:hover {
    background: #fef2f2;
}

/* ===== BASE CONTENT CONTAINER ===== */
.content {
    padding: 0 36px 50px;
}

/* ===== FOOTER ===== */
.app-footer {
    padding: 20px 36px;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: auto;
    transition: all 0.3s ease;
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ===== BASE DARK MODE (MIDNIGHT OBSIDIAN & EMERALD GOLD GLOW) ===== */
body.dark-mode {
    background-color: #090e17;
    color: #f8fafc;
}

body.dark-mode .sidebar {
    background: #0c1524;
    border-right-color: #1a2638;
}

body.dark-mode .sidebar .brand {
    border-bottom-color: #1a2638;
}

body.dark-mode .sidebar .brand h2 {
    color: #f8fafc;
}

body.dark-mode .sidebar .brand small {
    color: #34d399;
}

body.dark-mode .sidebar .nav .nav-label {
    color: #64748b;
}

body.dark-mode .sidebar .nav a {
    color: #94a3b8;
}

body.dark-mode .sidebar .nav a i {
    color: #64748b;
}

body.dark-mode .sidebar .nav a:hover {
    background: #132238;
    color: #34d399;
}

body.dark-mode .sidebar .nav a:hover i {
    color: #34d399;
}

body.dark-mode .sidebar .nav a.active {
    background: linear-gradient(135deg, #075e34 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(7, 94, 52, 0.5);
}

body.dark-mode .sidebar .nav a.active i {
    color: #fbbf24;
}

body.dark-mode .navbar {
    background: rgba(12, 21, 36, 0.95);
    border-bottom-color: #1a2638;
}

body.dark-mode .navbar .nav-left .hamburger {
    color: #94a3b8;
}

body.dark-mode .navbar .nav-left .breadcrumb span,
body.dark-mode .navbar .nav-left .breadcrumb .nav-page-title {
    color: #ffffff !important;
}

body.dark-mode .navbar .nav-right .search-box {
    background: #111c2e;
    border-color: #1e2d42;
}

body.dark-mode .navbar .nav-right .search-box input {
    color: #f8fafc;
}

body.dark-mode .navbar .nav-right .search-box input::placeholder {
    color: #64748b;
}

body.dark-mode .navbar .nav-right .notif-btn,
body.dark-mode .navbar .nav-right .dark-mode-toggle {
    background: #111c2e;
    border-color: #1e2d42;
    color: #f59e0b;
}

body.dark-mode .navbar .nav-right .notif-btn:hover,
body.dark-mode .navbar .nav-right .dark-mode-toggle:hover {
    background: #1a293f;
    border-color: #f59e0b;
    color: #fbbf24;
}

body.dark-mode .navbar .nav-right .profile-wrap .profile-btn:hover {
    background: #111c2e;
}

body.dark-mode .navbar .nav-right .profile-wrap .profile-btn .info .name {
    color: #f8fafc;
}

body.dark-mode .navbar .nav-right .profile-wrap .profile-btn .info .role {
    color: #34d399;
}

body.dark-mode .navbar .nav-right .profile-wrap .dropdown {
    background: #0c1524;
    border-color: #1e2d42;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

body.dark-mode .navbar .nav-right .profile-wrap .dropdown a {
    color: #cbd5e1;
}

body.dark-mode .navbar .nav-right .profile-wrap .dropdown a:hover {
    background: #132238;
    color: #34d399;
}

body.dark-mode .navbar .nav-right .profile-wrap .dropdown a.logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

body.dark-mode .navbar .nav-right .profile-wrap .dropdown .divider {
    background: #1a2638;
}

body.dark-mode .app-footer {
    background: #0c1524;
    border-top-color: #1a2638;
    color: #64748b;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: #f0f4f8;
}
::-webkit-scrollbar-thumb {
    background: #d0d7e2;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #b0bccd;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #0b0f19;
}
body.dark-mode ::-webkit-scrollbar-thumb {
    background: #334155;
}
body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ===== GLOBAL RESPONSIVE (TABLET & MOBILE SIDEBAR TOGGLE) ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 270px;
        z-index: 1000;
    }

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

    .main {
        margin-left: 0;
    }

    .navbar {
        padding: 0 16px;
        height: 64px;
    }

    .navbar .nav-left .hamburger {
        display: block;
    }

    .navbar .nav-left .breadcrumb {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12.5px;
    }

    /* Tablet Mode: Tetap tampilkan Search Box dan Info Profil seperti Desktop */
    .navbar .nav-right .search-box {
        display: flex;
        width: 170px;
    }

    .navbar .nav-right .profile-wrap .profile-btn .info {
        display: flex;
        flex-direction: column;
        text-align: left;
        line-height: 1.2;
    }

    .navbar .nav-right .profile-wrap .profile-btn {
        padding: 6px 12px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .content {
        padding: 0 18px 40px;
    }

    .app-footer {
        padding: 16px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Smartphone / Mobile Screen (<= 640px) */
@media (max-width: 640px) {
    .navbar .nav-right .search-box {
        display: none;
    }

    .navbar .nav-right .profile-wrap .profile-btn .info {
        display: none;
    }

    .navbar .nav-right .profile-wrap .profile-btn {
        padding: 4px;
    }
}

@media (max-width: 480px) {
    .navbar .nav-left {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        flex: 1;
    }

    .navbar .nav-left .breadcrumb {
        display: flex !important;
        align-items: center;
        gap: 5px;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 175px;
    }

    .navbar .nav-left .breadcrumb a,
    .navbar .nav-left .breadcrumb i.fa-chevron-right {
        display: none;
    }

    .navbar .nav-left .breadcrumb span {
        font-size: 13.5px;
        font-weight: 800;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
    }

    .navbar .nav-right {
        gap: 8px;
    }

    .navbar .nav-right .notif-btn,
    .navbar .nav-right .dark-mode-toggle {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}
