/* ========================================
   SocietyChef SuperAdmin Dashboard - Styles
   ======================================== */

:root {
    --primary: #057876;
    --primary-light: #32BFB9;
    --primary-dark: #045f5d;
    --sidebar-bg: #0f1923;
    --sidebar-hover: #1a2b3c;
    --sidebar-active: #057876;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1c1c1c;
    --text-secondary: #686b78;
    --border: #e4e6e8;
    --danger: #dc3545;
    --warning: #f59e0b;
    --success: #10b981;
    --info: #3b82f6;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 10px;
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ======== LOGIN ======== */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1923 0%, #057876 100%);
    padding: 20px;
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { width: 72px; height: 72px; border-radius: 16px; margin-bottom: 16px; }
.login-card h1 { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }
.login-error { background: #fef2f2; color: var(--danger); padding: 10px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; border: 1px solid #fecaca; }
.btn-google {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}
.btn-google:hover { background: #f8f9fa; box-shadow: var(--shadow); }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-secondary); font-size: 13px; }
.login-divider::before, .login-divider::after { flex: 1; height: 1px; background: var(--border); content: ''; }
#email-login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: var(--transition);
}
#email-login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,120,118,0.1); }
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-full { width: 100%; }
.login-note { font-size: 12px; color: var(--text-secondary); margin-top: 20px; }

/* ======== LOADING ======== */
#loading-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    gap: 16px;
    color: var(--text-secondary);
}
.spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======== DASHBOARD LAYOUT ======== */
#dashboard { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #c8d6e5;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width 0.3s ease;
    overflow: hidden;
}
#sidebar.collapsed { width: 68px; }
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-brand,
#sidebar.collapsed .admin-badge span.nav-label { display: none; }
#sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }
#sidebar.collapsed .admin-badge { justify-content: center; }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo { width: 36px; height: 36px; border-radius: 10px; }
.sidebar-brand { font-size: 18px; font-weight: 700; color: white; white-space: nowrap; }
.sidebar-toggle {
    background: none;
    color: #c8d6e5;
    margin-left: auto;
    padding: 4px;
    border-radius: 6px;
    display: flex;
}
.sidebar-toggle:hover { background: var(--sidebar-hover); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #8e9aaf;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}
.nav-item:hover { color: white; background: var(--sidebar-hover); }
.nav-item.active { color: white; background: var(--sidebar-active); border-right: 3px solid var(--primary-light); }
.nav-item .material-icons-outlined { font-size: 22px; width: 22px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.admin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--primary-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-badge .material-icons-outlined { font-size: 18px; }

/* Main Content */
#main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
#sidebar.collapsed ~ #main-content { margin-left: 68px; }

#top-bar {
    background: white;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.mobile-menu-btn { display: none; background: none; color: var(--text); padding: 4px; border-radius: 6px; }
#page-title { font-size: 22px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-info { display: flex; align-items: center; gap: 12px; }
.admin-email { font-size: 13px; color: var(--text-secondary); }
.btn-logout { background: none; color: var(--text-secondary); padding: 6px; border-radius: 6px; display: flex; transition: var(--transition); }
.btn-logout:hover { color: var(--danger); background: #fef2f2; }

.page-content { padding: 24px 28px; flex: 1; }

/* ======== STAT CARDS ======== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon .material-icons-outlined { font-size: 24px; color: white; }
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #f87171); }
.stat-icon.teal { background: linear-gradient(135deg, #057876, #32BFB9); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.stat-info { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.stat-change { font-size: 12px; margin-top: 4px; font-weight: 500; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ======== CARDS ======== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 16px; font-weight: 700; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ======== DATA TABLES ======== */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    flex-wrap: wrap;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}
.search-box .material-icons-outlined { font-size: 20px; color: var(--text-secondary); }
.search-box input { border: none; background: none; outline: none; font-size: 13px; width: 100%; }
.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: white;
    color: var(--text);
    outline: none;
}
.filter-select:focus { border-color: var(--primary); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: #f8f9fa; }
.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.data-table tr:hover { background: #fafbfc; }
.data-table tr:last-child td { border-bottom: none; }

.table-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.table-empty .material-icons-outlined { font-size: 48px; margin-bottom: 12px; display: block; opacity: 0.4; }

.table-footer {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.pagination { display: flex; gap: 4px; }
.page-btn {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    font-size: 13px;
    transition: var(--transition);
}
.page-btn:hover { background: var(--bg); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ======== STATUS BADGES ======== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-accepted { background: #dbeafe; color: #1e40af; }
.badge-preparing { background: #e0e7ff; color: #3730a3; }
.badge-ready { background: #d1fae5; color: #065f46; }
.badge-out_for_delivery { background: #cffafe; color: #155e75; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-disputed { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-blocked { background: #fee2e2; color: #991b1b; }
.badge-verified { background: #d1fae5; color: #065f46; }
.badge-unverified { background: #fef3c7; color: #92400e; }
.badge-cook { background: #e0e7ff; color: #3730a3; }
.badge-foodie { background: #fce7f3; color: #9d174d; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-open { background: #fef3c7; color: #92400e; }
.badge-closed { background: #f3f4f6; color: #6b7280; }
.badge-online { background: #d1fae5; color: #065f46; }
.badge-cod { background: #fef3c7; color: #92400e; }

/* ======== BUTTONS ======== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}
.btn .material-icons-outlined { font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-sm .material-icons-outlined { font-size: 14px; }
.btn-primary-btn { background: var(--primary); color: white; }
.btn-primary-btn:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    transition: var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: #fef2f2; color: var(--danger); }
.btn-icon.success:hover { background: #ecfdf5; color: var(--success); }

/* ======== MODAL ======== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.modal-content {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: none;
    font-size: 22px;
    color: var(--text-secondary);
    transition: var(--transition);
}
.modal-close:hover { background: #fef2f2; color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.detail-item { }
.detail-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 500; word-break: break-all; }
.detail-item.full { grid-column: 1 / -1; }

/* ======== CHARTS ======== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.chart-container { position: relative; height: 280px; }

/* ======== TOAST ======== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ======== TABS ======== */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ======== FORM ELEMENTS ======== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,120,118,0.1); }
.form-textarea { resize: vertical; min-height: 80px; }

/* ======== RESPONSIVE ======== */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        width: 260px !important;
    }
    #sidebar.mobile-open { transform: translateX(0); }
    #main-content { margin-left: 0 !important; }
    .mobile-menu-btn { display: flex; }
    .sidebar-toggle { display: none; }
    .page-content { padding: 16px; }
    #top-bar { padding: 12px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: none; }
    .data-table { display: block; overflow-x: auto; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-email { display: none; }
}

/* ======== LOADING ROWS ======== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    height: 14px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ======== USER AVATAR ======== */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 500; }
.user-email { font-size: 12px; color: var(--text-secondary); }

/* ======== ORDER ITEMS LIST ======== */
.order-items-list { list-style: none; }
.order-items-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.order-items-list li:last-child { border-bottom: none; }

/* ======== QUICK ACTIONS ======== */
.actions-cell { display: flex; gap: 4px; }

/* ======== CONFIRM DIALOG ======== */
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ======== SETTINGS SECTION ======== */
.settings-section { max-width: 600px; margin-bottom: 32px; }
.settings-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
