/* Anesthesiology Page Specific Styles */

:root {
    --primary-bg: #ffffff;
    --secondary-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #1a202c;
    --text-secondary: #718096;
    --primary-accent: #3182ce;
    --primary-accent-hover: #2c5282;
    --success-color: #38a169;
    --warning-color: #d69e2e;
    --error-color: #e53e3e;
    --error-bg: #fed7d7;

    --font-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Scope styles to this page to avoid clashing with site-wide CSS */
.anesth-page, .anesth-page * {
    box-sizing: border-box;
}

.anesth-page {
    font-family: var(--font-sans-serif);
    background-color: var(--secondary-bg);
    color: var(--text-color);
    line-height: 1.6;
}

.anesth-page .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 768px) {
    .anesth-page .container {
        padding: 2rem;
    }
}

.anesth-page .page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, var(--primary-accent) 0%, #4299e1 100%);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.anesth-page .page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .anesth-page .page-header h1 {
        font-size: 2rem;
    }
}

.anesth-page .page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.anesth-page .visualization-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1200px) {
    .anesth-page .visualization-grid {
        grid-template-columns: 2fr 1fr;
        gap: 2.5rem;
    }
}

.anesth-page .main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.anesth-page .sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.anesth-page .card {
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.anesth-page .card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.anesth-page .card-header {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-accent);
    padding-bottom: 0.75rem;
    position: relative;
}

.anesth-page .card-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-accent), transparent);
}

/* EEG Visualization */
.anesth-page #eeg-visualization {
    width: 100%;
    min-height: 500px;
    background: var(--primary-bg);
    border-radius: 8px;
    position: relative;
}

.anesth-page #eeg-visualization svg {
    width: 100%;
    height: auto;
    background: var(--primary-bg);
    border-radius: 8px;
}

.anesth-page #eeg-visualization .axis path,
.anesth-page #eeg-visualization .axis line {
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.anesth-page #eeg-visualization .axis text {
    font-size: 12px;
    fill: var(--text-secondary);
    font-family: var(--font-sans-serif);
}

.anesth-page #eeg-visualization .grid .tick {
    stroke: var(--border-color);
    stroke-opacity: 0.7;
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.anesth-page #eeg-visualization .grid path {
    stroke-width: 0;
}

.anesth-page #eeg-visualization .channel1-line {
    fill: none;
    stroke: var(--primary-accent);
    stroke-width: 2px;
    filter: drop-shadow(0 1px 2px rgba(49, 130, 206, 0.1));
}

.anesth-page #eeg-visualization .channel2-line {
    fill: none;
    stroke: var(--error-color);
    stroke-width: 2px;
    filter: drop-shadow(0 1px 2px rgba(229, 62, 62, 0.1));
}

.anesth-page #eeg-visualization .legend {
    font-size: 13px;
    font-family: var(--font-sans-serif);
}

.anesth-page #eeg-visualization .legend rect {
    stroke-width: 1px;
    stroke: var(--border-color);
}

.anesth-page #eeg-visualization .time-window-indicator {
    font-size: 13px;
    fill: var(--text-secondary);
    font-family: var(--font-sans-serif);
}

.anesth-page .loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Navigation Controls */
.anesth-page #eeg-navigation {
    text-align: center;
    padding: 1.5rem;
    background: var(--secondary-bg);
    border-radius: 8px;
    margin-top: 1rem;
}

.anesth-page .nav-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-accent), var(--primary-accent-hover));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    margin: 0 0.25rem;
}

.anesth-page .nav-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.anesth-page .nav-button:active {
    transform: translateY(0);
}

.anesth-page #time-slider {
    width: 100%;
    margin: 1rem 0;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    outline: none;
}

.anesth-page #time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-accent);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.anesth-page #time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-accent);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.anesth-page .interaction-info {
    font-style: italic;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 1rem;
    padding: 1rem;
    background: #ebf8ff;
    border-radius: 6px;
    border-left: 4px solid var(--primary-accent);
}

/* Band Powers */
.anesth-page #band-powers {
    padding: 0;
}

.anesth-page .band-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.anesth-page .band-div {
    text-align: center;
    background: var(--primary-bg);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.anesth-page .band-div:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.anesth-page .band-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.anesth-page .band-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.anesth-page .band-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.anesth-page .band-range {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.anesth-page .bar-container {
    width: 100%;
    height: 120px;
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--secondary-bg);
    overflow: hidden;
    margin: 1rem 0;
}

.anesth-page .power-bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    transition: height 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 0 0 6px 6px;
}

.anesth-page .percent-label {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    font-size: 14px;
    font-weight: 700;
    z-index: 2;
}

/* Spectrogram */
.anesth-page #spectrogram-container {
    position: relative;
    min-height: 250px;
}

.anesth-page #spectrogram-canvas {
    width: 100%;
    height: 250px;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.anesth-page .spectrogram-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: var(--text-secondary);
    font-style: italic;
}

/* New spectrogram specific styles */
.anesth-page .spectrogram-header {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
}

.anesth-page .spectrogram-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.anesth-page .freq-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 250px;
    font-size: 12px;
    color: var(--text-secondary);
    padding-right: 8px;
    text-align: right;
}

.anesth-page .freq-label {
    padding-right: 6px;
}

.anesth-page .spectrogram-footer {
    margin-top: 12px;
    text-align: center;
}

.anesth-page .power-label {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.anesth-page .time-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
}

/* Info Box */
.anesth-page .info-box {
    font-size: 0.9rem;
    color: var(--text-color);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: linear-gradient(135deg, #ebf8ff 0%, #f7fafc 100%);
    border-left: 4px solid var(--primary-accent);
}

.anesth-page .info-box strong {
    color: var(--primary-accent);
    display: block;
    margin-bottom: 0.5rem;
}

.anesth-page .info-box ul {
    padding-left: 1.5rem;
    margin: 0.5rem 0 0 0;
}

.anesth-page .info-box li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* Error Message */
.anesth-page .error-message {
    color: var(--error-color);
    background-color: var(--error-bg);
    border: 1px solid var(--error-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin: 1rem 0;
}

/* Spectral analysis errors (non-destructive, appended inside spectrogram container) */
.anesth-page .spectral-error {
    margin-top: 12px;
    padding: 12px;
    background: var(--error-bg);
    color: var(--error-color);
    border: 1px solid rgba(229, 62, 62, 0.1);
    border-radius: 6px;
    font-size: 13px;
}

.anesth-page .spectral-error .spectral-error-help {
    display: block;
    margin-top: 8px;
    color: #6b7280;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .anesth-page .container {
        padding: 1rem;
    }
    
    .anesth-page .visualization-grid {
        gap: 1.5rem;
    }
    
    .anesth-page .card {
        padding: 1.5rem;
    }
    
    .anesth-page .band-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .anesth-page .nav-button {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        margin: 0.25rem;
    }
}
