/* ============================================================
   OAE — Emisiones Otoacústicas
   Paleta clínica coherente con el resto de módulos
   ============================================================ */

/* ── Botón OAE en tarjetas de caso ── */
.btn-oae {
    display: inline-block;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    font-family: inherit;
}
.btn-oae:hover {
    background: linear-gradient(135deg, #0c6480 0%, #0e7490 100%);
    transform: translateY(-1px);
}

/* ── Device frame ── */
.oae-device-frame {
    background: #10202e;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: 0 20px 52px rgba(9, 36, 52, 0.45);
}

.oae-device-header {
    background: linear-gradient(135deg, #0a1820 0%, #132433 100%);
    border-bottom: 1px solid #1b3447;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.oae-brand-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.oae-brand {
    color: #e2f0fb;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.oae-model {
    color: #6da8c8;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.oae-status-badge {
    background: #1e3a52;
    color: #7ab8d4;
    border: 1px solid #2a4e68;
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.oae-status-badge.activo {
    background: #0e749022;
    color: #22d3ee;
    border-color: #0891b255;
}

/* ── Mode selector (tipo de emisión: TEOAE / DPOAE) ── */
.oae-mode-bar {
    display: flex;
    gap: 6px;
    padding: 8px 8px 0;
    background: linear-gradient(135deg, #0a1820 0%, #0d1e2e 100%);
    border-bottom: 1px solid #1b3447;
}

.oae-mode-btn {
    flex: 1;
    position: relative;
    padding: 13px 0;
    border: 1px solid #1b3447;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: #0d1f2e;
    color: #8fbdd6;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: all 0.18s;
    text-transform: uppercase;
    font-family: inherit;
}
.oae-mode-btn.activo {
    color: #ffffff;
    background: linear-gradient(180deg, #0891b2 0%, #0e7490 100%);
    border-color: #22d3ee;
    box-shadow: 0 0 0 1px #22d3ee, 0 -3px 14px rgba(34, 211, 238, 0.35);
}
/* Barra de acento sobre la pestaña activa */
.oae-mode-btn.activo::before {
    content: "";
    position: absolute;
    top: 0; left: 12px; right: 12px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: #22d3ee;
}
.oae-mode-btn:hover:not(.activo) {
    color: #cfeaf7;
    background: #123246;
    border-color: #2a4e68;
}

/* ── Workspace ── */
.oae-workspace {
    display: grid;
    grid-template-columns: 220px 1fr;
    background: #10202e;
    min-height: 360px;
}

/* ── Panel de controles (izquierda) ── */
.oae-controls-panel {
    background: #162d40;
    border-right: 2px solid #10202e;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.oae-selector-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.oae-selector-label {
    color: #7ab8d4;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.oae-btn-group {
    display: flex;
    gap: 6px;
}

.oae-ear-btn {
    flex: 1;
    background: #1e3a52;
    color: #8fc5df;
    border: 2px solid #2a4e68;
    border-radius: 8px;
    padding: 9px 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    min-height: 40px;
}
.oae-ear-btn:hover { background: #234a66; }
.oae-ear-btn.oae-ear-od.activo {
    background: #7f1d1d;
    color: #fca5a5;
    border-color: #dc2626;
}
.oae-ear-btn.oae-ear-oi.activo {
    background: #1e3a8a;
    color: #93c5fd;
    border-color: #2563eb;
}

.oae-info-bloque {
    background: #0d1d2a;
    border: 1px solid #1b3447;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.oae-info-fila {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.oae-info-fila span {
    color: #6da8c8;
    font-size: 11px;
}

.oae-info-fila strong {
    color: #c5dff0;
    font-size: 12px;
    text-align: right;
}

.oae-btn-registrar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    font-family: inherit;
    min-height: 52px;
    width: 100%;
}
.oae-btn-registrar small {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.82;
    letter-spacing: 0;
}
.oae-btn-registrar:hover {
    background: linear-gradient(135deg, #0c6480 0%, #0e7490 100%);
}
.oae-btn-registrar:disabled {
    background: #334a5e;
    cursor: not-allowed;
}

.oae-status-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0d1d2a;
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 36px;
}

.oae-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3b5268;
    flex-shrink: 0;
    transition: background 0.2s;
}
.oae-status-dot.grabando {
    background: #22d3ee;
    animation: pulse-oae 0.8s ease-in-out infinite alternate;
}
.oae-status-dot.listo { background: #34d399; }

@keyframes pulse-oae {
    from { opacity: 1; }
    to   { opacity: 0.3; }
}

.oae-status-text {
    color: #7ab8d4;
    font-size: 11px;
    line-height: 1.3;
}

/* ── Panel canvas (derecha) ── */
.oae-main-panel {
    background: #f7fbfe;
    display: flex;
    flex-direction: column;
}

.oae-canvas-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 18px 6px;
    border-bottom: 1px solid #dce9f3;
}

.oae-canvas-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0f3d5e;
    text-transform: uppercase;
}

.oae-canvas-sub {
    font-size: 13px;
    color: #5a8fa8;
    font-weight: 600;
}

#oaeMainCanvas {
    display: block;
    width: 100%;
    height: auto;
    border-bottom: 1px solid #dce9f3;
}

.oae-canvas-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #7ab8d4;
    padding: 5px 18px;
    border-bottom: 1px solid #dce9f3;
}

/* ── Panel TEOAE / DPOAE toggle ── */
#teoaePanel {
    display: flex;
    flex-direction: column;
    flex: 1;
}
#teoaePanel.oculto { display: none; }

#dpGramPanel { display: none; }
#dpGramPanel.activo { display: flex; flex-direction: column; flex: 1; }

/* ── SNR bars (TEOAE) ── */
.oae-snr-section {
    padding: 16px 20px;
    background: #f7fbfe;
    border-top: 1px solid #dce9f3;
}

.oae-snr-section h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0f3d5e;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.oae-snr-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

.oae-snr-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.oae-snr-bar-outer {
    width: 30px;
    height: 88px;
    background: #e8f3fa;
    border: 1px solid #c0d8ea;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.oae-snr-threshold {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 2px dashed #f59e0b;
}

.oae-snr-bar-inner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0891b2;
    border-radius: 3px 3px 0 0;
    transition: height 0.4s ease;
}
.oae-snr-bar-inner.fallo { background: #ef4444; }

.oae-snr-label {
    font-size: 10px;
    color: #2d6a8a;
    font-weight: 700;
    text-align: center;
}

.oae-snr-value {
    font-size: 10px;
    color: #5a8fa8;
    text-align: center;
}

/* ── DP-gram ── */
.oae-dpgram-wrap {
    flex: 1;
    padding: 12px 18px 8px;
    background: #f7fbfe;
    display: flex;
    flex-direction: column;
}

.oae-dpgram-wrap h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0f3d5e;
    text-transform: uppercase;
    margin-bottom: 8px;
}

#dpGramCanvas {
    display: block;
    background: #fff;
    border: 1px solid #dce9f3;
    border-radius: 6px;
    width: 100%;
}

/* ── Tabs de oído (resultados) ── */
.oae-ear-tabs {
    display: flex;
    gap: 8px;
    margin: 24px 0 0;
}

.oae-ear-tab {
    padding: 8px 20px;
    border-radius: 8px 8px 0 0;
    border: 1px solid #c0d8ea;
    border-bottom: none;
    background: #e8f3fa;
    color: #5a8fa8;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.oae-ear-tab.activo.rojo {
    background: #fff0f0;
    color: #b91c1c;
    border-color: #fca5a5;
}
.oae-ear-tab.activo.azul {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}
.oae-ear-tab:hover:not(.activo) {
    background: #dce9f3;
    color: #0f3d5e;
}

/* ── Resultado registrado ── */
.oae-resultado-section {
    background: #fff;
    border: 1px solid #dce9f3;
    border-top: none;
    border-radius: 0 8px 8px 8px;
    padding: 20px 24px;
    margin-bottom: 28px;
}

.oae-resultado-section h2 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0f3d5e;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.oae-resultado-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.oae-ear-result h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #0f3d5e;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #dce9f3;
}

.oae-band-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.oae-band-table th {
    color: #5a8fa8;
    text-align: left;
    padding: 4px 8px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.oae-band-table td {
    padding: 5px 8px;
    color: #1e3a52;
    border-bottom: 1px solid #f0f7fc;
}
.oae-band-table tr:last-child td { border-bottom: none; }

.oae-pass { color: #059669 !important; font-weight: 700; }
.oae-fail { color: #dc2626 !important; font-weight: 700; }

/* ── Interpretación ── */
.oae-interp-section h2 {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 6px;
}

.oae-select {
    width: 100%;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #c0d8ea;
    border-radius: 8px;
    color: #1e3a52;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    margin-top: 8px;
    font-family: inherit;
}
.oae-select:focus { border-color: #0891b2; }

/* ── Página de resultado ── */
.oae-result-header {
    display: flex;
    align-items: center;
    gap: 28px;
    background: #fff;
    border: 1px solid #dce9f3;
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 28px;
    box-shadow: 0 2px 12px rgba(9,36,52,0.06);
}

.oae-score-ring {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 4px solid #c0d8ea;
    background: #f7fbfe;
}
.oae-score-ring.excelente { background: #ecfdf5; border-color: #059669; }
.oae-score-ring.bueno     { background: #f0fdf4; border-color: #16a34a; }
.oae-score-ring.regular   { background: #fffbeb; border-color: #d97706; }
.oae-score-ring.malo      { background: #fff1f2; border-color: #dc2626; }

.oae-score-num {
    font-size: 2rem;
    font-weight: 900;
    color: #0f3d5e;
    line-height: 1;
}
.oae-score-den {
    font-size: 12px;
    color: #5a8fa8;
}

.oae-result-meta h1 {
    font-size: 1.2rem;
    color: #0f3d5e;
    margin-bottom: 6px;
}
.oae-result-meta p {
    font-size: 14px;
    color: #5a8fa8;
}

@media (max-width: 560px) {
    .oae-result-header { flex-direction: column; align-items: flex-start; }
}

.oae-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.oae-result-card {
    background: #fff;
    border: 1px solid #dce9f3;
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(9,36,52,0.04);
}

.oae-result-card h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0f3d5e;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dce9f3;
}

.oae-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.oae-compare-table th {
    color: #5a8fa8;
    text-align: left;
    padding: 4px 8px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
}
.oae-compare-table td {
    padding: 5px 8px;
    color: #1e3a52;
    border-bottom: 1px solid #f0f7fc;
}
.oae-compare-table tr:last-child td { border-bottom: none; }

.ok-oae  { color: #059669; font-weight: 700; }
.err-oae { color: #dc2626; font-weight: 700; }

.oae-diagnostico-box {
    background: #f0f7fc;
    border: 1px solid #c0d8ea;
    border-left: 4px solid #0891b2;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #0f3d5e;
    line-height: 1.5;
    margin-top: 12px;
}

.oae-retro-box {
    background: #f7fbfe;
    border: 1px solid #dce9f3;
    border-radius: 10px;
    padding: 16px 20px;
    font-size: 14px;
    color: #1e3a52;
    line-height: 1.6;
    margin-bottom: 20px;
}

.btn-volver {
    display: inline-block;
    padding: 10px 24px;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}
.btn-volver:hover {
    background: linear-gradient(135deg, #0c6480 0%, #0e7490 100%);
}
