/* ============================================
   sismaer - Professional Style
   Complete Redesign with Dark Mode
   ============================================ */

/* ============================================
   ROOT
   ============================================ */
:root {
    /* Light Theme */
    --primary: #1a73e8;
    --primary-dark: #0d47a1;
    --primary-light: #e8f0fe;
    --primary-rgb: 26, 115, 232;

    --secondary: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --info: #4285f4;

    --bg-body: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-navbar: linear-gradient(135deg, #1a73e8, #0d47a1);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.15);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: all .35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
    --bg-body: #0b1121;
    --bg-card: #1a2332;
    --bg-sidebar: #070d19;
    --text-primary: #e8edf5;
    --text-secondary: #b0c0d0;
    --text-muted: #6b7a8f;
    --border-color: #2a3a4e;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --primary-light: rgba(26, 115, 232, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    transition: var(--transition);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    line-height: 1.6;
    width: 100%;
    max-width: 100%;
}

a {
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   LAYOUT
   ============================================ */
.app {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar wrapper */
.sidebar {
    width: 260px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0f172a, #070d19);

    position: fixed;
    top: 0;
    left: 0;

    height: 100vh;

    z-index: 1045;
    overflow-x: hidden;
    overflow-y: auto;

    transition: width .25s ease;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Main content */
.main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.main.expanded {
    margin-left: 70px;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 100%;
    padding: 24px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease;
    z-index: 1040;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 65px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: var(--transition);
}

.sidebar-logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

.sidebar-header h5 {
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 14px;
    margin-bottom: 2px;
}

.sidebar-header small {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Smooth collapse: text fades while the sidebar width animates. */
.sidebar-header h5,
.sidebar-header small,
.sidebar-menu .nav-item span,
.sidebar-footer .version {
    transition: opacity .18s ease, visibility .18s ease;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-menu {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

.sidebar-menu .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    white-space: nowrap;

    transition: background .25s ease,
                transform .25s ease,
                color .25s ease;
}

.sidebar-menu .nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sidebar-menu .nav-item:hover::before,
.sidebar-menu .nav-item.active::before {
    transform: scaleY(1);
}

.sidebar-menu .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(3px);
}

.sidebar-menu .nav-item.active {
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.25) 0%, rgba(13, 71, 161, 0.15) 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.15);
}

.sidebar-menu .nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-footer hr {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 0 0 10px 0;
}

.sidebar-footer .version {
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
    line-height: 1.6;
}

.sidebar-footer .version strong {
    color: rgba(255, 255, 255, 0.5);
}

/* Collapse button */
.sidebar-collapse-btn {
    position: absolute;
    bottom: 80px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.sidebar-collapse-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/*
|--------------------------------------------------------------------------
| Collapsed state - HANYA untuk desktop (>= 992px)
|--------------------------------------------------------------------------
| Dipindah ke media query min-width agar tidak berdampak di mobile.
| Ini memperbaiki bug: di mobile sidebar collapse "hanya icon yang muncul".
*/
@media (min-width: 992px) {
    .sidebar.collapsed {
        width: 70px;
        min-width: 70px;
    }

    .sidebar.collapsed .sidebar-header h5,
    .sidebar.collapsed .sidebar-header small,
    .sidebar.collapsed .sidebar-menu .nav-item span,
    .sidebar.collapsed .sidebar-footer .version {
        opacity: 0;
        visibility: hidden;
        width: 0;
        height: 0;
        overflow: hidden;
    }

    .sidebar.collapsed .sidebar-menu .nav-item {
        position: relative;
        justify-content: center;
        padding: 14px 8px;
    }

    .sidebar.collapsed .sidebar-menu .nav-item:hover {
        background: rgba(255, 255, 255, 0.12);
    }

    .sidebar.collapsed .sidebar-menu .nav-item i {
        font-size: 20px;
        width: auto;
        margin: 0;
    }

    .sidebar.collapsed .sidebar-logo {
        width: 35px;
        margin-bottom: 6px;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 16px 10px;
    }

    .sidebar.collapsed .sidebar-footer {
        padding: 10px 5px;
    }

    .sidebar.collapsed .sidebar-footer hr {
        margin: 8px 0;
    }
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar-main {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    padding: 10px 24px;
    box-shadow: 0 4px 20px rgba(13, 71, 161, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

[data-theme="dark"] .navbar-main {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.navbar-main .navbar-brand {
    color: #fff !important;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-main .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.navbar-main .user-avatar:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.hamburger-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.dark-mode-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
    backdrop-filter: blur(10px);
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.digital-clock {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

/* Dropdown */
.navbar-main .dropdown-menu {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    margin-top: 12px !important;
    min-width: 200px;
}

.navbar-main .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-main .dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

[data-theme="dark"] .navbar-main .dropdown-menu {
    background: #1a2332;
}

[data-theme="dark"] .navbar-main .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .navbar-main .dropdown-item:hover {
    background: rgba(26, 115, 232, 0.2);
}

/* ============================================
   CONTENT - PAGE HEADER
   ============================================ */
.page-header {
    margin-bottom: 24px;
}

.page-header .page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.page-header .page-title .title-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.page-header .page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   CARD - STAT CARDS
   ============================================ */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 14px;
    transition: var(--transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-card .stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green  { background: #e6f4ea; color: var(--secondary); }
.stat-card .stat-icon.yellow { background: #fef3cd; color: #d97706; }
.stat-card .stat-icon.red    { background: #fce4ec; color: var(--danger); }
.stat-card .stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-card .stat-icon.cyan   { background: #e0f2fe; color: #0284c7; }

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 4px 0;
}

.stat-card .stat-trend {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.stat-card .stat-trend.up   { color: var(--secondary); }
.stat-card .stat-trend.down { color: var(--danger); }

/* ============================================
   CARD - MODERN
   ============================================ */
.card-modern {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    border: 1px solid var(--border-color);
    height: 100%;
}

.card-modern:hover {
    box-shadow: var(--shadow-lg);
}

.card-modern .card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    padding: 16px 24px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-modern .card-body {
    padding: 24px;
}

[data-theme="dark"] .card-modern .card-header {
    background: linear-gradient(135deg, #1a3a6e, #0d2240);
}

/* ============================================
   TABLE
   ============================================ */
.table-responsive {
    border-radius: var(--radius-sm);
    overflow-x: auto;
    width: 100%;
}

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border: none;
    border-bottom: 2px solid var(--primary);
    white-space: nowrap;
}

[data-theme="dark"] .table-modern thead th {
    background: rgba(26, 115, 232, 0.15);
    color: #90caf9;
}

.table-modern tbody tr {
    transition: var(--transition);
}

.table-modern tbody tr:hover {
    background: var(--primary-light);
}

[data-theme="dark"] .table-modern tbody tr:hover {
    background: rgba(26, 115, 232, 0.08);
}

.table-modern tbody td {
    word-break: break-word;
    overflow-wrap: anywhere;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

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

/* ============================================
   BADGES
   ============================================ */
.badge-modern {
    padding: 5px 14px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: var(--transition);
}

.badge-modern.hadir      { background: #e6f4ea; color: var(--secondary); }
.badge-modern.terlambat  { background: #fce4ec; color: var(--danger); }
.badge-modern.izin       { background: #fef3cd; color: #d97706; }
.badge-modern.sakit      { background: #f3e8ff; color: #7c3aed; }

[data-theme="dark"] .badge-modern.hadir     { background: rgba(52, 168, 83, 0.2); color: #81c784; }
[data-theme="dark"] .badge-modern.terlambat { background: rgba(234, 67, 53, 0.2); color: #ef9a9a; }
[data-theme="dark"] .badge-modern.izin      { background: rgba(251, 188, 4, 0.2); color: #ffd54f; }
[data-theme="dark"] .badge-modern.sakit     { background: rgba(124, 58, 237, 0.2); color: #ce93d8; }

/* ============================================
   BUTTONS
   ============================================ */
.btn-modern {
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-modern:hover {
    transform: translateY(-2px);
    text-decoration: none;
    color: #fff;
}

.btn-modern:active {
    transform: translateY(0);
}

.btn-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-modern.primary { background: var(--primary); color: #fff; }
.btn-modern.primary:hover { background: var(--primary-dark); box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3); }

.btn-modern.success { background: var(--secondary); color: #fff; }
.btn-modern.success:hover { background: #2d8f47; box-shadow: 0 4px 15px rgba(52, 168, 83, 0.3); }

.btn-modern.danger { background: var(--danger); color: #fff; }
.btn-modern.danger:hover { background: #d33426; box-shadow: 0 4px 15px rgba(234, 67, 53, 0.3); }

.btn-modern.warning { background: var(--warning); color: #1e293b; }
.btn-modern.warning:hover { background: #e5a800; color: #1e293b; box-shadow: 0 4px 15px rgba(251, 188, 4, 0.3); }

.btn-modern.info { background: var(--info); color: #fff; }

.btn-modern.outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-modern.outline:hover { background: var(--primary); color: #fff; }

.btn-modern.sm { padding: 6px 14px; font-size: 12px; }
.btn-modern.lg { padding: 14px 30px; font-size: 15px; }

/* ============================================
   FORMS
   ============================================ */
.form-modern .form-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 6px;
}

.form-modern .form-control,
.form-modern .form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-body);
    color: var(--text-primary);
}

.form-modern .form-control:focus,
.form-modern .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
    background: var(--bg-card);
}

[data-theme="dark"] .form-modern .form-control,
[data-theme="dark"] .form-modern .form-select {
    background: #0f1a2e;
    border-color: #2a3a4e;
    color: #e8edf5;
}

[data-theme="dark"] .form-modern .form-control:focus,
[data-theme="dark"] .form-modern .form-select:focus {
    background: #1a2332;
    border-color: var(--primary);
}

/* ============================================
   FILTER CARD
   ============================================ */
.filter-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.filter-card:hover {
    box-shadow: var(--shadow-lg);
}

/* ============================================
   BACK TO TOP
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    z-index: 999;
}

.back-to-top.show {
    display: flex;
    animation: scaleIn 0.3s ease-out;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   MAP
   ============================================ */
#map {
    width: 100%;
    height: 420px;
    border-radius: 15px;
    border: 1px solid #dbe3ea;
    overflow: hidden;
}

.leaflet-container {
    border-radius: 15px;
}

.leaflet-popup-content {
    font-size: 14px;
}

[data-theme="dark"] .leaflet-container {
    filter: invert(0.9) hue-rotate(180deg);
}

/* ============================================
   CAMERA
   ============================================ */
.camera-container {
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    position: relative;
}

.camera-container video {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    background: #000;
}

.camera-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    color: #fff;
    flex-direction: column;
    gap: 12px;
}

/* ============================================
   MODAL (Dark Mode Overrides)
   ============================================ */
[data-theme="dark"] .modal-content {
    background: #1a2332;
    color: #e8edf5;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #2a3a4e;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #2a3a4e;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   UTILITY
   ============================================ */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
}

.breadcrumb-item.active {
    color: var(--text-muted);
    font-size: 13px;
}

.alert-modern {
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInUp 0.3s ease-out;
}

.alert-modern.success {
    background: #e6f4ea;
    color: #1b5e20;
    border-left: 4px solid var(--secondary);
}

.alert-modern.error {
    background: #fce4ec;
    color: #b71c1c;
    border-left: 4px solid var(--danger);
}

.alert-modern.warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #d97706;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    margin: 0 auto;
    box-shadow: 0 8px 30px rgba(26, 115, 232, 0.3);
}

.info-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.sidebar-version {
    font-size: 11px;
}

.sidebar-role {
    font-size: 10px;
    color: #64748b;
}

.navbar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.navbar-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.navbar-subtitle {
    font-size: 10px;
    color: #dbeafe;
}

.navbar-user-name {
    font-size: 13px;
}

.navbar-user-role {
    color: #dbeafe;
    font-size: 10px;
}

.navbar-user-dropdown {
    cursor: pointer;
}

.dashboard-action {
    font-size: 14px;
}

/* Dark Mode: plugin & misc */
[data-theme="dark"] .swal2-popup {
    background: #1a2332 !important;
    color: #e8edf5 !important;
}

[data-theme="dark"] .swal2-title {
    color: #e8edf5 !important;
}

[data-theme="dark"] .dropdown-menu {
    background: #1a2332 !important;
    border-color: #2a3a4e !important;
}

[data-theme="dark"] .dropdown-item {
    color: #e8edf5 !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background: rgba(26, 115, 232, 0.15) !important;
    color: #fff !important;
}

[data-theme="dark"] .dropdown-divider {
    border-top-color: #2a3a4e !important;
}

[data-theme="dark"] div.dataTables_wrapper div.dataTables_length label,
[data-theme="dark"] div.dataTables_wrapper div.dataTables_info,
[data-theme="dark"] div.dataTables_wrapper div.dataTables_filter label {
    color: #b0c0d0 !important;
}

[data-theme="dark"] .dataTables_filter input {
    background: #0f1a2e !important;
    border-color: #2a3a4e !important;
    color: #e8edf5 !important;
}

[data-theme="dark"] .page-link {
    background: #1a2332 !important;
    border-color: #2a3a4e !important;
    color: #b0c0d0 !important;
}

[data-theme="dark"] .page-item.active .page-link {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

[data-theme="dark"] canvas {
    filter: brightness(0.9);
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* Tablet / Mobile: offcanvas sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        width: 260px;
        min-width: 260px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1055;
        pointer-events: auto;
    }

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

    /* Di mobile, collapsed tidak berpengaruh (selalu full width) */
    .sidebar.collapsed {
        width: 260px;
        min-width: 260px;
    }

    .sidebar-close {
        display: flex;
    }

    .sidebar-collapse-btn {
        display: none !important;
    }

    .main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .main-content {
        width: 100%;
        padding: 18px;
    }

    .navbar-main {
        padding: 8px 16px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }
}

/* Small mobile */
@media (max-width: 767.98px) {
    .main-content {
        padding: 15px;
    }
}

/* Extra small mobile */
@media (max-width: 575.98px) {
    .main-content {
        padding: 12px;
    }

    .page-header .page-title {
        font-size: 18px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    .card-modern .card-body {
        padding: 16px;
    }

    .digital-clock {
        font-size: 16px;
    }
}

/* ============================================
   FIX MOBILE - SISMART
   ============================================ */
@media (max-width: 575.98px) {

    /* =========================
       NAVBAR MOBILE
       ========================= */

    .navbar-pln {
        padding: 6px 8px;
    }

    .navbar-pln .container-fluid {
        width: 100%;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Logo navbar mobile: jangan dipotong */
    .navbar-main .navbar-brand {
        min-width: 44px !important;
        width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        display: flex !important;
        align-items: center !important;
        flex: 0 0 44px !important;
    }

    .navbar-main .navbar-logo {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        object-fit: contain !important;
        object-position: center !important;
        display: block !important;
        flex: 0 0 42px !important;
    }

    /* Tulisan SISMART */
    .navbar-brand .fw-bold {
        font-size: 17px !important;
        line-height: 1.15;
        white-space: nowrap;
    }

    /* Nama panjang sistem */
    .navbar-brand small {
        display: block;
        font-size: 8px !important;
        line-height: 1.25;
        white-space: normal !important;
        max-width: 190px;
        overflow-wrap: break-word;
    }

    /* Tombol hamburger */
    .navbar-toggler {
        flex-shrink: 0;
        padding: 5px 7px;
        margin-left: 5px;
    }


    /* =========================
       HERO MOBILE
       ========================= */

    .hero-section {
        padding-top: 70px;
        min-height: auto;
        overflow: hidden;
    }

    .hero-section .container {
        width: 100%;
        max-width: 100%;
        padding-left: 18px;
        padding-right: 18px;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .hero-content h1 {
        font-size: 28px !important;
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .hero-content h3 {
        font-size: 17px !important;
        line-height: 1.4;
        white-space: normal !important;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .hero-content p {
        font-size: 13px !important;
        line-height: 1.7;
        white-space: normal !important;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .hero-image {
        margin-top: 30px;
        width: 100%;
    }

    .hero-image img {
        width: 100%;
        max-width: 100%;
        height: auto;
    }


    /* =========================
       FITUR & PANDUAN
       ========================= */

    .features-section,
    .guide-section {
        padding: 60px 15px;
    }

    .section-title {
        font-size: 27px !important;
        line-height: 1.3;
    }

    .section-desc {
        font-size: 13px;
        line-height: 1.7;
    }


    /* =========================
       FOOTER
       ========================= */

    .footer-pln {
        padding: 50px 15px 25px;
    }

    .footer-social {
        justify-content: flex-start;
        margin-top: 15px;
    }
}

/* ============================================
   SIDEBAR - TRANSITION SETELAH LOAD
   ============================================ */

.sidebar,
.main {
    transition: none;
}

body.sidebar-ready .sidebar {
    transition:
        width .25s ease,
        transform .25s ease;
}

body.sidebar-ready .main {
    transition:
        margin-left .25s ease;
}
