:root {
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --accent: #c9a227;
    --bg: #f1f5f9;
    --white: #ffffff;
    --text: #334155;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #059669;
    --font: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* Auth */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a, #1e3a5f); padding: 2rem; }
.auth-card { background: white; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-icon { font-size: 2.5rem; }
.auth-header h1 { font-size: 1.5rem; color: #0f172a; margin: 0.5rem 0; }
.auth-header p { color: #64748b; font-size: 0.9rem; }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.auth-form input { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; }
.auth-form input:focus { outline: none; border-color: var(--accent); }

/* Admin Layout */
.admin-body { min-height: 100vh; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 260px; background: var(--sidebar); color: white; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 1.5rem; font-weight: 700; font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-link { display: block; padding: 0.75rem 1.5rem; color: rgba(255,255,255,0.7); font-weight: 500; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-link:hover { background: var(--sidebar-hover); color: white; }
.sidebar-link.active { background: var(--sidebar-hover); color: var(--accent); border-left-color: var(--accent); }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer a { display: block; padding: 0.5rem 0; color: rgba(255,255,255,0.5); font-size: 0.85rem; }
.sidebar-footer a:hover { color: white; }

.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-topbar { background: white; padding: 1rem 2rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.admin-topbar h1 { font-size: 1.25rem; color: #0f172a; }
.topbar-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.role-badge { background: #e2e8f0; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.75rem; text-transform: uppercase; }

.admin-content { padding: 2rem; overflow-y: auto; flex: 1; }

/* Components */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem 1.25rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; border: 1px solid transparent; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.btn-primary { background: linear-gradient(135deg, #c9a227, #a67c00); color: #0f172a; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: white; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

.alert { padding: 0.85rem 1.25rem; border-radius: 8px; margin-bottom: 1.25rem; font-size: 0.9rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.card { background: white; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 1.1rem; color: #0f172a; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card { background: white; border-radius: 12px; padding: 1.5rem; border: 1px solid var(--border); }
.stat-card.accent { background: linear-gradient(135deg, #0f172a, #1e3a5f); color: white; }
.stat-card.accent .stat-label { color: rgba(255,255,255,0.7); }
.stat-value { font-size: 2rem; font-weight: 700; color: #0f172a; }
.stat-card.accent .stat-value { color: #e8c547; }
.stat-label { font-size: 0.85rem; color: #64748b; margin-top: 0.25rem; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.85rem 1.25rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tr:hover td { background: #fafbfc; }
.data-table small { color: #94a3b8; }
.actions { white-space: nowrap; }

.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 5px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-muted { background: #f1f5f9; color: #64748b; }
.badge-gold { background: #fef3c7; color: #92400e; }

.page-actions { margin-bottom: 1.25rem; }

.form-card { padding: 1.5rem; }
.form-section { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section h3 { font-size: 1rem; color: #0f172a; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-group { display: flex; flex-direction: column; }
.form-group.span-2 { grid-column: span 2; }
.form-group label { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: #475569; }
.form-group input, .form-group select, .form-group textarea { padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.9rem; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-checks { display: flex; gap: 2rem; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.checkbox input { width: auto; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.form-hint { color: #64748b; font-size: 0.85rem; margin-bottom: 1rem; }

.permissions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.perm-item { background: #f8fafc; padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid var(--border); flex-direction: column; align-items: flex-start; }
.perm-item small { color: #94a3b8; font-size: 0.75rem; }

.image-preview-grid { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.image-preview { position: relative; }
.image-preview img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; }
.image-preview form { margin-top: 0.25rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Location admin */
.location-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; max-width: 400px; }
.location-stat-card {
    background: linear-gradient(135deg, #0c3d4a, #165a6b); color: white;
    border-radius: 14px; padding: 1.25rem 1.5rem; text-align: center;
}
.location-stat-value { display: block; font-size: 2rem; font-weight: 700; }
.location-stat-label { font-size: 0.85rem; opacity: 0.75; }

.location-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.location-form-card { padding: 1.5rem; }
.card-icon-header { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.card-icon { font-size: 2rem; line-height: 1; }
.card-icon-header h3 { font-size: 1.05rem; color: #0f172a; margin-bottom: 0.2rem; }
.card-icon-header p { font-size: 0.85rem; color: #64748b; }

.location-list-card { padding: 0; }
.location-list-card .card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.search-input {
    padding: 0.55rem 1rem; border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 0.9rem; min-width: 220px;
}
.search-input:focus { outline: none; border-color: #14b8a6; }

.city-accordion { max-height: 600px; overflow-y: auto; }
.city-panel { padding: 1.15rem 1.5rem; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.city-panel:hover { background: #f8fafc; }
.city-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; }
.city-panel-title { display: flex; align-items: center; gap: 0.75rem; }
.city-badge {
    background: #ccfbf1; color: #0d9488; font-size: 0.75rem; font-weight: 700;
    padding: 0.2rem 0.55rem; border-radius: 20px; min-width: 28px; text-align: center;
}
.district-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.district-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: white; border: 1px solid var(--border); padding: 0.4rem 0.65rem;
    border-radius: 20px; font-size: 0.85rem; transition: all 0.2s;
}
.district-chip:hover { border-color: #14b8a6; background: #f0fdfa; }
.chip-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 0 0 0.15rem; }
.empty-chip { color: #94a3b8; font-size: 0.85rem; font-style: italic; }

.table-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.table-avatar-placeholder {
    width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0c3d4a);
    color: white; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.preview-photo { max-height: 80px; border-radius: 10px; margin-top: 0.5rem; display: block; }

.admin-error { padding: 4rem; text-align: center; }
.admin-error h1 { font-size: 3rem; color: #0f172a; }

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .form-grid, .grid-2, .location-forms { grid-template-columns: 1fr; }
    .form-group.span-2 { grid-column: span 1; }
    .location-stats { max-width: none; }
}
