/* Database Amber Theme: 
   Primary: #F39C12 
   Secondary: #E17055 
   Accent: #2ECC71 
   Background: #0D0D0A 
*/

:root {
    --primary: #F39C12;
    --secondary: #E17055;
    --accent: #2ECC71;
    --bg-color: #0D0D0A;
    --panel-bg: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #F2F2F2;
    --text-muted: #8E8E8E;
    --radius: 12px;
    --transition: all 0.25s ease;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --code-bg: rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(243, 156, 18, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(225, 112, 85, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

h1 {
    font-weight: 700;
    font-size: 2.5rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

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

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 600;
}

h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Utilities */
.hidden { display: none !important; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.text-center { text-align: center; }

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

label {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.code-editor {
    background: var(--code-bg);
    border: 1px solid var(--panel-border);
    color: #a9b7c6;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    transition: var(--transition);
    resize: vertical;
    width: 100%;
    min-height: 150px;
}

.code-editor:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.2);
}

.readonly {
    cursor: copy;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
    outline: none;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    width: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.secondary-btn {
    background: var(--panel-bg);
    color: var(--text-main);
    border: 1px solid var(--panel-border);
    width: 100%;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sm-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: rgba(243, 156, 18, 0.15);
    color: var(--primary);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: 6px;
}
.sm-btn:hover {
    background: rgba(243, 156, 18, 0.3);
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
}

/* Results Section */
.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.card.card-warning .value { color: var(--primary); }
.card.card-success .value { color: var(--accent); }

.card .value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0;
}
.card .unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.recs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rec-item {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--panel-border);
    border-left: 3px solid var(--primary);
    padding: 1rem;
    border-radius: 8px;
}

.rec-item.type-covering { border-left-color: var(--accent); }

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.rec-title {
    font-weight: 600;
    color: var(--text-main);
}
.rec-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}
.rec-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.rec-sql {
    margin-top: 0.75rem;
    background: var(--bg-color);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    overflow-x: auto;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Visual Plan */
.visual-plan {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}
@media (max-width: 600px) {
    .visual-plan { flex-direction: column; }
    .plan-arrow { transform: rotate(90deg); }
}

.plan-node {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--panel-border);
    padding: 1rem;
    border-radius: 8px;
    flex: 1;
}
.plan-node.before { border-top: 3px solid var(--secondary); }
.plan-node.after { border-top: 3px solid var(--accent); }
.plan-node h4 { margin-bottom: 0.5rem; font-size: 0.9rem; }
.plan-node .node { font-weight: 500; font-family: monospace; margin-bottom: 0.25rem;}
.plan-node .node-filter { font-size: 0.8rem; color: var(--text-muted); font-family: monospace;}

.tbl-name { color: #a9b7c6; }
.idx-name { color: var(--accent); }

/* Predicate List */
.predicate-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.predicate-list li {
    background: rgba(255,255,255,0.02);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: monospace;
}
.pred-type { color: var(--primary); margin-right: 0.5rem; }

/* Sizing Info */
.sizing-info {
    font-size: 0.875rem;
}
.size-row {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}
.size-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}
.size-bar {
    background: rgba(0,0,0,0.3);
    height: 30px;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 1rem;
    color: var(--text-main);
    z-index: 1;
    overflow: hidden;
    font-family: monospace;
}
.bar-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    z-index: -1;
    border-radius: 4px;
}
.bar-fill.btree { background: rgba(243, 156, 18, 0.4); }
.bar-fill.hash { background: rgba(225, 112, 85, 0.4); }
.bar-fill.gin { background: rgba(46, 204, 113, 0.4); }

.pulse { animation: pulse 2s infinite; }
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    padding: 0.25rem 0.5rem;
    width: auto;
    height: auto;
}

.close-modal:hover {
    color: white;
}
