/* ── Base ─────────────────────────────────────────────── */

:root {
    --accent: #0d9488;
    --accent-light: #14b8a6;
    --accent-subtle: rgba(13, 148, 136, 0.15);
    --surface: #1e1e2e;
    --surface-raised: #262637;
    --border-color: rgba(255, 255, 255, 0.08);
}

body {
    background: #131320;
    min-height: 100vh;
}

/* ── Navbar ───────────────────────────────────────────── */

.navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.navbar > .container {
    display: flex;
    align-items: center;
    position: relative;
}

.navbar-brand {
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    margin-right: 0;
}

/* ── Stepper ──────────────────────────────────────────── */

.stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.stepper-step {
    display: flex;
    align-items: flex-start;
}

.stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 56px;
}

.stepper-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.stepper-item.upcoming .stepper-circle {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.3);
}

.stepper-item.active .stepper-circle {
    background: var(--accent);
    border: 2px solid var(--accent);
    color: #fff;
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.stepper-item.completed .stepper-circle {
    background: var(--accent-subtle);
    border: 2px solid var(--accent);
    color: var(--accent-light);
}

.stepper-label {
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stepper-item.upcoming .stepper-label {
    color: rgba(255, 255, 255, 0.25);
}

.stepper-item.active .stepper-label {
    color: var(--accent-light);
}

.stepper-item.completed .stepper-label {
    color: rgba(255, 255, 255, 0.5);
}

.stepper-line {
    width: 32px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 11px;
    flex-shrink: 0;
}

.stepper-line.completed {
    background: var(--accent);
}

/* ── Content ──────────────────────────────────────────── */

.content-container {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ── Cards ────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-header h2,
.card-header h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.5rem;
}

/* ── Buttons ──────────────────────────────────────────── */

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-light);
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.btn-success {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 10px;
}

/* ── Forms ────────────────────────────────────────────── */

.form-control,
.form-select {
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    background: var(--surface-raised);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-subtle);
    border-color: var(--accent);
}

/* ── Login ────────────────────────────────────────────── */

.login-page {
    display: flex;
    flex-direction: column;
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: calc(100vh - 58px);
}

.login-container .card {
    width: 100%;
    max-width: 400px;
}

/* ── Consent ──────────────────────────────────────────── */

.consent-text {
    max-height: 320px;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    line-height: 1.6;
}

.consent-text h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    color: var(--accent-light);
}

.consent-text h4:first-child {
    margin-top: 0;
}

/* ── Recording ────────────────────────────────────────── */

.recording-indicator {
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#recordButton.btn-danger {
    animation: pulse 1.2s ease-in-out infinite;
}

#recordingStatus {
    border-radius: 8px;
}

/* ── Prediction ───────────────────────────────────────── */

.prediction-card {
    max-width: 1200px;
    margin: 0 auto;
}

.prediction-section {
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: 100%;
    transition: transform 0.2s ease;
}

.prediction-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.prediction-value {
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
    margin: 1.5rem 0;
}

.threshold-section {
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.stridor-detected {
    color: #ef4444;
}

.no-stridor {
    color: #22c55e;
}

/* ── Alerts ───────────────────────────────────────────── */

.alert {
    border-radius: 8px;
    font-size: 0.92rem;
}

.alert-info {
    background: rgba(13, 148, 136, 0.1);
    border-color: rgba(13, 148, 136, 0.25);
    color: var(--accent-light);
}

/* ── Loading overlay ──────────────────────────────────── */

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.loading-overlay[style*="block"] {
    display: flex !important;
}

.spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 576px) {
    .stepper-item {
        min-width: 40px;
    }

    .stepper-line {
        width: 16px;
        margin-top: 11px;
    }

    .stepper-label {
        font-size: 0.5rem;
    }

    .stepper-circle {
        width: 20px;
        height: 20px;
        font-size: 0.55rem;
    }
}
