﻿/* ===============================
   🌙 GLOBAL BASE STYLES
   =============================== */
body {
    background-color: #121212;
    color: #f5f5f5;
    font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #121212;
    color: #e4e6eb; /* slightly softer than pure white */
}

h1, h2, h3, .dashboard-title {
    color: #e8eaed; /* softer white, still clean */
}

.card {
    background-color: #18191b !important;
    color: #e4e6eb !important;
}

.dashboard-subtitle,
.metric-header,
.sub-item,
.exec-report {
    color: #b8bcc4 !important;
}

/* ===============================
   🌌 CONTENT AREA
   =============================== */
.content {
    margin-left: 260px;
    padding: 24px;
    transition: margin-left 0.3s ease;
}

    .content.collapsed-content {
        margin-left: 80px;
    }

/* ===============================
   💠 DASHBOARD CARDS & METRICS
   =============================== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    background: #1e1e1e;
    color: #ffffff;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1rem;
    margin: 0.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.metric-card {
    position: relative;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

/* Trend Badge */
.trend-badge {
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #111827;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease-in-out;
}

    .trend-badge:hover {
        background: #3b82f6;
        color: #fff;
        transform: scale(1.05);
    }

/* AI Badge */
.ai-badge {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 1.1rem;
    color: #2563eb;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

    .ai-badge:hover {
        color: #3b82f6;
        transform: scale(1.2);
        text-shadow: 0 0 8px rgba(59, 130, 246, 0.7);
    }

/* ===============================
   🧠 AI INSIGHT PANEL
   =============================== */
.ai-insight-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.ai-insight-panel {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    width: 450px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.insight-text {
    white-space: pre-wrap;
    color: #333;
    font-size: 0.95rem;
}

/* ===============================
   📊 EXECUTIVE REPORT
   =============================== */
.exec-container {
    margin-top: 30px;
    padding: 20px;
}

.exec-report {
    white-space: pre-wrap;
    background: rgba(255,255,255,0.04);
    padding: 20px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid rgba(255,255,255,0.12);
}

.loading-box {
    padding: 40px;
    text-align: center;
    color: #ddd;
}

.error-box {
    padding: 20px;
    background: rgba(255, 60, 60, 0.1);
    border: 1px solid rgba(255, 60, 60, 0.3);
    color: #ff6a6a;
    border-radius: 8px;
}

/* ===============================
   🧩 SIDEBAR CORE
   =============================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: #111315;
    border-right: 1px solid #1b1c20;
    color: #e5e7eb;
    padding: 1.25rem;
    font-family: 'Inter', sans-serif;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow-x: hidden;
    height: 100vh;
}

    .sidebar a, .sidebar button {
        display: flex;
        align-items: center;
        color: #c9cad1;
        text-decoration: none;
        padding: 6px 10px;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

        .sidebar a:hover, .sidebar button:hover {
            color: #60a5fa;
            background-color: rgba(59, 130, 246, 0.08);
        }

        /* Active Link */
        .sidebar a.active {
            color: #60a5fa !important;
            position: relative;
            font-weight: 500;
        }

            .sidebar a.active::before {
                content: '';
                position: absolute;
                left: -10px;
                top: 25%;
                height: 50%;
                width: 3px;
                background-color: #3b82f6;
                border-radius: 3px;
                box-shadow: 0 0 6px #3b82f6;
            }

/* Section Headers */
.menu-section {
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.menu-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.55);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.3s ease;
}

.sidebar.collapsed .menu-header {
    color: transparent;
    justify-content: center;
}

    .sidebar.collapsed .menu-header::before {
        content: attr(data-icon);
        color: #3b82f6;
        font-family: "Bootstrap Icons";
        font-size: 1.2rem;
    }

/* Submenu */
.submenu {
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

    .submenu .nav-link {
        font-size: 0.9rem;
    }

/* ===============================
   🌟 BRAND (LOGO + FX TOGGLE)
   =============================== */
/* === Brand / Logo Toggle === */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
    position: relative;
    height: 64px;
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.2s ease;
}

    .brand:hover {
        background-color: rgba(59, 130, 246, 0.08);
    }

.brand-logo {
    height: 42px;
    width: auto;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: block;
}

.brand-short {
    display: none;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #60a5fa;
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Collapsed behavior */
.sidebar.collapsed .brand-logo {
    opacity: 0;
    transform: scale(0.85);
    visibility: hidden;
    pointer-events: none;
}

.sidebar.collapsed .brand-short {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    visibility: visible;
}


/* ===============================
   🔐 AUTH SECTION
   =============================== */
.auth-links {
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1rem;
}

    .auth-links a,
    .auth-links button {
        color: #9ca3af;
        text-decoration: none;
        display: block;
        padding: 0.4rem 0;
        font-size: 0.95rem;
        background: none;
        border: none;
        transition: color 0.2s ease;
    }

        .auth-links a:hover,
        .auth-links button:hover {
            color: #60a5fa;
        }

.user-info {
    font-size: 0.9rem;
    color: #bbb;
    margin-bottom: 0.5rem;
    text-align: left;
    transition: opacity 0.3s ease, height 0.3s ease;
}

.sidebar.collapsed .user-info {
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* ===============================
   🌙 COLLAPSED STATE
   =============================== */
.sidebar.collapsed {
    width: 72px;
    padding: 1rem 0.5rem;
}

    .sidebar.collapsed a span,
    .sidebar.collapsed button span {
        display: none;
    }

    .sidebar.collapsed a {
        justify-content: center;
    }

    .sidebar.collapsed i {
        margin-right: 0;
        font-size: 1.2rem;
    }

/* ===============================
   ✨ DASHBOARD HEADER STYLES
   =============================== */
.dashboard-header {
    margin-bottom: 2rem;
    padding-left: 0.75rem;
    border-left: 4px solid #2563eb;
}

.dashboard-title {
    font-size: 2.3rem;
    font-weight: 700;
    color: #f9fafb;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
}

.dashboard-subheader {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-subtitle {
    font-size: 1.25rem;
    color: #d1d5db;
    font-weight: 400;
}

.period-pill {
    background: rgba(37,99,235,0.1);
    color: #60a5fa;
    border: 1px solid rgba(37,99,235,0.3);
    border-radius: 9999px;
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
    display: inline-flex;
    align-items: center;
}

    .period-pill i {
        font-size: 0.95rem;
        color: #60a5fa;
    }

/* =============================
   🌟 TOPBAR & USER MENU
   ============================= */
.topbar {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    height: 56px;
    background: #0d0e10;
    border-bottom: 1px solid #1b1c20;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1.5rem;
    z-index: 900;
    transition: left 0.3s ease;
}

.sidebar.collapsed ~ .topbar {
    left: 72px;
}

.user-menu {
    position: relative;
}

.user-avatar {
    color: #e5e7eb;
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

    .user-avatar:hover {
        color: #60a5fa;
    }

.user-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    background: #111315;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    padding: 0.5rem 0;
}

    .user-dropdown .user-email {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        color: #aeb2b8;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: #d1d5db;
    padding: 0.5rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

    .dropdown-item:hover {
        background: rgba(59, 130, 246, 0.08);
        color: #60a5fa;
    }

/* Adjust content spacing for topbar */
.content {
    margin-top: 56px;
}
