/* =====================================================
   Database Index Advisor — style.css
   Blue/Amber database dark theme
   ===================================================== */

:root {
    --primary: #3B82F6;
    --accent: #F59E0B;
    --bg: #0F172A;
    --surface: #1E293B;
    --surface2: #293A52;
    --border: rgba(59, 130, 246, 0.18);
    --text: #E2E8F0;
    --text-muted: #4B7CA8;
    --green: #10B981;
    --red: #EF4444;
    --radius: 12px;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 20% 5%, rgba(59, 130, 246, 0.07) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.hidden {
    display: none !important;
}

.glass-card {
    background: rgba(30, 41, 59, 0.78);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 11px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-title {
    font-size: 1rem;
    font-weight: 700;
}

.logo-sub {
    font-size: 0.62rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}

.btn-primary:hover {
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 7px 12px;
    cursor: pointer;
    transition: all var(--transition);
}

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

/* Main */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    position: relative;
    z-index: 1;
    align-items: start;
}

.input-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.results-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Editors */
.editor-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(41, 58, 82, 0.5);
}

.editor-label {
    font-size: 0.78rem;
    font-weight: 600;
}

.editor-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.sql-editor {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    padding: 12px 14px;
    resize: vertical;
    min-height: 180px;
    tab-size: 2;
    width: 100%;
}

.sql-editor::placeholder {
    color: var(--text-muted);
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.stat-num {
    font-size: 1.6rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 3px;
}

/* Placeholder */
.placeholder-card {
    padding: 40px;
    text-align: center;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 14px;
    opacity: 0.5;
}

.placeholder-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.placeholder-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Recommendation cards */
.rec-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeIn 0.25s ease;
}

.rec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(41, 58, 82, 0.4);
}

.rec-title {
    font-size: 0.85rem;
    font-weight: 700;
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
}

.impact-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.impact-high {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.impact-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #FCD34D;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.impact-low {
    background: rgba(59, 130, 246, 0.15);
    color: #93C5FD;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.rec-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rec-info-row {
    display: flex;
    gap: 6px;
    font-size: 0.75rem;
}

.rec-info-label {
    color: var(--text-muted);
    min-width: 80px;
}

.rec-info-val {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
}

.rec-sql {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #93C5FD;
    position: relative;
    overflow-x: auto;
    white-space: pre;
}

.rec-copy {
    position: absolute;
    top: 6px;
    right: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 2px 7px;
    cursor: pointer;
    transition: all var(--transition);
}

.rec-copy:hover {
    color: var(--primary);
}

.reason-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    background: rgba(59, 130, 246, 0.1);
    color: #93C5FD;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.size-estimate {
    color: var(--accent);
}

.no-issues {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: #6EE7B7;
    font-size: 0.9rem;
    font-weight: 600;
}

/* EXPLAIN table */
.explain-card {
    overflow: hidden;
}

.explain-title {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.explain-table-wrap {
    overflow-x: auto;
    padding: 10px;
}

.explain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
}

.explain-table th {
    padding: 7px 10px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.explain-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.06);
}

.explain-table tr:last-child td {
    border-bottom: none;
}

.explain-table tr:hover td {
    background: rgba(59, 130, 246, 0.04);
}

.explain-cell-type {
    color: var(--accent);
    font-weight: 600;
}

.explain-cell-key {
    color: var(--green);
}

.explain-cell-rows {
    color: #F87171;
    font-weight: 600;
}

.explain-cell-extra {
    color: #A78BFA;
}

@media (max-width: 1000px) {
    .main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main {
        padding: 14px;
    }

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