/* =============================================================
   Calculadora de Transformadores de Salida (OT)
   Estilos Dark Premium - Compatible Avada WP
   ============================================================= */
* {
    box-sizing: border-box;
}

:root {
    --bg-color: #121214;
    --panel-bg: #1c1c1e;
    --border-color: #2c2c2e;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --accent-blue: #0a84ff;
    --accent-blue-hover: #0070e0;
    --color-green: #30d158;
    --color-orange: #ff9f0a;
    --accent-orange: #ff9f0a;
    --color-red: #ff453a;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.dark-theme {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

/* Contenedor principal */
.ot-calculator-container.wrapper {
    max-width: 850px;
    width: 100%;
    margin: 0 auto !important;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-dark {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 10px;
}

.app-header h1 {
    font-size: 26px;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #fff, #a0a0aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.3;
}

.seo-desc {
    color: var(--text-secondary) !important;
    font-size: 14px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    width: 100% !important;
    max-width: 650px !important;
    text-align: center !important;
    line-height: 1.5 !important;
}

/* Panel de Controles */
.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.input-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selects */
.ot-calculator-container select {
    width: 100% !important;
    padding: 12px !important;
    background: #2c2c2e !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: white !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    cursor: pointer !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    box-shadow: none !important;
    height: 48px !important;
    min-height: 48px !important;
}

.ot-calculator-container select:focus {
    outline: none !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2) !important;
}

.ot-calculator-container select option {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
}

/* Inputs numéricos */
.input-with-unit {
    position: relative;
    display: flex;
}

.ot-calculator-container .input-with-unit input {
    width: 100% !important;
    background: #121214 !important;
    border: 1px solid var(--border-color) !important;
    padding: 14px 40px 14px 12px !important;
    border-radius: 8px !important;
    color: white !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.ot-calculator-container .input-with-unit input:focus {
    outline: none !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2) !important;
}

.ot-calculator-container .input-with-unit input::placeholder {
    color: #555 !important;
    opacity: 1 !important;
}

.input-with-unit .unit-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: bold;
    font-size: 14px;
    user-select: none;
    pointer-events: none;
}

/* Fila de configuración (SE/PP + Clase) */
.config-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.config-row .input-group {
    min-width: 140px;
}

/* Botón principal */
.btn {
    display: inline-block;
    padding: 18px 24px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    text-align: center;
    transition: all 0.25s ease;
    background: var(--accent-blue);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(10, 132, 255, 0.4);
    width: 100%;
    margin-top: 20px;
}

.btn:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(10, 132, 255, 0.5);
}

.btn:active {
    transform: translateY(0);
}

/* ============================================================
   PANEL DE RESULTADOS
   ============================================================ */
.results-panel {
    display: none;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.results-panel.visible {
    display: block;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Valor principal de impedancia */
.zp-main-value {
    font-size: 72px;
    font-weight: 900;
    color: #fff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 30px rgba(10, 132, 255, 0.3);
    margin: 10px 0 0 0;
    line-height: 1;
}

.zp-main-value .zp-unit {
    font-size: 32px;
    color: var(--text-secondary);
    font-weight: 600;
}

.zp-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-blue);
    margin-bottom: 5px;
    font-weight: 700;
}

/* ============================================================
   DIBUJO SVG TRANSFORMADOR (animado)
   ============================================================ */
.trafo-svg-container {
    margin: 25px auto;
    max-width: 260px;
    width: 100%;
}

.trafo-svg-container svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 15px rgba(10, 132, 255, 0.15));
}

/* Animación de "pulso magnético" en las bobinas del trafo */
@keyframes coilPulse {
    0%, 100% { stroke-opacity: 0.7; }
    50% { stroke-opacity: 1; }
}

.coil-primary {
    stroke: var(--accent-blue);
    animation: coilPulse 2.5s ease-in-out infinite;
}

.coil-secondary {
    stroke: var(--color-green);
    animation: coilPulse 2.5s ease-in-out infinite 0.4s;
}

@keyframes corePulse {
    0%, 100% { fill-opacity: 0.6; }
    50% { fill-opacity: 0.9; }
}

.trafo-core {
    fill: #555;
    animation: corePulse 3s ease-in-out infinite;
}

/* ============================================================
   BARRA DEGRADADA DE IMPEDANCIA
   ============================================================ */
.impedance-bar-container {
    position: relative;
    max-width: 500px;
    margin: 30px auto 10px;
    padding: 0 20px;
}

.impedance-bar {
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(90deg, 
        #ff453a 0%, 
        #ff9f0a 20%, 
        #30d158 40%, 
        #30d158 60%, 
        #ff9f0a 80%, 
        #ff453a 100%
    );
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Puntero (flecha) sobre la barra */
.bar-pointer {
    position: absolute;
    top: -18px;
    transform: translateX(-50%);
    transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
}

.bar-pointer::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 14px solid #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Etiquetas bajo la barra */
.bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.bar-label-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -24px;
    font-size: 11px;
    color: var(--color-green);
    font-weight: 700;
    white-space: nowrap;
}

/* Valores de las tres zonas */
.zp-trio {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.zp-trio-item {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid #333;
    text-align: center;
}

.zp-trio-item .trio-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 700;
}

.zp-trio-item .trio-value {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.trio-crunch .trio-label { color: var(--color-red); }
.trio-crunch .trio-value { color: var(--color-red); }
.trio-ideal .trio-label { color: var(--color-green); }
.trio-ideal .trio-value { color: var(--color-green); }
.trio-headroom .trio-label { color: var(--accent-blue); }
.trio-headroom .trio-value { color: var(--accent-blue); }

/* Panel Vatios trafo */
.watts-panel {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 159, 10, 0.08);
    border: 1px solid rgba(255,159,10,0.3);
    border-radius: 10px;
    text-align: center;
}

.watts-panel .watts-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-orange);
    font-weight: 700;
    margin-bottom: 5px;
}

.watts-panel .watts-value {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
}

.watts-panel .watts-info {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* ============================================================
   SECCIÓN AVISOS TÉCNICOS
   ============================================================ */
.warnings-panel {
    display: none;
}

.warnings-panel.visible {
    display: block;
}

.warning-item {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.warning-item .warn-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.warn-danger {
    background: rgba(255,69,58,0.1);
    border-left: 4px solid var(--color-red);
    color: #ffa099;
}

.warn-caution {
    background: rgba(255,159,10,0.1);
    border-left: 4px solid var(--accent-orange);
    color: #ffd699;
}

.warn-ok {
    background: rgba(48,209,88,0.1);
    border-left: 4px solid var(--color-green);
    color: #99e6b3;
}

/* ============================================================
   GLOSARIO / SECCIÓN TÉCNICA
   ============================================================ */
.help-panel h3 {
    margin-top: 0;
    color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.help-panel h4 {
    color: var(--accent-orange);
    margin-top: 20px;
}

.help-content p, .help-content li {
    font-size: 14px;
    line-height: 1.65;
    color: #ccc;
    margin-bottom: 10px;
    text-align: justify;
}

.help-content code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent-blue);
}

/* ============================================================
   TABLA DE AMPLIFICADORES REFERENCIA
   ============================================================ */
@keyframes slideRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

.scroll-hint {
    display: none;
    text-align: right;
    font-size: 12px;
    color: var(--accent-orange);
    margin-bottom: 8px;
    font-style: italic;
    opacity: 0.85;
}

.scroll-hint span {
    display: inline-block;
    animation: slideRight 1.5s infinite;
}

.ref-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 550px;
}

.ref-table th {
    background: #2c2c2e;
    color: var(--accent-orange);
    padding: 10px 8px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    position: sticky;
    top: 0;
}

.ref-table td {
    padding: 8px;
    border-bottom: 1px solid #2a2a2e;
    color: #ddd;
}

.ref-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

/* ============================================================
   BOTONES CRUZADOS (Servicios)
   ============================================================ */
.cross-link {
    display: inline-block;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 18px;
    text-decoration: none;
    font-family: var(--font-main);
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    width: 80%;
    max-width: 400px;
    text-align: center;
}

.cross-link:hover {
    transform: translateY(-2px);
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 600px) {
    body.dark-theme { padding: 10px; }
    .form-row { flex-direction: column; align-items: stretch; }
    .config-row { flex-direction: column; }
    .input-group { min-width: 100%; }
    .zp-main-value { font-size: 52px; }
    .zp-main-value .zp-unit { font-size: 24px; }
    .zp-trio { flex-direction: column; }
    .zp-trio-item { min-width: 100%; }
    .app-header h1 { font-size: 20px; }
    .panel-dark { padding: 16px; }
    .impedance-bar-container { padding: 0 10px; }
    .scroll-hint { display: block; }
}

/* ============================================================
   OVERRIDES ANTI-AVADA (WordPress) 
   Estas reglas anulan los estilos inyectados por el tema Avada
   ============================================================ */
.ot-calculator-container select,
.ot-calculator-container .controls-panel select,
body .ot-calculator-container select,
body .fusion-body .ot-calculator-container select,
body.fusion-body .ot-calculator-container select,
#main .ot-calculator-container select {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
    border: 1px solid #3a3a3c !important;
    border-radius: 8px !important;
    padding: 12px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    box-sizing: border-box !important;
    height: 48px !important;
    min-height: 48px !important;
    line-height: 1.2 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.ot-calculator-container input,
.ot-calculator-container input[type="number"],
.ot-calculator-container .input-with-unit input,
body .ot-calculator-container input[type="number"],
body .fusion-body .ot-calculator-container input[type="number"],
#main .ot-calculator-container input[type="number"] {
    background-color: #121214 !important;
    color: #ffffff !important;
    border: 1px solid #3a3a3c !important;
    border-radius: 8px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    height: auto !important;
    line-height: normal !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

.ot-calculator-container label,
body .ot-calculator-container label,
body .fusion-body .ot-calculator-container label {
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    background: none !important;
}

.ot-calculator-container {
    color: var(--text-primary) !important;
    font-family: var(--font-main) !important;
}

/* Slider Ultralineal */
.ul-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ul-slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none !important;
    appearance: none;
    height: 6px;
    background: #3a3a3c;
    border-radius: 3px;
    outline: none;
}

.ul-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.ul-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.ul-value-label {
    min-width: 42px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--accent-blue);
}
