/* AquaIntel - Clean, dense layout */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #1a1a2e;
    background: #0f0c29;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    font-size: 14px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---- Header ---- */
.header {
    background: rgba(255,255,255,0.97);
    padding: 0.6rem 0;
    margin-bottom: 1.25rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 1.8rem; }

.logo-text h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.logo-text p {
    font-size: 0.75rem;
    color: #6c757d;
    letter-spacing: 0.3px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 500;
}

.status-indicator.status-healthy { background: #d4edda; color: #155724; }
.status-indicator.status-unhealthy { background: #f8d7da; color: #721c24; }

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-healthy .status-dot { background: #28a745; }
.status-unhealthy .status-dot { background: #dc3545; }

@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

/* ---- Hero / Stats Bar ---- */
.hero {
    text-align: center;
    margin-bottom: 1.25rem;
    color: rgba(255,255,255,0.92);
}

.hero-tagline {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.stats-row-inline {
    font-size: 0.82rem;
    opacity: 0.75;
    letter-spacing: 0.2px;
}

.stat-inline {
    font-weight: 700;
    color: #fff;
}

.stat-sep {
    margin: 0 6px;
    opacity: 0.5;
}

/* ---- Query Section ---- */
.query-section {
    background: rgba(255,255,255,0.97);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.query-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

#queryInput {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
    line-height: 1.45;
}

#queryInput:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79,70,229,0.12);
}

.btn-primary {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 0.65rem 1.3rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) { background: #4338ca; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.sample-questions { margin-top: 0; }

.question-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    background: #f3f4f6;
    color: #374151;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid #e5e7eb;
}

.chip:hover { background: #e5e7eb; }

/* ---- Results ---- */
.results-section {
    background: rgba(255,255,255,0.97);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.results-header {
    margin-bottom: 0.75rem;
}

.results-header h3 {
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: 600;
}

.explanation-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.ai-summary {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #1e293b;
}

.explanation-detail {
    color: #94a3b8;
    margin-top: 0.5rem;
}

.detailed-results h4 {
    color: #1a1a2e;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.result-item:hover { border-color: #c7d2fe; }

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.result-header strong {
    font-size: 0.88rem;
    line-height: 1.35;
}

.result-number {
    background: #4f46e5;
    color: white;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.result-desc {
    font-size: 0.84rem;
    color: #475569;
    line-height: 1.45;
    margin-bottom: 4px;
}

.result-type-badge {
    background: #eef2ff;
    color: #4338ca;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.meta-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    border: 1px solid #e2e8f0;
}

.source-docs {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid #f1f5f9;
}

.source-docs small {
    color: #94a3b8;
    font-size: 0.75rem;
}

.source-link {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px dotted rgba(96,165,250,0.4);
    transition: color 0.15s, border-color 0.15s;
}
.source-link:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}

.no-results {
    text-align: center;
    padding: 1.5rem;
    color: #64748b;
    font-size: 0.88rem;
}

.execution-stats {
    margin-top: 0.75rem;
}

.stats-row {
    font-size: 0.78rem;
    color: #94a3b8;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    color: #991b1b;
    font-size: 0.88rem;
}

/* ---- Dashboard ---- */
.dashboard {
    background: rgba(255,255,255,0.97);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.dashboard h3 {
    color: #1a1a2e;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.dashboard-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.dashboard-card h4 {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.dashboard-card div {
    font-size: 0.8rem;
    color: #334155;
}

.card-ok { color: #16a34a; font-weight: 600; }
.card-err { color: #dc2626; font-weight: 600; }

/* ---- Disclaimer ---- */
.disclaimer {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
}

.disclaimer strong {
    color: rgba(255,255,255,0.85);
}

/* ---- Footer ---- */
.footer {
    background: rgba(255,255,255,0.97);
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 0 0.75rem;
    margin-top: 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1.5rem;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

.footer-section h4 {
    color: #1a1a2e;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.footer-section p {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.5;
}

.footer-section ul { list-style: none; }

.footer-section li {
    color: #64748b;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.footer-bottom {
    border-top: 1px solid #e5e7eb;
    margin-top: 1rem;
    padding-top: 0.65rem;
    text-align: center;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

.footer-bottom p {
    color: #94a3b8;
    font-size: 0.8rem;
}

.footer-bottom a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* ---- Loading Overlay ---- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.loading-content {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.75rem;
}

.loading-subtext {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.35rem;
}

@keyframes spin { 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-content { grid-template-columns: 1fr; gap: 1rem; }
    .query-input-group { flex-direction: column; }
    .header-content { flex-direction: column; gap: 0.5rem; text-align: center; }
    .stats-row-inline { font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .logo-text h1 { font-size: 1.15rem; }
}
