@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(18, 26, 43, 0.75);
    --bg-card-hover: rgba(28, 39, 64, 0.85);
    --bg-sidebar: #070a12;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    
    --status-green: #10b981;
    --status-green-bg: rgba(16, 185, 129, 0.15);
    --status-red: #ef4444;
    --status-red-bg: rgba(239, 68, 68, 0.15);
    --status-amber: #f59e0b;
    --status-amber-bg: rgba(245, 158, 11, 0.15);
    --status-purple: #a855f7;
    --status-purple-bg: rgba(168, 85, 247, 0.15);
    
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.2);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition-fast: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(6, 182, 212, 0.06) 0px, transparent 50%);
}

/* App Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 28px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-text h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.brand-text p {
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.1));
    border-left: 3px solid var(--accent-indigo);
    font-weight: 600;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    opacity: 0.8;
}

/* Sidebar Stats Indicator Panel */
.sidebar-stats {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-stats-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-left: 4px;
}

.sidebar-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-stat-item strong {
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}


/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

/* Header */
.top-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.role-root {
    background: var(--status-purple-bg);
    color: var(--status-purple);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.role-sub_admin {
    background: var(--status-amber-bg);
    color: var(--status-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: var(--status-red);
    color: #fff;
}

/* Page Content Container */
.content-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    padding: 22px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-main);
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-green { background: var(--status-green-bg); color: var(--status-green); }
.icon-red { background: var(--status-red-bg); color: var(--status-red); }
.icon-amber { background: var(--status-amber-bg); color: var(--status-amber); }
.icon-purple { background: var(--status-purple-bg); color: var(--status-purple); }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Card Wrapper */
.card-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-main);
}

.card-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title-bar h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Table Design */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.custom-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-table tbody tr {
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition-fast);
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.custom-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.custom-table td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.custom-table td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-green { background: var(--status-green-bg); color: var(--status-green); }
.badge-red { background: var(--status-red-bg); color: var(--status-red); }
.badge-amber { background: var(--status-amber-bg); color: var(--status-amber); }
.badge-purple { background: var(--status-purple-bg); color: var(--status-purple); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--status-red);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input, .form-select {
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
    font-family: inherit;
}

/* Date Picker Calendar Styling */
input[type="date"] {
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    background-color: rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.5);
    filter: invert(1) brightness(1.3);
    transition: var(--transition-fast);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    background-color: var(--accent-indigo);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

    outline: none;
    transition: var(--transition-fast);
    font-family: inherit;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: var(--transition-fast);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Alert Notification */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-danger {
    background: var(--status-red-bg);
    color: var(--status-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: var(--status-green-bg);
    color: var(--status-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Image Diff Layout */
.diff-viewer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 1024px) {
    .diff-viewer {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}


.diff-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diff-card h4 {
    font-size: 14px;
    color: var(--text-secondary);
}

.diff-card img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #000;
}

/* Login Page Specific Layout */
.login-body {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, rgba(11, 15, 25, 0.95) 70%);
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .brand-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px auto;
    font-size: 24px;
}

.login-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Mobile (iPhone) & Tablet (iPad) Responsive Design */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 999;
        display: none;
    }

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

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

    .top-header {
        padding: 0 16px;
        height: 60px;
    }

    .top-header .mobile-nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        font-size: 20px;
        width: 38px;
        height: 38px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .content-body {
        padding: 16px;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 12px;
    }

    .diff-viewer {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .top-header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 10px;
    }

    .page-title h1 {
        font-size: 16px;
    }

    .user-profile {
        width: 100%;
        justify-content: space-between;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .card-panel {
        padding: 16px;
    }

    .card-title-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-title-bar .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .custom-table th, 
    .custom-table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }

    .login-card {
        padding: 24px;
        margin: 16px;
    }
}