@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #a6c8ff;
    --primary-container: #00539c;
    --on-primary: #00315f;
    --surface: #131313;
    --surface-container: #201f1f;
    --surface-container-high: #2a2a2a;
    --surface-container-lowest: #0e0e0e;
    --on-surface: #e5e2e1;
    --on-surface-variant: #c2c6d3;
    --outline-variant: #424751;
    --accent: #a6c8ff;
    --secondary: #b9c7df;
    --tertiary: #ffb95f;
    --error: #ba1a1a;
}

body {
    background-color: var(--surface);
    color: var(--on-surface);
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-headline {
    font-family: 'Space Grotesk', sans-serif;
}

.glass-overlay {
    background: rgba(53, 53, 52, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.machined-gradient {
    background: linear-gradient(135deg, #a6c8ff 0%, #00539c 100%);
    border: 1px solid rgba(166, 200, 255, 0.3);
}

.oscilloscope-grid {
    background-image: 
        linear-gradient(to right, rgba(66, 71, 81, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(66, 71, 81, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    background-color: #0e0e0e;
}

.glass {
    background: rgba(32, 31, 31, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom layout fixes for sidebar-main integration */
.main-canvas {
    transition: margin-left 0.3s ease;
}

@media (min-width: 768px) {
    .main-canvas {
        margin-left: 16rem; /* matches w-64 */
    }
}

/* Modal styling refinement */
.modal-overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

/* Chart container styling */
#chart-container {
    background: var(--surface-container-low);
    border: 1px solid rgba(66, 71, 81, 0.2);
    border-radius: 12px;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(166, 200, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

/* --- Industrial Gauges --- */
#rms-gauge-fill {
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-linecap: round;
}

.oscilloscope-grid.active {
    border-color: var(--md-sys-color-primary) !important;
    background: rgba(166, 200, 255, 0.1) !important;
}

/* --- Settings Modal --- */
#settings-modal:not(.hidden) {
    display: flex;
}

#settings-modal .machined-gradient {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

/* --- Animations --- */
@keyframes pulse-primary {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.animate-pulse-slow {
    animation: pulse-primary 3s infinite;
}

/* --- Mobile Decimation indicator --- */
.decimation-badge {
    padding: 2px 6px;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
}

/* Phase 3 Diagnostics & Reporting */
#report-paper {
    background: #201f1f; /* Surface Container */
    color: #e5e2e1;
    font-family: 'Inter', sans-serif;
}

#report-paper h1, #report-paper h2, #report-paper h3, #report-paper h4 {
    font-family: 'Space Grotesk', sans-serif;
}

.fault-tree-line {
    position: absolute;
    background: rgba(140, 145, 156, 0.2); /* Outline */
}

.peak-highlight {
    color: #a6c8ff;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(166, 200, 255, 0.3);
}

/* Animations */
@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out forwards;
}

/* Custom Scrollbar for peak table */
.peak-table-container::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.peak-table-container::-webkit-scrollbar-thumb {
    background: rgba(166, 200, 255, 0.2);
    border-radius: 2px;
}

.spinner {
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Premium Overhaul --- */
.vibe-card {
    background: linear-gradient(180deg, rgba(32, 31, 31, 0.8) 0%, rgba(20, 19, 19, 0.9) 100%);
    border: 1px solid rgba(166, 200, 255, 0.1);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vibe-card:hover {
    border-color: rgba(166, 200, 255, 0.3);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
    transform: translateY(-4px);
}

.vibe-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.3;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.status-glow {
    box-shadow: 0 0 15px currentColor;
}

.neon-border {
    border: 1px solid var(--primary);
    box-shadow: inset 0 0 10px rgba(166, 200, 255, 0.1), 0 0 10px rgba(166, 200, 255, 0.1);
}

/* Specific KPI Colors */
.kpi-rms { border-top: 3px solid var(--primary); }
.kpi-p2p { border-top: 3px solid var(--tertiary); }
.kpi-cf { border-top: 3px solid var(--secondary); }
.kpi-kurt { border-top: 3px solid var(--error); }

/* Chart Styling */
.js-plotly-plot .plotly .modebar {
    background-color: transparent !important;
}

.oscilloscope-grid {
    background-image: 
        radial-gradient(circle, rgba(166, 200, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Specific adjustment for mobile landing */
@media (max-width: 640px) {
    #landing-view {
        padding: 1.5rem;
    }
    #landing-view .flex-col {
        gap: 2rem;
    }
    #dropzone {
        height: auto;
        min-height: 280px;
        padding: 2rem 1rem;
    }
    #page-title {
        max-width: 120px;
        font-size: 1.125rem;
    }
}

.hidden { display: none !important; }

/* --- FFT-Only Mode Suppression --- */
.ui-disabled {
    opacity: 0.4 !important;
    filter: grayscale(1) !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* FAQ Accordion Styles */
.faq-details {
    border-bottom: 1px solid rgba(66, 71, 81, 0.1);
}
.faq-details:last-child {
    border-bottom: 0;
}

.faq-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1rem;
    cursor: pointer;
    list-style: none;
    transition: background-color 0.2s ease;
    border-radius: 0.75rem;
    outline: none;
}

.faq-summary:hover {
    background-color: rgba(28, 27, 27, 0.5);
}

.faq-summary::-webkit-details-marker {
    display: none;
}

.faq-indicator {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a6c8ff; /* primary */
    transition: transform 0.3s ease;
}

details[open] .faq-indicator {
    transform: rotate(180deg);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

details[open] .faq-content {
    animation: slideDown 0.3s ease-out forwards;
}
