/* ═══════════════════════════════════════════════════════════════════
   GTL Dashboard BI — Design System
   Brand: Green Thumb Local
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --brand-primary: #168D48;
    --brand-primary-light: #1EA85A;
    --brand-primary-dark: #0F6A34;
    --brand-dark: #2A2928;
    --brand-darker: #1E1D1C;
    --brand-accent: #F8E554;
    --brand-danger: #F0523B;
    --brand-bg: #F4F5F0;
    --brand-card: #FFFFFF;
    --brand-surface: #1A1918;
    --brand-border: rgba(255,255,255,0.08);
    --brand-text: #E8E8E8;
    --brand-text-muted: #888888;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--brand-darker);
    color: var(--brand-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ─── Buttons ─────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-primary-light); transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: var(--brand-text-muted);
    padding: 6px 12px;
}
.btn-ghost:hover { color: var(--brand-text); background: rgba(255,255,255,0.05); }
.btn-ghost.btn-danger:hover { color: var(--brand-danger); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

.btn .material-symbols-outlined { font-size: 18px; }

/* ─── Login Pages ─────────────────────────────────────────────────── */

.login-body {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 50%, var(--brand-primary-dark) 100%);
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
}

.login-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo { margin-bottom: 24px; }
.logo-img { max-width: 200px; height: auto; }
.login-title { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.login-subtitle { color: var(--brand-text-muted); font-size: 14px; margin-bottom: 32px; }

.google-btn-container {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.login-error {
    background: rgba(240,82,59,0.15);
    border: 1px solid var(--brand-danger);
    color: var(--brand-danger);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 16px;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--brand-text-muted);
    font-size: 13px;
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--brand-border);
}
.login-divider span { padding: 0 16px; }

.client-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}
.client-link:hover { color: var(--brand-primary-light); }

.login-footer {
    margin-top: 32px;
    color: var(--brand-text-muted);
    font-size: 12px;
}

/* ─── Client Login Form ───────────────────────────────────────────── */

.client-form { text-align: left; }

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-text-muted);
    margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--brand-darker);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    color: var(--brand-text);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(22,141,72,0.15);
}
.form-group textarea { resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-divider {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--brand-primary);
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--brand-border);
}

/* ─── Admin Layout ────────────────────────────────────────────────── */

.admin-body { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--brand-surface);
    border-right: 1px solid var(--brand-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--brand-border);
}
.sidebar-logo-img { max-width: 140px; height: auto; }

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--brand-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 4px;
}
.nav-item:hover { color: var(--brand-text); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--brand-primary); background: rgba(22,141,72,0.1); }
.nav-item .material-symbols-outlined { font-size: 20px; }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; }
.user-name { font-size: 13px; font-weight: 500; flex: 1; }
.user-logout { font-size: 12px; color: var(--brand-text-muted); text-decoration: none; }
.user-logout:hover { color: var(--brand-danger); }

/* ─── Main Content ────────────────────────────────────────────────── */

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

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.content-header h2 { font-size: 22px; font-weight: 600; }
.header-badge {
    display: inline-block;
    background: rgba(22,141,72,0.1);
    color: var(--brand-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 12px;
}

.content-section { display: none; }
.content-section.active { display: block; }

/* ─── Client Cards ────────────────────────────────────────────────── */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.client-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}
.client-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary);
    transform: translateY(-2px);
}

.card-header { margin-bottom: 12px; }
.card-status {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}
.card-status.active { background: var(--brand-primary); box-shadow: 0 0 8px rgba(22,141,72,0.4); }
.card-status.inactive { background: var(--brand-text-muted); }

.card-title {
    display: inline;
    font-size: 16px;
    font-weight: 600;
    vertical-align: middle;
}
.card-domain {
    display: block;
    font-size: 13px;
    color: var(--brand-text-muted);
    margin-top: 4px;
}

.card-services {
    display: flex;
    gap: 6px;
    margin: 12px 0;
}
.service-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    color: var(--brand-text-muted);
    border: 1px solid var(--brand-border);
}
.service-badge.configured {
    background: rgba(22,141,72,0.15);
    color: var(--brand-primary);
    border-color: rgba(22,141,72,0.3);
}

.card-actions {
    display: flex;
    gap: 4px;
    border-top: 1px solid var(--brand-border);
    padding-top: 12px;
    margin-top: 12px;
}

/* ─── Empty State ─────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--brand-text-muted);
}
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--brand-text); }
.empty-state p { margin-bottom: 20px; }

/* ─── Tables ──────────────────────────────────────────────────────── */

.table-container { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--brand-text-muted);
    border-bottom: 1px solid var(--brand-border);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--brand-border);
    color: var(--brand-text);
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-header h3 { font-size: 18px; font-weight: 600; }

/* ─── Modals ──────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
}
.modal-sm { max-width: 400px; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--brand-border);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal form { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--brand-border);
    margin-top: 8px;
}

/* ─── Dashboard (Client View) ─────────────────────────────────────── */

.dashboard-body { background: var(--brand-darker); }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: var(--brand-dark);
    border-bottom: 1px solid var(--brand-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-logo { height: 36px; }
.header-title { font-size: 18px; font-weight: 600; }
.header-domain { font-size: 12px; color: var(--brand-text-muted); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.report-select {
    padding: 8px 14px;
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    color: var(--brand-text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
.report-select:focus { outline: none; border-color: var(--brand-primary); }

/* ─── KPIs ────────────────────────────────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 32px;
}

.kpi-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.kpi-card:hover { border-color: var(--brand-primary); transform: translateY(-2px); }

.kpi-icon {
    font-size: 28px;
    color: var(--brand-primary);
    background: rgba(22,141,72,0.1);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.kpi-value { font-size: 24px; font-weight: 700; display: block; }
.kpi-label { font-size: 12px; color: var(--brand-text-muted); }

/* ─── Charts ──────────────────────────────────────────────────────── */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    padding: 0 32px 32px;
}

.chart-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius);
    padding: 24px;
}
.chart-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ─── Report Section ──────────────────────────────────────────────── */

.report-section { padding: 0 32px 32px; }

.report-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius);
    padding: 24px;
}
.report-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.report-content { font-size: 14px; line-height: 1.8; }
.summary-text { white-space: pre-wrap; }
.placeholder-text { color: var(--brand-text-muted); font-style: italic; }

/* ─── Footer ──────────────────────────────────────────────────────── */

.dashboard-footer {
    text-align: center;
    padding: 24px;
    color: var(--brand-text-muted);
    font-size: 12px;
}
.dashboard-footer strong { color: var(--brand-primary); }

/* ─── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        transition: var(--transition);
    }
    .sidebar.open { left: 0; }

    .main-content { margin-left: 0; padding: 16px; }

    .content-header { flex-direction: column; gap: 12px; align-items: flex-start; }

    .cards-grid { grid-template-columns: 1fr; }

    .form-row { grid-template-columns: 1fr; }

    .dashboard-header { flex-direction: column; gap: 12px; padding: 16px; }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
    }

    .report-section { padding: 0 16px 16px; }

    .modal { width: 95%; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: 20px; }
}

/* ─── Toast notifications ─────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.5s forwards;
}
.toast-success { background: var(--brand-primary); color: #fff; }
.toast-error { background: var(--brand-danger); color: #fff; }

@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }
