/* =========================================
   ✅ AVALON THEME — Powered by Jacob AI
   Premium Light + Dark Mode System
========================================= */

/* ---------- Root Theme Colors ---------- */
:root {
    --avalon-primary: #0F172A;     /* Midnight Blue */
    --avalon-secondary: #CBD5E1;   /* Slate Gray */
    --avalon-accent: #3F3F46;      /* Graphite Button Gray */
    --avalon-accent-hover: #27272A;
    --avalon-text: #0F172A;
    --avalon-bg: #F8FAFC;
    --avalon-card: #FFFFFF;
    --avalon-border: #CBD5E1;
}

/* ---------- Dark Mode Overrides ---------- */
body[data-theme="dark"] {
    --avalon-text: #E5E7EB;
    --avalon-bg: #020617;
    --avalon-card: #020617;
    --avalon-border: #1E293B;
}

/* ---------- Global ---------- */
body {
    background: var(--avalon-bg);
    color: var(--avalon-text);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
}

a {
    color: #2563EB;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Navbar & Footer ---------- */
.navbar,
footer {
    background: #020617 !important;
    color: #F8FAFC;
    border-bottom: 1px solid #1E293B;
}

.navbar a,
footer a {
    color: #F8FAFC;
}

/* ---------- Cards / Panels ---------- */
.card,
.panel,
.result-panel {
    background: var(--avalon-card);
    border-radius: 12px;
    border: 1px solid var(--avalon-border);
    padding: 20px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s ease;
}

.card:hover,
.panel:hover {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

/* =========================================
   ✅ PREMIUM GRAPHITE BUTTON SYSTEM
========================================= */

button,
.btn {
    background: #3F3F46;
    color: #F8FAFC;
    border: 1px solid #64748B;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

button:hover,
.btn:hover {
    background: #27272A;
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

button:active,
.btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dark mode button contrast fix */
body[data-theme="dark"] button,
body[data-theme="dark"] .btn {
    background: #52525B;
    border-color: #71717A;
}

/* ---------- Inputs ---------- */
input,
textarea,
select {
    background: var(--avalon-card);
    border: 1px solid var(--avalon-border);
    color: var(--avalon-text);
    border-radius: 8px;
    padding: 10px 14px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2563EB;
}

/* ---------- Table Styling (base) ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--avalon-card);
    border-radius: 12px;
    overflow: hidden;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--avalon-border);
}

th {
    background: rgba(100, 116, 139, 0.08);
    text-align: left;
}

tr:hover td {
    background: rgba(100, 116, 139, 0.06);
}

/* ---------- SQL Panel ---------- */
.sql-output {
    background: #020617;
    color: #E5E7EB;
    padding: 16px;
    border-radius: 10px;
    font-family: monospace;
    border: 1px solid #1E293B;
}

/* ---------- Jacob Response Panel ---------- */
.jacob-response {
    border-left: 4px solid #2563EB;
    padding-left: 16px;
}

/* ---------- Global Dark Mode Table Overrides ---------- */

body[data-theme="dark"] table {
    background: #020617;
}

body[data-theme="dark"] th {
    background: #020617;
}

body[data-theme="dark"] tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

/* ---------- Logo ---------- */
.navbar-brand img {
    height: 42px;
    width: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #64748B;
    margin-right: 10px;
}

/* ---------- Dark Mode Toggle Button ---------- */
.dark-toggle {
    background: transparent;
    border: 1px solid #64748B;
    color: #F8FAFC;
    border-radius: 8px;
    padding: 6px 12px;
}

.dark-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ===== NAVBAR BRAND FIX ===== */

.navbar-brand {
    color: #38BDF8 !important;   /* Electric Aqua */
    font-weight: 700;
    letter-spacing: 0.5px;
}

.navbar-brand:hover {
    color: #7DD3FC !important;
}

/* ===== NAVBAR MENU ITEM VISIBILITY ===== */

.navbar-nav .nav-link {
    color: #E5E7EB !important;  /* Light slate gray */
    font-weight: 500;
}

.navbar-nav .nav-link:hover {
    color: #38BDF8 !important;  /* Electric Aqua on hover */
}

.navbar-toggler {
    border-color: #CBD5E1;
}

.navbar-toggler-icon {
    filter: invert(1);
}

/* ===== NAVBAR BRAND (AVALON + JACOB AI) ===== */

.navbar-brand {
    font-weight: 800;
    letter-spacing: 0.6px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

/* AVALON TEXT – Dark Israeli Flag Blue */
.navbar-brand .avalon-text {
    color: #0038B8 !important;
    font-size: 1.05rem;   /* Smaller Avalon */
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* POWERED BY JACOB AI – Smaller + Subtle */
.navbar-brand .jacob-text {
    color: #94A3B8 !important;
    font-size: 0.6rem;   /* Smaller subtitle */
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Nav links */
.navbar-nav .nav-link {
    color: #E5E7EB !important;
    font-weight: 500;
}

.navbar-nav .nav-link:hover {
    color: #38BDF8 !important;
}

/* Shared styling for Generated SQL, Explanation, History panels */
.jacob-panel {
    background-color: #ffffff;
    color: #0F172A;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

/* If it's a textarea, remove resize grip and make it behave nicely */
textarea.jacob-panel {
    resize: vertical;
}

/* ============================
   DASHBOARD & TABLE DARK MODE TUNING
   ============================ */

/* Cards on the dashboard (metrics, recent activity, errors) */
body[data-theme="dark"] .card {
    background-color: #020617;      /* near-black slate */
    color: #e5e7eb;                 /* light text */
    border-color: #1f2937;
}

body[data-theme="dark"] .card .card-title {
    color: #e5e7eb;
}

body[data-theme="dark"] .card p,
body[data-theme="dark"] .card .display-6 {
    color: #e5e7eb;
}

/* ✅ ALL Bootstrap tables in dark mode (Dashboard + anywhere else) */
body[data-theme="dark"] .table {
    background-color: #020617;
    color: #e5e7eb;
    border-color: #1f2937;
}

/* Header cells */
body[data-theme="dark"] .table th,
body[data-theme="dark"] .table thead th {
    background-color: #0f172a;      /* midnight blue header */
    color: #e5e7eb;
    border-bottom-color: #1f2937;
}

/* ✅ Force EVERY cell to be dark (fixes “every other row” issue) */
body[data-theme="dark"] .table tbody tr td,
body[data-theme="dark"] .table tbody tr th {
    background-color: #020617;
    color: #e5e7eb;
}

/* Override Bootstrap's striped rows for dark mode */
body[data-theme="dark"] .table.table-striped > tbody > tr:nth-of-type(odd) td,
body[data-theme="dark"] .table.table-striped > tbody > tr:nth-of-type(even) td {
    background-color: #020617;
}

/* Row borders */
body[data-theme="dark"] .table td,
body[data-theme="dark"] .table th {
    border-color: #1f2937;
}

/* Muted text inside dashboard tables (e.g., metadata) */
body[data-theme="dark"] .text-muted {
    color: #9ca3af !important;
}

/* Status badges look better in dark mode */
body[data-theme="dark"] .badge.bg-success {
    background-color: #16a34a !important;
}

body[data-theme="dark"] .badge.bg-danger {
    background-color: #dc2626 !important;
}
