/* NMR Simulator - Main Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary colors - Qubibyte theme */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;

    /* Background colors */
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --surface-lighter: #475569;

    /* Text colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Border colors */
    --border-color: #475569;
    --border-light: #64748b;

    /* Status colors */
    --success: #10b981;
    --success-light: #34d399;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;

    /* NMR-specific colors */
    --magnet-n: #ef4444;
    --magnet-s: #3b82f6;
    --coil-color: #f59e0b;
    --sample-color: #10b981;
    --field-color: #8b5cf6;

    /* Shadow */
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --glow-primary: rgba(99, 102, 241, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--surface) 0%, #1a2744 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px var(--shadow);
    position: relative;
    z-index: 100;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--info));
}

.title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 36px;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.title {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-light);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 10px var(--glow-primary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    box-shadow: 0 4px 20px var(--glow-primary);
}

.btn-secondary {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--surface-lighter);
    border-color: var(--primary-color);
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-lighter) var(--surface);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--surface);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--surface-lighter);
    border-radius: 3px;
}

.sidebar:last-child {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-icon {
    font-size: 1.1rem;
}

/* Control Groups */
.control-group {
    margin-bottom: 1rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-light);
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px var(--shadow);
    transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px var(--shadow);
}

.slider-value {
    min-width: 65px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-light);
    font-family: 'Consolas', 'Monaco', monospace;
}

.info-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-style: italic;
}

.select-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-control:hover {
    border-color: var(--primary-color);
}

.select-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--glow-primary);
}

.select-control option {
    background: var(--surface);
    color: var(--text-primary);
}

/* Sample Info Panel */
.sample-info {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.info-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 0.25rem 0;
}

.info-row span:first-child {
    color: var(--text-secondary);
}

.info-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Results Panel */
.results-panel {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item span:first-child {
    color: var(--text-secondary);
}

.result-item span:last-child {
    color: var(--success);
    font-weight: 600;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Main Visualization Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background);
    overflow: hidden;
}

.visualization-tabs {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.viz-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.viz-tab:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.viz-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.visualization-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.viz-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
}

.viz-panel.active {
    display: flex;
}

.canvas-3d {
    flex: 1;
    background: radial-gradient(ellipse at center, #1a2744 0%, var(--background) 100%);
}

/* Spectrometer Legend */
.spectrometer-legend {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.magnet-n {
    background: var(--magnet-n);
}

.legend-color.magnet-s {
    background: var(--magnet-s);
}

.legend-color.coil {
    background: var(--coil-color);
}

.legend-color.sample {
    background: var(--sample-color);
}

.legend-color.field-lines {
    background: var(--field-color);
}

/* FID Controls */
.fid-controls {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.acquisition-params {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.acquisition-params label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-small {
    width: 70px;
    padding: 0.375rem 0.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.select-small {
    padding: 0.375rem 0.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* Spectrum Info */
.spectrum-info {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.peak-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Bloch Controls */
.bloch-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.75rem;
}

/* Pulse Diagram */
.pulse-diagram {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.75rem;
    min-height: 80px;
    position: relative;
}

/* Canvas Styles */
canvas {
    width: 100%;
    height: 100%;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

.large-modal {
    max-width: 700px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Tutorial Content */
.tutorial-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tutorial-step {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.tutorial-step h4 {
    color: var(--primary-light);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.tutorial-step p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.tutorial-step p:last-child {
    margin-bottom: 0;
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar:last-child {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .header-controls {
        width: 100%;
        justify-content: center;
    }
}