/* ============================================================================
   BYD APP HUB - ESTILOS PREMIUM E INTEGRACIÓN DE TEMAS (DARK & LIGHT)
   ============================================================================ */

:root {
    /* --- TEMA DARK (Por defecto) --- */
    --bg-main: #0f1214;
    --text-main: #e0e0e0;
    --text-title: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-secondary: rgba(255, 255, 255, 0.7);

    /* Cards y Contenedores */
    --card-bg: rgba(30, 35, 40, 0.7);
    --card-bg-solid: rgba(20, 25, 30, 0.8);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover-bg: rgba(255, 255, 255, 0.08);

    /* Colores de Acento */
    --cyan-primary: #00d2ff;
    --cyan-light: rgba(0, 210, 255, 0.15);
    --cyan-border: rgba(0, 210, 255, 0.3);
    --cyan-glow: rgba(0, 210, 255, 0.4);

    --green-primary: #00ff88;
    --green-light: rgba(0, 255, 136, 0.15);
    --green-border: rgba(0, 255, 136, 0.3);

    --warning-primary: #ffc107;
    --warning-light: rgba(255, 193, 7, 0.15);
    --warning-border: rgba(255, 193, 7, 0.3);

    --danger-primary: #ff4757;
    --danger-light: rgba(255, 71, 87, 0.15);
    --danger-border: rgba(255, 71, 87, 0.3);

    /* Sombras */
    --shadow-color: rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 15px 50px rgba(0, 0, 0, 0.6);
}

[data-theme='light'] {
    /* --- TEMA LIGHT --- */
    --bg-main: #f5f7fa;
    --text-main: #2d3748;
    --text-title: #1a202c;
    --text-muted: #718096;
    --text-secondary: #4a5568;

    /* Cards y Contenedores */
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-bg-solid: #ffffff;
    --card-border: rgba(0, 0, 0, 0.1);
    --card-hover-bg: rgba(0, 0, 0, 0.04);

    /* Colores de Acento */
    --cyan-primary: #005a8c;
    --cyan-light: rgba(0, 90, 140, 0.1);
    --cyan-border: rgba(0, 90, 140, 0.3);
    --cyan-glow: transparent;

    --green-primary: #047857;
    --green-light: rgba(4, 120, 87, 0.1);
    --green-border: rgba(4, 120, 87, 0.3);

    --warning-primary: #b45309;
    --warning-light: rgba(180, 83, 9, 0.1);
    --warning-border: rgba(180, 83, 9, 0.3);

    --danger-primary: #b91c1c;
    --danger-light: rgba(185, 28, 28, 0.1);
    --danger-border: rgba(185, 28, 28, 0.3);

    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 15px 50px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-main) !important;
    color: var(--text-main) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Títulos adaptativos */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-title);
    transition: color 0.3s ease;
}

.hud-section-title {
    color: var(--text-title) !important;
    transition: color 0.3s ease;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Contenedor Principal */
.byd-app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 3rem;
}

/* Títulos con brillo cian (adaptativo) */
.hud-glow-title {
    color: var(--text-title);
    text-shadow: 0 0 15px var(--cyan-glow);
    font-weight: 800;
}
.hud-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* Reset de sombras de texto para legibilidad en modo claro */
[data-theme='light'] .hud-glow-title {
    text-shadow: none !important;
}

/* ============================================================================
   SECCIÓN 1: PANEL DE ESTADO (SEMÁFORO DE SERVIDORES)
   ============================================================================ */
.status-card {
    background: var(--card-bg-solid);
    border: 1px solid var(--cyan-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    margin-bottom: 2.5rem;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.status-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.status-item:hover {
    background: var(--card-hover-bg);
    border-color: var(--cyan-border);
}

.status-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.status-item-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-title);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.status-item-title i {
    font-size: 1.2rem;
    color: var(--cyan-primary);
}

/* Indicadores de porcentaje de salud */
.status-bar-outer {
    background: var(--card-border);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0;
}
.status-bar-inner {
    height: 100%;
    border-radius: 4px;
    width: 100%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Colores de salud dinámicos (adaptados) */
.health-good {
    background: linear-gradient(90deg, #00ff88, #10b981);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}
.health-warning {
    background: linear-gradient(90deg, #ffc107, #f59e0b);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
.health-danger {
    background: linear-gradient(90deg, #ff4d5a, #ef4444);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Ajustes de contraste para barras en modo claro */
[data-theme='light'] .health-good {
    background: linear-gradient(90deg, #059669, #10b981);
}
[data-theme='light'] .health-warning {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}
[data-theme='light'] .health-danger {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.status-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}
.status-pct-text {
    font-weight: 700;
    color: var(--text-title);
}
.status-label {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.label-good { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.label-warning { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.label-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.label-unknown { background: var(--card-border); color: var(--text-muted); }

/* Ajustes de contraste para etiquetas en modo claro */
[data-theme='light'] .label-good { background: rgba(16, 185, 129, 0.2); color: #047857; }
[data-theme='light'] .label-warning { background: rgba(245, 158, 11, 0.2); color: #b45309; }
[data-theme='light'] .label-danger { background: rgba(239, 68, 68, 0.2); color: #b91c1c; }

/* Botones de Votación */
.vote-actions {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
    border-top: 1px solid var(--card-border);
    padding-top: 0.75rem;
}
.btn-vote {
    flex: 1;
    border: 1px solid var(--card-border);
    background: var(--card-hover-bg);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}
.btn-vote:hover {
    color: var(--text-title);
    transform: translateY(-1px);
}
.btn-vote-ok:hover {
    background: rgba(0, 255, 136, 0.12);
    border-color: rgba(0, 255, 136, 0.4);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.15);
}
.btn-vote-ko:hover {
    background: rgba(255, 77, 90, 0.12);
    border-color: rgba(255, 77, 90, 0.4);
    box-shadow: 0 4px 12px rgba(255, 77, 90, 0.15);
}

/* Modificaciones de hover de voto para Modo Claro */
[data-theme='light'] .btn-vote-ok:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
[data-theme='light'] .btn-vote-ko:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

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

/* ============================================================================
   SECCIÓN 2: GRID DE LAS 10 FUNCIONALIDADES
   ============================================================================ */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, var(--cyan-light), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--cyan-border);
    box-shadow: 0 8px 25px var(--cyan-glow);
    background: var(--card-bg-solid);
}
.feature-card:hover::before {
    opacity: 1;
}

.feature-icon-wrapper {
    width: 48px;
    height: 48px;
    background: var(--cyan-light);
    border: 1px solid var(--cyan-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--cyan-primary);
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}
.feature-card:hover .feature-icon-wrapper {
    background: var(--cyan-light);
    border-color: var(--cyan-primary);
    box-shadow: 0 0 12px var(--cyan-glow);
}

/* Brillo del icono adaptado a modo oscuro */
[data-theme='dark'] .feature-icon-wrapper {
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}
[data-theme='dark'] .feature-card:hover .feature-icon-wrapper {
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.4);
}

.feature-content h5 {
    color: var(--text-title);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.feature-content p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

/* Badge de Compatibilidad */
.badge-compat {
    background: var(--card-hover-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    align-self: flex-start;
    font-weight: 500;
}
.feature-card:hover class .badge-compat,
.feature-card:hover .badge-compat {
    border-color: var(--cyan-border);
    background: var(--cyan-light);
    color: var(--cyan-primary);
}

/* ============================================================================
   SECCIÓN 3: PESTAÑAS Y GUÍA DE CONFIGURACIÓN WIDGETS
   ============================================================================ */
.setup-card {
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

/* Navegación por pestañas */
.setup-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}
.setup-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.setup-tab-btn:hover {
    color: var(--text-title);
    background: var(--card-hover-bg);
}
.setup-tab-btn.active {
    color: var(--text-title);
    background: var(--cyan-light);
    border: 1px solid var(--cyan-border);
    box-shadow: 0 0 15px var(--cyan-glow);
}

/* Panel de Contenido */
.setup-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.setup-pane.active {
    display: block;
}

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

/* Columnas de OS */
.os-column {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
}
.os-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-title);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
}

.os-header-ios i { 
    color: var(--text-title); 
}
[data-theme='dark'] .os-header-ios i {
    text-shadow: 0 0 10px rgba(255,255,255,0.4);
}

.os-header-android i { 
    color: #a4c639; 
}
[data-theme='dark'] .os-header-android i {
    text-shadow: 0 0 10px rgba(164,198,57,0.4);
}

/* Lista de Pasos */
.guide-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}
.guide-step-item {
    display: flex;
    gap: 15px;
    margin-bottom: 1.25rem;
    align-items: flex-start;
}
.guide-step-item:last-child {
    margin-bottom: 0;
}

.guide-step-num {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--cyan-primary), #00b4d8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 0 10px var(--cyan-glow);
}
[data-theme='dark'] .guide-step-num {
    color: #000;
}

.guide-step-text {
    color: var(--text-main);
    font-size: 0.92rem;
    line-height: 1.5;
    padding-top: 2px;
}

/* ============================================================================
   SECCIÓN 4: MODAL HUD DE DETALLES
   ============================================================================ */
.hud-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.hud-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.hud-modal-content {
    background: var(--card-bg-solid);
    border: 1px solid var(--cyan-border);
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-main);
}
.hud-modal-overlay.show .hud-modal-content {
    transform: scale(1) translateY(0);
}

.hud-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
}
.hud-modal-icon {
    width: 44px;
    height: 44px;
    background: var(--cyan-light);
    border: 1px solid var(--cyan-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan-primary);
    font-size: 1.3rem;
}
[data-theme='dark'] .hud-modal-icon {
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

.hud-modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-title);
    margin: 0;
}

.hud-modal-body p {
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.hud-modal-block {
    background: var(--card-hover-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}
.hud-modal-block-title {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cyan-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hud-modal-block-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Botón cerrar modal */
.btn-hud-close {
    background: linear-gradient(135deg, var(--cyan-primary), #00b4d8);
    border: none;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    margin-left: auto;
    margin-top: 1.5rem;
}
[data-theme='dark'] .btn-hud-close {
    color: #000;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}
[data-theme='light'] .btn-hud-close {
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 90, 140, 0.2);
}

[data-theme='dark'] .btn-hud-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
}
[data-theme='light'] .btn-hud-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(0, 90, 140, 0.4);
}

/* ============================================================================
   RESPONSIVIDAD Y CONTRASTES DE TEXTO
   ============================================================================ */
@media (max-width: 768px) {
    .setup-tabs {
        flex-direction: column;
    }
    .setup-tab-btn {
        width: 100%;
        justify-content: center;
    }
    .status-card {
        padding: 1.25rem;
    }
    .setup-card {
        padding: 1.25rem;
    }
}

/* --- THEME TOGGLE BUTTON --- */
.theme-toggle {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle i {
    font-size: 1.2rem;
    color: var(--cyan-primary);
}

/* --- HISTORIAL DE ESTADO (7 DÍAS) --- */
.status-history {
    display: flex;
    gap: 4px;
    margin: 0.5rem 0 0.8rem 0;
    justify-content: space-between;
}

.status-history-bar {
    flex: 1;
    height: 8px;
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: help;
}

.status-history-bar:hover {
    transform: scaleY(1.3);
}

.history-good {
    background: #10b981 !important;
}
.history-warning {
    background: #f59e0b !important;
}
.history-danger {
    background: #ef4444 !important;
}
.history-unknown {
    background: var(--card-border) !important;
    opacity: 0.4;
}

[data-theme='light'] .history-good {
    background: #059669 !important;
}
[data-theme='light'] .history-warning {
    background: #d97706 !important;
}
[data-theme='light'] .history-danger {
    background: #dc2626 !important;
}
