/* ============================================================
   🍊 ORANGETUBE · PÁGINA DE AJUSTES
   ============================================================ */

.settings-page {
    max-width: 900px;
    margin: 0 auto;
    padding: calc(var(--navbar-height) + 22px) 16px calc(120px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* === CABECERA === */
.settings-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 4px 2px;
}

.settings-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 22px;
    color: #fff;
    background: linear-gradient(135deg, #FFB020, #FF6B00 55%, #E0460A);
    box-shadow: 0 16px 32px -16px rgba(255, 107, 0, 0.9);
    animation: otLogoFloat 4.4s ease-in-out infinite;
}

.settings-hero h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.6px;
    line-height: 1.15;
}

.settings-hero p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* === PESTAÑAS === */
.settings-tabs {
    position: sticky;
    top: calc(var(--navbar-height) + env(safe-area-inset-top, 0px));
    z-index: 20;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 2px;
    scrollbar-width: none;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    background: var(--bg-primary);
    background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
    border-radius: 14px;
}

.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tabs a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: transform 0.22s var(--ot-ease-out), background 0.25s ease,
                color 0.25s ease, border-color 0.25s ease;
}

.settings-tabs a:hover {
    transform: translateY(-2px);
    color: var(--primary);
    border-color: var(--primary);
}

.settings-tabs a i { font-size: 12px; }

/* === TARJETAS === */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px 18px 8px;
    box-shadow: 0 18px 40px -34px rgba(0, 0, 0, 0.5);
    scroll-margin-top: calc(var(--navbar-height) + 70px);
    animation: otFloatIn 0.5s var(--ot-ease-out) both;
}

.settings-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.settings-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 16px;
    color: var(--primary);
    background: rgba(255, 107, 0, 0.12);
}

.settings-card h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.settings-card-head p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Tarjeta destacada de Optimización */
.settings-card-highlight {
    position: relative;
    border: 1px solid rgba(255, 107, 0, 0.45);
    background:
        radial-gradient(120% 100% at 0% 0%, rgba(255, 107, 0, 0.10), transparent 55%),
        var(--bg-card);
    box-shadow: 0 26px 60px -40px rgba(255, 107, 0, 0.9);
}

.settings-card-highlight::after {
    content: '⚡ SUPER';
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #FFB020, #FF5A00);
    box-shadow: 0 6px 14px -8px rgba(255, 107, 0, 0.9);
}

/* === FILAS === */
.st-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.st-row:last-child { border-bottom: none; }

.st-row-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.st-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.st-row-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.st-row-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* === INTERRUPTOR === */
.st-switch {
    flex: 0 0 auto;
    width: 50px;
    height: 29px;
    border-radius: 999px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    position: relative;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.st-switch span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s var(--ot-ease-bounce);
}

.st-switch.on {
    background: linear-gradient(135deg, #FF8C38, #FF5A00);
    border-color: transparent;
    box-shadow: 0 8px 18px -10px rgba(255, 107, 0, 0.95);
}

.st-switch.on span {
    transform: translateX(21px);
}

.st-switch:active span {
    width: 25px;
}

/* === SEGMENTOS === */
.st-segment {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 3px;
    gap: 2px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.st-segment button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: background 0.25s ease, color 0.25s ease, transform 0.2s var(--ot-ease-bounce);
}

.st-segment button i { font-size: 11px; }

.st-segment button:hover { color: var(--text-primary); }

.st-segment button.active {
    color: #fff;
    background: linear-gradient(135deg, #FF8C38, #F25C00);
    box-shadow: 0 8px 16px -10px rgba(255, 107, 0, 0.95);
    transform: translateY(-1px);
}

/* === SELECT === */
.st-select {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.st-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.16);
}

/* === RANGO === */
.st-range {
    display: flex;
    align-items: center;
    gap: 12px;
}

.st-range input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ot-orange-2) var(--fill, 20%), var(--bg-hover) var(--fill, 20%));
    outline: none;
    cursor: pointer;
}

.st-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.5);
    transition: transform 0.2s var(--ot-ease-bounce);
}

.st-range input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }

.st-range input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
}

.st-range output {
    min-width: 44px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 10px;
    background: rgba(255, 107, 0, 0.12);
}

/* === PRESETS === */
.st-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 14px 0 6px;
}

.st-preset {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    border-radius: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: transform 0.25s var(--ot-ease-out), border-color 0.25s ease,
                box-shadow 0.25s ease, color 0.25s ease;
}

.st-preset i {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 2px;
}

.st-preset strong { font-size: 13px; color: var(--text-primary); }
.st-preset small { font-size: 10px; opacity: 0.75; text-align: center; }

.st-preset:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 16px 30px -22px rgba(255, 107, 0, 0.9);
}

.st-preset.active {
    border-color: var(--primary);
    background: linear-gradient(160deg, rgba(255, 140, 56, 0.18), rgba(255, 107, 0, 0.06));
    box-shadow: 0 18px 34px -24px rgba(255, 107, 0, 0.95);
}

/* === ALMACENAMIENTO === */
.st-storage {
    padding: 16px 0 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.st-storage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.st-storage-row i {
    width: 18px;
    color: var(--primary);
    margin-right: 6px;
}

.st-storage-row strong {
    font-size: 13px;
    color: var(--text-primary);
}

.st-storage-bar {
    height: 9px;
    border-radius: 999px;
    background: var(--bg-hover);
    overflow: hidden;
    margin-top: 4px;
}

.st-storage-bar span {
    display: block;
    height: 100%;
    width: 3%;
    border-radius: 999px;
    background: linear-gradient(90deg, #FFB020, #FF6B00, #E0460A);
    background-size: 200% 100%;
    animation: otBarFlow 2.4s linear infinite;
    transition: width 0.6s var(--ot-ease-out);
}

.st-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.st-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0 14px;
}

.st-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: transform 0.2s var(--ot-ease-bounce), background 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
}

.st-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px -18px rgba(255, 107, 0, 0.9);
}

.st-btn i { color: var(--primary); }

.st-btn-danger {
    color: #E23B3B;
    border-color: rgba(226, 59, 59, 0.35);
    background: rgba(226, 59, 59, 0.08);
}

.st-btn-danger i { color: #E23B3B; }

.st-btn-danger:hover {
    border-color: #E23B3B;
    box-shadow: 0 12px 24px -18px rgba(226, 59, 59, 0.9);
}

/* === INSIGNIAS === */
.st-badge {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(255, 107, 0, 0.12);
}

.st-footer-note {
    padding: 12px 0 16px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* === MÓVIL === */
@media (max-width: 640px) {
    .settings-page {
        padding-left: 12px;
        padding-right: 12px;
        gap: 14px;
    }

    .settings-hero h1 { font-size: 22px; }

    .settings-hero-icon {
        width: 48px;
        height: 48px;
        border-radius: 15px;
        font-size: 19px;
    }

    .settings-card {
        padding: 16px 14px 6px;
        border-radius: 17px;
    }

    .st-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .st-row .st-switch,
    .st-row .st-select,
    .st-row .st-badge,
    .st-row .st-btn {
        align-self: flex-end;
    }

    .st-row .st-segment {
        align-self: stretch;
        justify-content: space-between;
    }

    .st-segment button {
        flex: 1;
        justify-content: center;
        padding: 8px 6px;
    }

    .st-presets {
        gap: 8px;
    }

    .st-preset { padding: 12px 6px; }
    .st-preset small { display: none; }

    .settings-card-highlight::after {
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 380px) {
    .st-segment button i { display: none; }
    .st-btn { padding: 9px 12px; font-size: 12px; }
}

/* === MODO SIN ANIMACIONES === */
html.ot-fx-off .settings-hero-icon,
html.ot-fx-off .settings-card,
html.ot-fx-off .st-storage-bar span {
    animation: none !important;
}

html.ot-fx-soft .settings-hero-icon,
html.ot-fx-soft .settings-card {
    animation-duration: 0.01ms;
}

/* ============================================================
   CONTROLES EXTRA (colores, chips, conexión)
   ============================================================ */

/* Muestras de color */
.st-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 4px 0 2px;
}

.st-colors button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--sw, var(--primary));
    border: 3px solid transparent;
    box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.6), inset 0 -6px 12px rgba(0, 0, 0, 0.18),
                inset 0 4px 10px rgba(255, 255, 255, 0.35);
    position: relative;
    transition: transform 0.22s var(--ot-ease-bounce), box-shadow 0.25s ease, border-color 0.2s ease;
}

.st-colors button:hover {
    transform: translateY(-3px) scale(1.08);
}

.st-colors button.active {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.st-colors button.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 13px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

/* Chips (búsquedas guardadas) */
.st-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.st-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: transform 0.2s var(--ot-ease-bounce), color 0.2s ease, border-color 0.2s ease;
}

.st-chip i {
    font-size: 10px;
    color: var(--primary);
}

.st-chip:hover {
    transform: translateY(-2px);
    color: var(--primary);
    border-color: var(--primary);
}

/* Resultado del diagnóstico de red */
.st-connection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 16px;
}

.st-ok,
.st-bad {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 10px;
}

.st-ok {
    color: #12A150;
    background: rgba(18, 161, 80, 0.12);
}

.st-bad {
    color: #E23B3B;
    background: rgba(226, 59, 59, 0.12);
}

/* Presets en 4 columnas en escritorio */
@media (min-width: 641px) {
    .st-presets {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .st-presets {
        grid-template-columns: repeat(2, 1fr);
    }

    .st-colors {
        align-self: flex-start;
    }

    .st-colors button {
        width: 34px;
        height: 34px;
    }
}

/* ============================================================
   PANEL DEL SISTEMA
   ============================================================ */
.st-sys {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 0 6px;
}

.st-sys-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    border-bottom: 1px dashed var(--border);
}

.st-sys-row:last-child {
    border-bottom: none;
}

.st-sys-row strong {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Chips del encabezado y nota de anuncios */
.st-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.st-chip-ok {
    color: #22A06B;
    border-color: rgba(34, 160, 107, .35);
    background: rgba(34, 160, 107, .12);
}

.st-note {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.st-note-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.st-note-head i {
    color: var(--primary);
}

.st-note p {
    margin: 0 0 8px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.st-note p:last-child {
    margin-bottom: 0;
}

.st-note-ad {
    border-color: rgba(34, 160, 107, .28);
    background: rgba(34, 160, 107, .07);
}

.st-note-ad .st-note-head i {
    color: #22A06B;
}
