/*
 * ACintel — Premium Design System
 * High-end financial intelligence platform styling
 *
 * Color Palette:
 * - Navbar/Chrome: #0f172a  (Deep Navy)
 * - Primary Accent: #2563eb  (Professional Blue)
 * - Background: #f4f6f9      (Warm Light Gray)
 * - Cards: #ffffff            (Pure White)
 * - Text: #0f172a             (Deep Navy)
 */

/* =====================================================
   DESIGN TOKENS
   ===================================================== */
:root {
    /* Navy scale */
    --navy-950:   #060d1a;
    --navy-900:   #0f172a;
    --navy-800:   #1e293b;
    --navy-700:   #334155;

    /* Blue accent scale */
    --blue-700:   #1d4ed8;
    --blue-600:   #2563eb;
    --blue-500:   #3b82f6;
    --blue-100:   #dbeafe;
    --blue-50:    #eff6ff;

    /* Neutral scale */
    --gray-50:    #f8fafc;
    --gray-100:   #f1f5f9;
    --gray-200:   #e2e8f0;
    --gray-300:   #cbd5e1;
    --gray-400:   #94a3b8;
    --gray-500:   #64748b;
    --gray-600:   #475569;
    --gray-700:   #334155;
    --gray-800:   #1e293b;
    --gray-900:   #0f172a;

    /* Semantic tokens */
    --primary-color:    var(--blue-600);
    --primary-dark:     var(--blue-700);
    --primary-light:    var(--blue-500);
    --secondary-color:  var(--gray-600);
    --secondary-light:  var(--gray-500);
    --background-color: #f4f6f9;
    --card-bg:          #ffffff;
    --text-color:       var(--navy-900);
    --text-muted:       var(--gray-500);
    --border-color:     var(--gray-200);

    /* Refined shadows with navy tint */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:    0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.06);
    --shadow-xl: 0 24px 56px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(15, 23, 42, 0.08);

    /* Easing */
    --ease-out:    cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast:   150ms var(--ease-out);
    --transition-normal: 250ms var(--ease-out);
}

/* =====================================================
   BASE
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.015em;
    line-height: 1.25;
}

h1 { font-weight: 800; letter-spacing: -0.03em; }
h2 { font-weight: 700; letter-spacing: -0.02em; }
h3 { font-weight: 700; letter-spacing: -0.015em; }

.text-muted {
    color: var(--text-muted) !important;
}

/* =====================================================
   NAVBAR
   ===================================================== */
.navbar-main {
    background-color: var(--navy-900);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.28);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1875rem;
    letter-spacing: -0.5px;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.navbar-brand .brand-icon {
    color: var(--blue-500);
    font-size: 1.25rem;
}

.navbar-main .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4375rem 0.75rem !important;
    border-radius: 6px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.navbar-main .nav-link:hover,
.navbar-main .nav-link:focus {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.08);
}

.navbar-main .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(59, 130, 246, 0.18);
}

.navbar-main .dropdown-toggle::after {
    opacity: 0.6;
}

/* Dropdown menus — white on dark navbar */
.navbar-main .dropdown-menu {
    background-color: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    min-width: 210px;
    margin-top: 0.5rem;
}

.navbar-main .dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.navbar-main .dropdown-item:hover,
.navbar-main .dropdown-item:focus {
    background-color: var(--gray-100);
    color: var(--gray-900);
}

.navbar-main .dropdown-item i {
    color: var(--gray-400);
    transition: color var(--transition-fast);
    width: 1rem;
    text-align: center;
}

.navbar-main .dropdown-item:hover i {
    color: var(--primary-color);
}

.navbar-main .dropdown-divider {
    border-color: var(--gray-200);
    margin: 0.375rem 0;
}

.navbar-main .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2);
    padding: 0.35rem 0.65rem;
}

.navbar-main .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255%2c255%2c255%2c0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* =====================================================
   PRIMARY COLOR OVERRIDE (for badges, buttons, etc.)
   ===================================================== */
.bg-primary {
    background-color: var(--primary-color) !important;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    background-color: var(--card-bg);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 0.875rem 1.125rem;
}

.card-title {
    margin-bottom: 0;
    color: var(--text-color);
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    font-weight: 500;
    border-radius: 7px;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-outline-secondary {
    color: var(--gray-600);
    border-color: var(--gray-300);
    background-color: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

/* =====================================================
   FORMS
   ===================================================== */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 0.5625rem 0.875rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    color: var(--text-color);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    letter-spacing: 0.01em;
}

.form-text {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* =====================================================
   TABLES
   ===================================================== */
.table {
    --bs-table-bg: var(--card-bg);
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.07em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
    color: var(--gray-800);
}

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.03);
}

.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    font-weight: 600;
    font-size: 0.6875rem;
    padding: 0.3rem 0.625rem;
    border-radius: 5px;
    letter-spacing: 0.03em;
}

/* =====================================================
   DASHBOARD MODULE CARDS
   ===================================================== */
.module-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 12px !important;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    color: inherit;
    text-decoration: none;
}

.module-card .card-body {
    padding: 1.75rem;
}

.module-card .module-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
}

.module-card .module-icon.blue {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.module-card .module-icon.green {
    background-color: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.module-card .module-icon.purple {
    background-color: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.module-card-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =====================================================
   SECTION LABEL (accent-stripe heading)
   ===================================================== */
.section-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.section-label::before {
    content: '';
    display: block;
    width: 3px;
    height: 1.125rem;
    background: var(--primary-color);
    border-radius: 2px;
    flex-shrink: 0;
}

.section-label h4,
.section-label h5 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* =====================================================
   FILTER & RESULTS SECTIONS
   ===================================================== */
.filter-section {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.9);
    margin-bottom: 1.5rem;
}

.filter-section h5 {
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
    color: var(--gray-700);
}

.results-section {
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow: hidden;
}

.results-header {
    background-color: var(--gray-50);
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* =====================================================
   PARTNER ROWS
   ===================================================== */
.partner-row {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.partner-row:hover {
    background-color: rgba(37, 99, 235, 0.04) !important;
}

.partner-row.selected {
    background-color: rgba(37, 99, 235, 0.09) !important;
}

/* =====================================================
   STAT CARDS
   ===================================================== */
.stat-card {
    text-align: center;
    padding: 1.5rem 1.25rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* =====================================================
   CHART CONTAINER
   ===================================================== */
.chart-container {
    min-height: 300px;
    padding: 1rem;
}

/* =====================================================
   HTMX LOADING
   ===================================================== */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    border-top: 1px solid var(--border-color);
    background-color: #ffffff !important;
    padding: 1.125rem 0;
}

.footer .footer-copy {
    font-size: 0.8125rem;
    color: var(--gray-400);
}

.footer .footer-link {
    font-size: 0.8125rem;
    color: var(--gray-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer .footer-link:hover {
    color: var(--gray-700);
}

/* =====================================================
   LANDING PAGE — HERO
   ===================================================== */
.hero-section {
    background: linear-gradient(140deg, #060d1a 0%, #0f172a 45%, #1a3560 100%);
    border-radius: 16px;
    padding: 96px 2rem 80px;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

/* Subtle dot-grid overlay */
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.065) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* Ambient glow */
.hero-section::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -5%;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3125rem 0.9375rem;
    background-color: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    margin-bottom: 1.75rem;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2.25rem, 4.5vw, 3.375rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.035em;
    color: #ffffff;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2.5rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

.btn-hero {
    background-color: #ffffff;
    color: var(--navy-900);
    border: none;
    padding: 0.8125rem 2.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
    text-decoration: none;
}

.btn-hero:hover {
    background-color: var(--blue-50);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}

/* =====================================================
   LANDING PAGE — FEATURES
   ===================================================== */
.features-section {
    padding: 0.5rem 0 1rem;
}

.feature-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.875rem;
    height: 100%;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    margin-bottom: 1.25rem;
}

.feature-icon.blue   { background: rgba(37, 99, 235, 0.1);  color: var(--primary-color); }
.feature-icon.green  { background: rgba(5, 150, 105, 0.1);   color: #059669; }
.feature-icon.purple { background: rgba(124, 58, 237, 0.1);  color: #7c3aed; }

.feature-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.625rem;
    letter-spacing: -0.01em;
}

.feature-text {
    color: var(--gray-500);
    font-size: 0.875rem;
    line-height: 1.7;
    margin: 0;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(140deg, #060d1a 0%, #0f172a 50%, #1a3560 100%);
}

.login-card {
    max-width: 420px;
    width: 100%;
    border-radius: 16px !important;
    box-shadow: var(--shadow-xl) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.login-logo h2 {
    margin-top: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

.login-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

/* =====================================================
   UTILITY
   ===================================================== */
.btn-view-details {
    position: sticky;
    bottom: 1rem;
    z-index: 100;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .filter-section {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .module-card .card-body {
        padding: 1.25rem;
    }

    .hero-section {
        padding: 64px 1.5rem 52px;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.9375rem;
    }
}

/* =====================================================
   PRINT
   ===================================================== */
@media print {
    .navbar, .footer, .filter-section {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    body {
        background-color: white;
    }
}
