/* 1. Foundation: Color Palette and Typography */
:root {
    --primary-color: #005A9C; /* A deep, professional blue */
    --accent-color: #F5A623;  /* A warm, vibrant ochre */
    --background-light: #F8F9FA; /* A very light, warm gray for the main background */
    --text-color: #343A40;      /* A dark gray for body text, easier to read than pure black */
    --heading-color: #212529;   /* A slightly darker gray for headings */
    --border-color: #DEE2E6;    /* A light gray for borders and dividers */
    --card-background: #FFFFFF; /* Pure white for analytic cards to make them pop */
    --shadow-color: rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--background-light);
    font-family: 'Lato', sans-serif;
    color: var(--text-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    color: var(--heading-color);
    font-weight: 700;
}

/* 2. Structure: Layout & Navigation */

/* Main content area with more breathing room */
.main-content {
    padding: 2rem;
}

/* Navigation Bar Styling */
.navbar {
    background-color: var(--card-background) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--primary-color) !important;
}

.navbar .nav-link {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--text-color) !important;
    transition: color 0.2s ease-in-out;
}

.navbar .nav-link:hover {
    color: var(--primary-color) !important;
}

.dropdown-menu {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.dropdown-item {
    font-family: 'Lato', sans-serif;
    transition: background-color 0.2s ease-in-out;
}

.dropdown-item:hover {
    background-color: var(--background-light);
    color: var(--primary-color);
}

/* Footer Styling */
.footer {
    background-color: var(--card-background);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 4px var(--shadow-color);
    padding: 1rem 0;
}

/* 3. Components: Cards, Controls, and Filters */

/* Styling for all analytic cards (chart containers) */
.chart-container {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px; /* Softer, more modern corners */
    box-shadow: 0 4px 12px var(--shadow-color);
    padding: 1.5rem;
    transition: all 0.3s ease-in-out;
}

/* Add a subtle lift effect on hover for interactivity */
.chart-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.07);
}

/* Styling for the sidebar control panels */
.control-panel {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* Cards used on authentication pages (login, signup) */
.auth-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    padding: 2rem;
}

.auth-card .card-title {
    color: var(--primary-color);
}

/* Styling for form inputs and dropdowns */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.15); /* A soft blue glow */
}

/* Styling for primary buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
    background-color: #004a80; /* A darker shade of the primary blue */
    border-color: #004a80;
    transform: translateY(-2px); /* Subtle lift on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 4. Responsive Design */

/* Responsive chart containers */
.responsive-chart {
    width: 100%;
    min-height: 350px;
}

/* Tables: horizontal scroll on small screens */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* Chart containers shrink on mobile */
    .chart-container {
        min-height: 300px !important;
        padding: 0.75rem;
    }

    .responsive-chart {
        min-height: 250px;
    }

    /* Filter forms wrap nicely */
    .row.g-2 > .col-auto {
        flex: 1 1 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Control panels go full-width */
    .control-panel {
        flex: 1 1 100% !important;
    }

    .dashboard-layout {
        flex-direction: column !important;
    }

    /* Navigation buttons stack cleanly */
    nav.d-flex {
        gap: 0.25rem;
    }

    nav.d-flex .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Badge pills readable on mobile */
    .badge {
        font-size: 0.7rem;
    }
}

/* Tablet adjustments */
@media (max-width: 992px) {
    .main-content {
        padding: 1.25rem;
    }

    .chart-container {
        min-height: 350px !important;
    }
}

/* Ensure tables don't overflow on any screen */
.table {
    font-size: 0.9rem;
}

@media (max-width: 576px) {
    .table {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.4rem;
    }

    /* Story text readable on phones */
    .story-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}
