/* ═══════════════════════════════════════════════════════════════════
   SILIENT Customer Portal — Styles
   Brand: #1F2C10 (olive), #FFFAF2 (cream), #C8A862 (gold)
   Fonts: Gilda Display (headings), Lato (body)
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --olive: #1F2C10;
    --olive-light: #2d3f1a;
    --cream: #FFFAF2;
    --cream-dark: #f5efe6;
    --gold: #C8A862;
    --gold-light: #d4bb7e;
    --gold-dark: #b09450;
    --text-primary: #1F2C10;
    --text-secondary: #5a6548;
    --text-muted: #8a9178;
    --border: #e0d5c3;
    --danger: #c0392b;
    --danger-light: #f9e7e5;
    --success: #27ae60;
    --success-light: #e8f8ef;
    --shadow: 0 2px 8px rgba(31, 44, 16, 0.08);
    --shadow-lg: 0 4px 20px rgba(31, 44, 16, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Gilda Display', Georgia, serif;
    font-weight: 400;
}

/* ── LOGIN PAGE ──────────────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--olive);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    width: 200px;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--gold);
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 40px;
}

.login-card {
    background: var(--cream);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    color: var(--olive);
    margin-bottom: 24px;
    font-size: 24px;
}

/* ── FORMS ────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Lato', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    background: #fff;
    transition: border-color var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--gold);
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Lato', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--olive);
    color: var(--cream);
    width: 100%;
}

.btn-primary:hover {
    background: var(--olive-light);
}

.btn-gold {
    background: var(--gold);
    color: var(--olive);
}

.btn-gold:hover {
    background: var(--gold-dark);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--olive);
}

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

.btn-danger:hover {
    background: #a93226;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.link-btn {
    background: none;
    border: none;
    color: var(--gold-dark);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Lato', sans-serif;
}

.link-btn:hover {
    color: var(--olive);
}

/* ── ALERT ────────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #e8c4c0;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #b8e6cd;
}

.alert-info {
    background: #eef3ff;
    color: #2c5282;
    border: 1px solid #bee3f8;
}

/* ── LAYOUT ───────────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--olive);
    color: var(--cream);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

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

.sidebar-logo {
    width: 140px;
    margin-bottom: 4px;
}

.sidebar-tagline {
    font-size: 11px;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255,250,242,0.7);
    text-decoration: none;
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--cream);
}

.nav-item.active {
    background: rgba(255,255,255,0.08);
    color: var(--gold);
    border-left-color: var(--gold);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,250,242,0.35);
    padding: 20px 24px 8px;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
    font-size: 13px;
    color: rgba(255,250,242,0.6);
    margin-bottom: 8px;
}

.sidebar-user strong {
    color: var(--cream);
    display: block;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    color: var(--olive);
}

.page-header p {
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── CARDS ────────────────────────────────────────────────────────── */

.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

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

.card-header h3 {
    font-size: 18px;
    color: var(--olive);
}

/* ── FILTERS ──────────────────────────────────────────────────────── */

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background: #fff;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    outline: none;
    min-width: 160px;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    border-color: var(--gold);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--olive);
    width: 16px;
    height: 16px;
}

.checkbox-group label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

/* ── MULTI-SELECT ─────────────────────────────────────────────────── */

.multi-select {
    position: relative;
    min-width: 240px;
}

.multi-select-trigger {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
}

.multi-select-trigger:hover {
    border-color: var(--gold);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
    margin-top: 4px;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition);
}

.multi-select-option:hover {
    background: var(--cream);
}

.multi-select-option.select-all {
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

/* ── CHARTS ───────────────────────────────────────────────────────── */

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.chart-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid var(--border);
}

.chart-card h3 {
    font-size: 16px;
    color: var(--olive);
    margin-bottom: 16px;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

.no-data-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ── TABLES ───────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--cream-dark);
}

.data-table tr:hover td {
    background: var(--cream);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-admin {
    background: rgba(200, 168, 98, 0.15);
    color: var(--gold-dark);
}

.badge-customer {
    background: rgba(31, 44, 16, 0.08);
    color: var(--text-secondary);
}

.badge-active {
    background: var(--success-light);
    color: var(--success);
}

.badge-inactive {
    background: var(--danger-light);
    color: var(--danger);
}

/* ── MODAL ────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(31, 44, 16, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--olive);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ── SPINNER ──────────────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
}

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

.loading-center {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

/* ── MAP ──────────────────────────────────────────────────────────── */

#map-container {
    width: 100%;
    height: calc(100vh - 160px);
    min-height: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.location-popup { font-family: 'Lato', sans-serif; min-width: 280px; }
.location-popup h3 { font-family: 'Gilda Display', serif; font-size: 16px; color: var(--olive); margin-bottom: 8px; }
.location-popup .popup-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--cream-dark); }
.location-popup .popup-row:last-child { border-bottom: none; }
.location-popup .popup-label { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.location-popup .popup-value { color: var(--text-primary); text-align: right; max-width: 180px; }
.popup-edit-btn { margin-top: 10px; }

.popup-edit-form .form-group { margin-bottom: 12px; }
.popup-edit-form .form-group label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 3px; display: block; }
.popup-edit-form .form-group input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: 'Lato', sans-serif; }
.popup-edit-form .form-group input:focus { outline: none; border-color: var(--gold); }

/* ── RESPONSIVE ───────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .filters-bar { flex-direction: column; }
    .multi-select { min-width: 100%; }
}
