:root {
    --maroon: #800020;
    --maroon-bright: #a0002a;
    --maroon-deep: #4d0013;
    --ink: #1a1a2e;
    --ink-soft: #2a2a3e;
    --bg: #f7f4f5;
    --surface: #ffffff;
    --surface-low: #faf6f7;
    --border: #ecdfe2;
    --text: #1a1a2e;
    --text-muted: #6b6b76;
    --success: #047857;
    --success-bg: #d1fae5;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --info: #0e7490;
    --info-bg: #cffafe;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow-soft: 0 1px 2px rgba(26, 26, 46, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

/* Scrollbars (WebKit/Blink - Chrome, Edge, Safari) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--maroon); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--maroon-deep); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }

body { background: var(--bg); color: var(--text); }
.admin-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 264px; background: var(--ink); color: white;
    position: fixed; top: 0; left: 0; height: 100vh;
    overflow-y: auto; z-index: 1001; transition: transform 0.25s ease;
    display: flex; flex-direction: column;
}
.sidebar-header {
    padding: 28px 24px 20px; display: flex; align-items: center; gap: 12px;
}
.sidebar-header .logo-badge {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--maroon-bright), var(--maroon) 55%, var(--maroon-deep));
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white; flex-shrink: 0; overflow: hidden;
    box-shadow: 0 6px 16px rgba(128, 0, 32, 0.35);
}
.sidebar-header .logo-badge img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-header h3 { font-size: 17px; font-weight: 700; color: white; letter-spacing: 0.2px; }
.sidebar-header p { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 1px; }

.sidebar-menu { padding: 8px 14px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-menu a {
    display: flex; align-items: center; padding: 11px 14px; border-radius: 12px;
    color: rgba(255,255,255,0.68); text-decoration: none; transition: 0.18s; gap: 12px; font-size: 13.5px;
    font-weight: 500;
}
.sidebar-menu a i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-menu a:hover { background: rgba(255,255,255,0.06); color: white; }
.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--maroon-bright), var(--maroon));
    color: white; box-shadow: 0 4px 14px rgba(128, 0, 32, 0.4);
}
.sidebar-menu .menu-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 12px 14px; }
.sidebar-menu .logout-link { color: #ff8a8a; }
.sidebar-menu .logout-link:hover { background: rgba(255, 138, 138, 0.12); }

/* Main Content */
.main-content { margin-left: 264px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Top Bar */
.top-bar {
    background: rgba(247, 244, 245, 0.88); backdrop-filter: blur(10px);
    padding: 14px 28px; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 999; min-height: 60px;
    border-bottom: 1px solid var(--border);
}
.top-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Page Content */
.page-content { padding: 28px; flex: 1; }
.page-header { margin-bottom: 22px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }

/* Toggle button */
.menu-toggle {
    background: none; border: none; color: var(--ink);
    font-size: 20px; cursor: pointer; padding: 6px;
    display: flex; align-items: center; justify-content: center; border-radius: 10px;
}
.menu-toggle:hover { background: var(--surface-low); color: var(--maroon); }

/* Icon button */
.btn-icon {
    background: none; border: none; color: var(--text-muted);
    font-size: 16px; cursor: pointer; padding: 9px;
    border-radius: 10px; transition: 0.18s;
}
.btn-icon:hover { background: var(--surface-low); color: var(--maroon); }

/* Search */
.search-box {
    display: flex; align-items: center;
    background: var(--surface-low); padding: 9px 14px; border-radius: 12px;
    border: 1px solid var(--border);
}
.search-box i { color: #a89ba0; margin-right: 8px; font-size: 13px; }
.search-box input { border: none; background: none; outline: none; font-size: 13.5px; width: 220px; max-width: 100%; color: var(--text); }

/* Cards */
.card {
    background: var(--surface); border-radius: var(--radius); padding: 24px;
    margin-bottom: 22px; border: 1px solid var(--border); box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.card h3 { margin-bottom: 18px; color: var(--text); font-size: 16px; font-weight: 700; }

/* Hero card - one bold gradient accent per page, matching the mobile apps */
.hero-card {
    border-radius: 24px; padding: 26px 28px; margin-bottom: 22px; color: white;
    background: linear-gradient(135deg, var(--maroon-bright), var(--maroon) 55%, #1a0008);
    box-shadow: 0 16px 36px -12px rgba(128, 0, 32, 0.45);
    position: relative; overflow: hidden;
}
.hero-card::before, .hero-card::after {
    content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.08);
}
.hero-card::before { width: 160px; height: 160px; right: -50px; top: -60px; }
.hero-card::after { width: 120px; height: 120px; left: -40px; bottom: -50px; }
.hero-card .hero-label { font-size: 13px; opacity: 0.85; font-weight: 500; position: relative; }
.hero-card .hero-value { font-size: 34px; font-weight: 700; margin-top: 6px; position: relative; }
.hero-card .hero-sub { font-size: 12.5px; opacity: 0.75; margin-top: 6px; position: relative; }

/* Stats */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px; margin-bottom: 24px;
}
.stat-card {
    background: var(--surface); padding: 20px; border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow-soft);
    display: flex; flex-direction: column; gap: 10px;
}
.stat-card .stat-icon {
    width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center;
    justify-content: center; background: rgba(128, 0, 32, 0.1); color: var(--maroon); font-size: 16px;
}
.stat-card h3 { font-size: 24px; color: var(--text); font-weight: 700; word-break: break-word; }
.stat-card p { color: var(--text-muted); font-size: 13px; }

/* Tables */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
th { background: var(--surface-low); font-weight: 600; color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: var(--surface-low); }
td img { border-radius: 8px; }

/* Table toolbar (search + filters, above a table) */
.table-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filter-select {
    background: var(--surface-low); border: 1px solid var(--border); border-radius: 12px;
    padding: 9px 14px; font-size: 13.5px; color: var(--text); outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--maroon); }

/* Table footer (range label + page size + pagination) */
.table-footer {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.table-range { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.table-footer-right { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.page-size-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.page-size-select {
    background: var(--surface-low); border: 1px solid var(--border); border-radius: 9px;
    padding: 6px 10px; font-size: 12.5px; color: var(--text); outline: none; cursor: pointer;
}
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn {
    min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); border-radius: 9px; cursor: pointer;
    font-size: 12.5px; font-weight: 500; transition: 0.15s;
}
.page-btn:hover:not(:disabled) { background: var(--surface-low); border-color: var(--maroon); }
.page-btn.active { background: var(--maroon); border-color: var(--maroon); color: white; }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-ellipsis { padding: 0 4px; color: var(--text-muted); font-size: 12.5px; }

/* Buttons */
.btn {
    background: var(--maroon); color: white; padding: 11px 22px; border: none;
    border-radius: 12px; cursor: pointer; font-weight: 600; transition: all 0.18s;
    font-size: 13.5px; white-space: nowrap;
}
.btn:hover { background: var(--maroon-deep); transform: translateY(-1px); }
.btn-sm {
    background: var(--maroon); color: white; padding: 7px 14px; border: none;
    border-radius: 9px; cursor: pointer; font-size: 12px; margin: 2px; white-space: nowrap; font-weight: 500;
}
.btn-sm:hover { background: var(--maroon-deep); }
.btn-outline {
    background: transparent; color: var(--maroon); border: 1.5px solid var(--maroon);
    padding: 9px 20px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 13.5px;
}
.btn-outline:hover { background: rgba(128,0,32,0.06); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-warning { background: #d97706; color: white; }
.btn-warning:hover { background: #b45309; }

/* Badges */
.badge { padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text); font-weight: 600; font-size: 13.5px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px;
    font-size: 14px; background: var(--surface-low); color: var(--text); transition: 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--maroon); background: white;
}
.help-text { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.form-switch { display: flex; align-items: center; gap: 10px; }

/* Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 26, 46, 0.55); backdrop-filter: blur(2px);
    justify-content: center; align-items: center; z-index: 2000;
}
.modal-content {
    background: white; padding: 26px; border-radius: 22px;
    width: 500px; max-width: 90vw; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 60px -12px rgba(26, 26, 46, 0.35);
}
.modal-content h3 { margin-bottom: 18px; font-size: 18px; }
.modal-content input, .modal-content select, .modal-content textarea {
    width: 100%; padding: 11px 14px; margin: 8px 0; border: 1.5px solid var(--border);
    border-radius: 12px; font-size: 14px; background: var(--surface-low);
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn, .modal-actions .btn-outline { flex: 1; text-align: center; }

/* Charts */
.chart-container { background: var(--surface); padding: 22px; border-radius: var(--radius); margin-bottom: 22px; height: 300px; border: 1px solid var(--border); box-shadow: var(--shadow-soft); }

/* Attachment gallery (request photos/videos) */
.attachment-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.attachment-thumb {
    width: 96px; height: 96px; border-radius: 12px; overflow: hidden; position: relative;
    background: var(--surface-low); border: 1px solid var(--border); cursor: pointer;
}
.attachment-thumb img, .attachment-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-thumb .attachment-label {
    position: absolute; left: 4px; bottom: 4px; background: rgba(26,26,46,0.72); color: white;
    font-size: 10px; padding: 2px 6px; border-radius: 6px; text-transform: capitalize;
}
.attachment-thumb .attachment-play {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 22px; background: rgba(26,26,46,0.25);
}
.attachment-count-badge {
    display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted);
}
.lightbox {
    display: none; position: fixed; inset: 0; background: rgba(10,10,16,0.88); z-index: 3000;
    align-items: center; justify-content: center; padding: 24px;
}
.lightbox img, .lightbox video { max-width: 92vw; max-height: 88vh; border-radius: 10px; }
.lightbox-close {
    position: absolute; top: 18px; right: 24px; color: white; font-size: 26px;
    background: none; border: none; cursor: pointer;
}

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 34px; color: var(--border); margin-bottom: 14px; display: block; }

/* Footer */
.admin-footer {
    background: transparent; text-align: center; padding: 16px 24px;
    font-size: 12.5px; color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .top-bar { padding: 12px 16px; }
    .page-content { padding: 18px; }
    .card { padding: 18px; }
    table { min-width: 500px; }
    th, td { padding: 9px 8px; font-size: 12px; }
    .search-box input { width: 140px; }
    .hero-card { padding: 20px; }
    .hero-card .hero-value { font-size: 28px; }
}
