/* ===== Guest Layout ===== */
.guest-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--pico-background-color);
}

.guest-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    padding: 2rem;
}

.login-card header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-card header h2 {
    margin-bottom: 0.25rem;
}

.login-card header p {
    color: var(--pico-muted-color);
    margin-bottom: 0;
}

/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    min-height: 100vh;
    background: #1e293b;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid #334155;
}

.sidebar-header strong {
    color: #38bdf8;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    background: #334155;
    color: #f1f5f9;
}

.sidebar-nav a.active {
    background: #334155;
    color: #38bdf8;
    border-left: 3px solid #38bdf8;
}

.nav-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #334155;
    font-size: 0.85rem;
}

.logout-link {
    color: #f87171;
    text-decoration: none;
    font-size: 0.85rem;
}

.logout-link:hover {
    color: #ef4444;
}

/* ===== Main Wrapper ===== */
.main-wrapper {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.25rem;
    margin: 0;
}

.header-user {
    font-size: 0.9rem;
    color: var(--pico-muted-color);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin: 0;
}

.app-content {
    padding: 1.5rem;
    flex: 1;
}

/* ===== KPI Grid ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    text-align: center;
    margin: 0;
}

.kpi-card header {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.5rem 0;
}

.kpi-card footer {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

/* ===== Charts Grid ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.charts-grid article {
    margin: 0;
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    color: var(--pico-muted-color);
    padding: 1rem 0;
}

.empty-state-card {
    text-align: center;
    padding: 3rem 2rem;
    margin: 2rem auto;
    max-width: 500px;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state-card h3 {
    margin-bottom: 0.5rem;
}

.empty-state-card p {
    color: var(--pico-muted-color);
    margin-bottom: 1.5rem;
}

/* ===== Settings Tabs ===== */
.tabs-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    gap: 0;
}

.tabs-nav li {
    margin: 0;
}

.tab-link {
    display: block;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--pico-muted-color);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-link:hover {
    color: var(--pico-color);
}

.tab-link.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Flash messages ===== */
.flash-message {
    margin: 0 1.5rem 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

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

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