/* NMR Simulator - Visualization Specific Styles */

/* 3D Canvas Container Animations */
#spectrometer3D,
#blochSphere3D {
    position: relative;
    overflow: hidden;
}

#spectrometer3D::before,
#blochSphere3D::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(15, 23, 42, 0.3) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Canvas Loading State */
.canvas-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    z-index: 10;
}

.canvas-loading .loader {
    width: 50px;
    height: 50px;
    border-width: 3px;
}

.canvas-loading-text {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* FID and Spectrum Charts */
#fidCanvas,
#spectrumCanvas {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
}

/* Grid Lines Overlay */
.chart-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(71, 85, 105, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(71, 85, 105, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Axis Labels */
.axis-label {
    position: absolute;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
}

.axis-label.x-axis {
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
}

.axis-label.y-axis {
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: left center;
}

/* Spectrum Specific */
.spectrum-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.ppm-scale {
    position: absolute;
    bottom: 2.5rem;
    left: 3rem;
    right: 1rem;
    height: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.ppm-tick {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Chemical Shift Labels */
.shift-label {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
}

.shift-value {
    font-size: 0.7rem;
    color: var(--primary-light);
    font-weight: 600;
    white-space: nowrap;
}

.shift-assignment {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Bloch Sphere Specific */
.bloch-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;
    font-size: 0.8rem;
}

.bloch-info-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.bloch-info-row:last-child {
    margin-bottom: 0;
}

.bloch-info-label {
    color: var(--text-secondary);
}

.bloch-info-value {
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 500;
}

/* Magnetization Vector Animation */
@keyframes magnetizationPrecession {
    from {
        transform: rotateZ(0deg);
    }

    to {
        transform: rotateZ(360deg);
    }
}

.precessing {
    animation: magnetizationPrecession 2s linear infinite;
}

/* FID Signal Animation */
@keyframes fidDecay {
    0% {
        opacity: 1;
        stroke-dashoffset: 1000;
    }

    100% {
        opacity: 0.3;
        stroke-dashoffset: 0;
    }
}

/* Pulse Sequence Diagram */
.pulse-diagram-svg {
    width: 100%;
    height: 100%;
}

.pulse-line {
    stroke: var(--text-muted);
    stroke-width: 1;
    fill: none;
}

.pulse-rect {
    fill: var(--primary-color);
    stroke: var(--primary-light);
    stroke-width: 1;
}

.pulse-rect.inversion {
    fill: var(--secondary-color);
}

.pulse-acquistion {
    fill: var(--success);
    opacity: 0.7;
}

.pulse-delay-line {
    stroke: var(--text-muted);
    stroke-width: 1;
    stroke-dasharray: 4, 4;
}

.pulse-label {
    font-size: 10px;
    fill: var(--text-secondary);
    text-anchor: middle;
}

/* Spectrometer 3D Interaction */
.spectrometer-controls-3d {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.view-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Zoom Controls */
.zoom-controls-viz {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.25rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.zoom-btn:hover {
    background: var(--surface-lighter);
    color: var(--text-primary);
}

/* Signal Quality Indicator */
.signal-quality {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.signal-bar {
    width: 4px;
    background: var(--surface-lighter);
    border-radius: 1px;
}

.signal-bar.active {
    background: var(--success);
}

.signal-bar:nth-child(1) {
    height: 4px;
}

.signal-bar:nth-child(2) {
    height: 7px;
}

.signal-bar:nth-child(3) {
    height: 10px;
}

.signal-bar:nth-child(4) {
    height: 13px;
}

.signal-bar:nth-child(5) {
    height: 16px;
}

.signal-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Crosshair Cursor for Charts */
.chart-crosshair {
    position: absolute;
    pointer-events: none;
    z-index: 5;
}

.crosshair-x {
    position: absolute;
    width: 1px;
    height: 100%;
    background: rgba(99, 102, 241, 0.5);
}

.crosshair-y {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(99, 102, 241, 0.5);
}

.crosshair-label {
    position: absolute;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: nowrap;
}

/* Peak Highlight */
.peak-highlight {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--warning);
    border: 2px solid var(--background);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--warning);
    cursor: pointer;
    z-index: 5;
    transition: transform 0.15s ease;
}

.peak-highlight:hover {
    transform: translate(-50%, -50%) scale(1.5);
}

/* Running Animation Overlay */
.running-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.running-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--surface-lighter);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.running-text {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.running-progress {
    width: 200px;
    height: 4px;
    background: var(--surface-lighter);
    border-radius: 2px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.running-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

/* Comparison View */
.comparison-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    gap: 1px;
    background: var(--border-color);
}

.comparison-panel {
    background: var(--background);
    position: relative;
}

.comparison-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(30, 41, 59, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    z-index: 5;
}

/* Integration Display */
.integration-area {
    fill: rgba(99, 102, 241, 0.2);
    stroke: var(--primary-color);
    stroke-width: 1;
}

.integration-label {
    font-size: 0.7rem;
    fill: var(--primary-light);
    text-anchor: middle;
}

/* Phase Wheel */
.phase-wheel {
    position: relative;
    width: 60px;
    height: 60px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--surface-light);
}

.phase-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 50%;
    background: var(--primary-color);
    transform-origin: bottom center;
    transform: translateX(-50%);
    border-radius: 1px;
}

.phase-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--text-primary);
}

/* =====================================================
   MOLECULE VISUALIZATION
   ===================================================== */

.molecule-canvas {
    width: 100%;
    height: calc(100% - 60px);
    background: linear-gradient(180deg, #111827 0%, #0a0f1a 100%);
    border-radius: 0.5rem;
}

.molecule-legend {
    position: absolute;
    bottom: 8px;
    right: 12px;
    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;
    max-width: 200px;
}

.molecule-legend-header {
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.molecule-legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.atom-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
}

.atom-badge.atom-h {
    background: #e0e0e0;
    color: #1e293b;
}

.atom-badge.atom-c {
    background: #404040;
    color: #f1f5f9;
}

.atom-badge.atom-n {
    background: #4a9eff;
    color: #f1f5f9;
}

.atom-badge.atom-o {
    background: #ff4444;
    color: #f1f5f9;
}

.atom-badge.atom-f {
    background: #10b981;
    color: #f1f5f9;
}

.atom-badge.atom-cl {
    background: #84cc16;
    color: #1e293b;
}

.atom-badge.atom-s {
    background: #fbbf24;
    color: #1e293b;
}

.atom-badge.atom-p {
    background: #fb923c;
    color: #f1f5f9;
}

/* Qubit indicator */
.qubit-badge {
    position: relative;
}

.qubit-badge::after {
    content: '';
    position: absolute;
    inset: -3px;
    border: 2px solid #fbbf24;
    border-radius: 50%;
}

/* Spectrometer Legend */
.spectrometer-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.magnet-n {
    background: linear-gradient(135deg, #ff3366, #cc2255);
}

.legend-color.magnet-s {
    background: linear-gradient(135deg, #3366ff, #2244cc);
}

.legend-color.coil {
    background: linear-gradient(135deg, #dd8844, #bb6622);
}

.legend-color.sample {
    background: linear-gradient(135deg, #4488ff, #2266cc);
}

.legend-color.field-lines {
    background: linear-gradient(135deg, #44ff88, #22cc66);
}

/* Toggle row for checkboxes */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface-lighter);
    border-radius: 11px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked+.toggle-slider {
    background: var(--primary-color);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

/* Solvent info */
.solvent-info {
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(71, 85, 105, 0.2);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Pulse sequence diagram container */
.pulse-diagram {
    margin-top: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    min-height: 100px;
}

.pulse-sequence-name {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Spectrum info bar */
.spectrum-info {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 0.375rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}