/* ==========================================================================
   ELITE PLAIN ENGLISH QUERY CSS
   Glassmorphism, NLP UI, Auto-Vis
   ========================================================================== */

/* Layout & Globals */
.aiq-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; position: relative; overflow-x: hidden; }
.aiq-layout { display: flex; gap: 24px; align-items: flex-start; height: calc(100vh - 150px); }
.aiq-main-view { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; height: 100%; padding-right: 8px; scrollbar-width: thin; }
.aiq-main-view::-webkit-scrollbar { width: 6px; }
.aiq-main-view::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.3); border-radius: 3px; }
.aiq-sidebar { width: 320px; flex-shrink: 0; height: 100%; position: sticky; top: 0; }

/* Utilities */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.m-0 { margin: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; } .p-16 { padding: 16px; } .pt-8 { padding-top: 8px; } .pt-16 { padding-top: 16px; } .pb-16 { padding-bottom: 16px; } .border-top { border-top: 1px solid rgba(255,255,255,0.1); } .border-bottom { border-bottom: 1px solid rgba(255,255,255,0.1); }
.text-xs { font-size: 0.75rem; } .text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; }
.uppercase { text-transform: uppercase; } .letter-spacing { letter-spacing: 1px; } .font-bold { font-weight: 700; } .tabular-nums { font-variant-numeric: tabular-nums; }
.flex-between { display: flex; justify-content: space-between; align-items: center; } .flex-align-center { display: flex; align-items: center; } .align-start { align-items: flex-start; } .flex-end { display: flex; justify-content: flex-end; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; }

/* Palette */
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-white { color: #ffffff; }
.bg-purple { background: #c084fc; color: #000; } .bg-cyan { background: #06b6d4; color: #000; } .bg-gold { background: #fbbf24; color: #000; } .bg-green { background: #22c55e; color: #000; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(168,85,247,0.4); } 70% { box-shadow: 0 0 0 20px rgba(168,85,247,0); } 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseGlow 2s infinite; border-radius: 12px; }

/* Cards & Buttons */
.aiq-card { background: rgba(255,255,255,0.03); backdrop-filter: blur(24px) saturate(180%); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05); transition: all 0.4s; }
.aiq-card--glow-cyan { border-color: rgba(6,182,212,0.3); box-shadow: 0 0 30px rgba(6,182,212,0.1); background: rgba(6,182,212,0.05); }

.aiq-btn { padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; border: none; text-transform: uppercase; font-family: inherit; }
.aiq-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.aiq-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.aiq-btn--primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.aiq-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.aiq-btn--secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.aiq-btn-icon { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; }
.aiq-btn-icon:hover { color: white; background: rgba(255,255,255,0.1); }
.aiq-btn-icon-small { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.aiq-btn-icon-small:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }
.aiq-btn-icon-text { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; font-size: 0.85rem; font-weight: 700; padding: 0; }
.aiq-btn-icon-text:hover { color: #fff; }

.aiq-input, .aiq-select { width: 100%; padding: 10px 14px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; font-family: inherit; font-size: 0.85rem; outline: none; }
.aiq-input:focus, .aiq-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.aiq-form-group { margin-bottom: 16px; }
.aiq-form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); font-weight: 600; }

/* Header */
.aiq-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; flex-shrink: 0; }
.aiq-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.aiq-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.aiq-header__actions { display: flex; gap: 16px; align-items: center; }

.aiq-saved-dropdown-wrapper { position: relative; }
.aiq-saved-dropdown { position: absolute; top: 100%; right: 0; width: 300px; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; margin-top: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 100; padding: 16px; animation: popIn 0.2s ease-out; }
.aiq-saved-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.aiq-sv-item { padding: 12px; background: rgba(255,255,255,0.03); border-radius: 8px; cursor: pointer; transition: 0.2s; border: 1px solid transparent; }
.aiq-sv-item:hover { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); }

/* Hero Input */
.aiq-hero-box { background: rgba(168,85,247,0.05); border: 1px solid rgba(168,85,247,0.3); border-radius: 24px; padding: 32px; box-shadow: 0 0 40px rgba(168,85,247,0.1); transition: 0.3s; }
.aiq-hero-box:focus-within { box-shadow: 0 0 60px rgba(168,85,247,0.3); border-color: #c084fc; background: rgba(168,85,247,0.1); }
.aiq-input-wrapper { display: flex; gap: 16px; align-items: center; background: rgba(0,0,0,0.4); border-radius: 16px; padding: 16px 24px; border: 1px solid rgba(255,255,255,0.1); }
.aiq-hero-input { flex-grow: 1; background: transparent; border: none; color: white; font-family: inherit; font-size: 1.5rem; line-height: 1.4; resize: none; outline: none; font-weight: 700; }
.aiq-hero-input::placeholder { color: rgba(255,255,255,0.3); font-weight: 400; transition: opacity 0.5s; }
.aiq-input-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.aiq-ask-btn { background: linear-gradient(135deg, #06b6d4, #a855f7); color: white; border: none; padding: 16px 32px; border-radius: 16px; font-weight: 800; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.3s; font-family: inherit; }
.aiq-ask-btn:hover { transform: scale(1.05); }

/* Suggestions */
.aiq-suggest-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.aiq-suggest-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; padding: 20px; cursor: pointer; transition: 0.3s; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; }
.aiq-suggest-card:hover { transform: translateY(-4px); border-color: rgba(192,132,252,0.4); background: rgba(255,255,255,0.05); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.sc-cat { position: absolute; top: 12px; right: 12px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.sc-ico { font-size: 1.5rem; }
.sc-txt { font-size: 0.95rem; font-weight: 600; line-height: 1.4; color: rgba(255,255,255,0.9); }

/* Results Stage */
.aiq-breakdown-card { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; padding: 24px; }
.aiq-sql-box { background: #000; border-radius: 12px; padding: 16px; border: 1px solid rgba(6,182,212,0.3); }
.aiq-sql-input { width: 100%; background: transparent; border: none; color: #fbbf24; font-family: monospace; font-size: 0.9rem; resize: vertical; min-height: 100px; outline: none; }
.aiq-sql-input:not([readonly]) { background: rgba(255,255,255,0.05); padding: 8px; border-radius: 4px; }

.aiq-insights-list { display: flex; flex-direction: column; gap: 8px; }
.aiq-insight-item { font-size: 0.9rem; color: rgba(255,255,255,0.8); display: flex; gap: 8px; align-items: flex-start; }

/* Viz Tabs */
.aiq-viz-tabs { display: flex; background: rgba(0,0,0,0.4); }
.aiq-v-tab { background: transparent; border: none; color: rgba(255,255,255,0.5); font-weight: 700; cursor: pointer; padding: 16px 24px; transition: 0.3s; text-transform: uppercase; font-size: 0.85rem; border-bottom: 2px solid transparent; }
.aiq-v-tab:hover { color: white; }
.aiq-v-tab.active { color: #a855f7; border-bottom-color: #a855f7; background: rgba(168,85,247,0.1); }
.aiq-v-pane { animation: fadeInUp 0.3s forwards; }

.aiq-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; white-space: nowrap; }
.aiq-table th { text-align: left; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); text-transform: uppercase; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.aiq-table th:hover { color: #c084fc; }
.aiq-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); font-variant-numeric: tabular-nums; }
.aiq-table tr:hover td { background: rgba(255,255,255,0.03); }

.aiq-chart-container { width: 100%; height: 350px; position: relative; }
.aiq-chart-svg { width: 100%; height: 100%; overflow: visible; padding: 20px; }
.chart-axis { stroke: rgba(255,255,255,0.1); stroke-width: 1; }
.chart-bar { fill: #c084fc; opacity: 0.8; transition: 0.3s; cursor: pointer; }
.chart-bar:hover { opacity: 1; fill: #a855f7; }
.chart-lbl { font-size: 0.7rem; fill: rgba(255,255,255,0.5); text-anchor: middle; font-family: 'Inter', sans-serif; }

.aiq-raw-code { background: #000; padding: 16px; border-radius: 8px; color: #22c55e; font-family: monospace; font-size: 0.85rem; overflow-x: auto; max-height: 400px; overflow-y: auto; margin: 0; }

/* History Sidebar */
.aiq-search-small { position: relative; width: 100%; }
.aiq-search-small i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.4); font-size: 0.8rem; }
.aiq-search-small input { width: 100%; padding: 8px 12px 8px 32px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; outline: none; font-size: 0.8rem; }

.aiq-hist-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex-grow: 1; padding-right: 4px; }
.aiq-hist-item { padding: 12px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 8px; cursor: pointer; transition: 0.2s; position: relative; }
.aiq-hist-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(192,132,252,0.3); }
.aiq-hist-item .h-q { font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,0.9); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aiq-hist-item .h-m { font-size: 0.7rem; color: rgba(255,255,255,0.4); display: flex; justify-content: space-between; }
.btn-star-hist { position: absolute; top: 8px; right: 8px; background: transparent; border: none; color: rgba(255,255,255,0.3); cursor: pointer; transition: 0.2s; }
.btn-star-hist:hover { color: #fbbf24; transform: scale(1.2); }
.btn-star-hist.saved { color: #fbbf24; }

/* Modals */
.aiq-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.aiq-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.aiq-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: popIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards; }
.aiq-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: 0.3s; z-index: 10; }
.aiq-modal__close:hover { color: white; }

.aiq-step-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; background: rgba(0,0,0,0.2); padding: 12px; border-radius: 12px; }
.aiq-step-row .num { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.aiq-step-row .txt { font-size: 0.9rem; color: rgba(255,255,255,0.8); line-height: 1.4; }

/* Tooltip */
.aiq-tooltip { position: fixed; background: #140f19; border: 1px solid rgba(192,132,252,0.4); padding: 12px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 2000; pointer-events: none; font-size: 0.8rem; color: white; transform: translate(-50%, -120%); transition: opacity 0.2s; white-space: nowrap; }