/* --- STYLES v18.0 --- */
:root {
    --primary: #ffcc02;
    --primary-dark: #e6b800;
    --primary-light: #fffcf0;
    --text: #343344;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --white: #ffffff;
    --radius: 1rem;
    --radius-lg: 1.5rem;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }

.hidden { display: none !important; }

/* Dashboard Grid Adaptable */
.dashboard-grid { display: grid; gap: 2rem; margin-top: 2rem; }

label { display: block; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.6rem; margin-left: 0.2rem; }

/* Inputs profesionales */
input, textarea, select {
    width: 100%; padding: 1rem; border-radius: 1rem; border: 2px solid #edf2f7;
    background: #fff; font-family: inherit; font-size: 0.95rem; transition: var(--transition);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); background: var(--primary-light); }

.app-header {
    background: var(--white); height: 80px; position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    border-bottom: 1px solid #f1f5f9; box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-container { max-width: 1400px; margin: 0 auto; height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; }
.header-logo { height: 45px; cursor: pointer; }

.desktop-nav { display: flex; gap: 0.5rem; }
.nav-link { padding: 0.7rem 1.1rem; border-radius: 1rem; text-decoration: none; color: var(--text-muted); font-weight: 800; font-size: 0.75rem; text-transform: uppercase; transition: var(--transition); }
.nav-link.active { color: var(--white); background: var(--text); }

.app-content { max-width: 1400px; margin: 110px auto 4rem; padding: 0 1.5rem; }
.premium-title { font-weight: 900; color: var(--text); font-size: 2.2rem; letter-spacing: -1.2px; }

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr !important; }
    .nav-text { display: none; }
}


/* ===== ZONA DE PELIGRO - Eliminar cuenta ===== */
.danger-zone {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 1.5rem;
}

.danger-zone h3 {
    color: #dc2626 !important;
}

.danger-zone p {
    color: #7f1d1d;
}

/* Botón de peligro/eliminar */
.btn-danger {
    background: #dc2626 !important;
    color: white !important;
    border: none !important;
    font-weight: 800;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #b91c1c !important;
    transform: translateY(-1px);
}

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

/* Modal de eliminar cuenta */
.delete-account-modal {
    animation: slideUp 0.3s ease;
}

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

/* ============================================
   RESPONSIVE DESIGN - MEJORADO
   ============================================ */

/* Menú hamburguesa */
.menu-toggle {
    display: none;
    background: var(--primary);
    color: var(--text);
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    width: 100%;
    font-weight: 800;
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-align: center;
    min-height: 44px;
}

.menu-toggle:hover {
    background: var(--primary-dark);
}

/* Tablet (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* Mobile (hasta 768px) */
@media screen and (max-width: 768px) {
    /* ===== MENÚ HAMBURGUESA GLOBAL ===== */
    .menu-toggle {
        display: block;
    }
    
    .desktop-nav {
        position: relative;
    }
    
    .desktop-nav .nav-link:not(.menu-toggle) {
        display: none;
    }
    
    .desktop-nav.mobile-open .nav-link:not(.menu-toggle) {
        display: block;
        width: 100%;
        margin: 5px 0;
        text-align: left;
        padding: 15px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .desktop-nav.mobile-open .nav-link.active {
        background: rgba(255,204,2,0.2);
        border-left: 4px solid var(--primary);
    }
    
    .desktop-nav.mobile-open {
        flex-direction: column;
        position: absolute;
        top: 60px;
        right: 10px;
        background: var(--white);
        border: 1px solid #f1f5f9;
        border-radius: var(--radius);
        padding: 1rem;
        box-shadow: var(--shadow);
        width: 250px;
        z-index: 100;
    }
    
    /* ===== HEADER CONSISTENTE ===== */
    .app-header {
        height: 70px;
        padding: 10px;
    }
    
    .header-container {
        padding: 0 1rem;
        flex-direction: row;
    }
    
    .header-logo {
        height: 35px;
        margin: 0;
    }
    
    .header-actions {
        display: flex;
        align-items: center;
    }
    
    .user-pill {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .user-pill span {
        display: none; /* Ocultar nombre en móvil */
    }
    
    .btn-logout {
        font-size: 0.7rem;
        padding: 0.5rem 1rem;
    }
    
    /* ===== CONTENEDOR PRINCIPAL ===== */
    .container {
        padding: 10px;
        margin: 10px;
    }
    
    .app-content {
        margin: 90px auto 2rem;
        padding: 0 1rem;
    }
    
    /* ===== TÍTULOS ===== */
    .premium-title {
        font-size: 1.6rem;
        margin: 10px 0;
    }
    
    /* ===== GRIDS A COLUMNA ÚNICA ===== */
    .profile-grid,
    .calendar-grid,
    .exercises-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-grid {
        gap: 1rem;
    }
    
    /* ===== PLAN SEMANAL RESPONSIVE ===== */
    
    /* Navegación de semanas */
    .week-navigation {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 1rem;
    }
    
    .week-navigation button {
        width: 100%;
        min-height: 44px;
    }
    
    /* Botones de avanzar/retroceder semana */
    .calendar-section > div > div {
        flex-direction: column !important;
        gap: 1rem;
    }
    
    .calendar-section > div > div button {
        width: 100% !important;
        height: 50px !important;
        border-radius: 1rem !important;
        font-size: 1.2rem !important;
    }
    
    /* Días del calendario */
    .calendar-day {
        padding: 10px;
        min-height: auto;
    }
    
    .day-header {
        margin-bottom: 0.5rem;
    }
    
    .day-name {
        font-size: 0.7rem;
    }
    
    .day-number {
        font-size: 1rem;
    }
    
    /* Pills de ejercicios */
    .ex-pill {
        font-size: 0.7rem;
        padding: 0.6rem;
        margin-bottom: 0.4rem;
    }
    
    /* Modal de ejercicios */
    .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 95vh;
    }
    
    .modal-content iframe,
    .modal-content video {
        max-width: 100%;
        height: auto;
    }
    
    /* ===== FORMULARIO DE SALUD RESPONSIVE ===== */
    
    /* Header de salud */
    .health-header {
        flex-direction: column !important;
        text-align: left !important;
    }
    
    .health-header > div {
        text-align: left !important;
    }
    
    /* Grid principal de salud */
    .health-main-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Grid de salud */
    .health-visual-container {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .health-meter-box {
        padding: 1rem;
    }
    
    /* Formulario de salud */
    .health-form,
    #health-request-form {
        padding: 10px;
    }
    
    .request-sliders-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .health-form input,
    .health-form textarea,
    .health-form select,
    #health-request-form input,
    #health-request-form textarea,
    #health-request-form select {
        width: 100%;
        font-size: 16px;
        padding: 12px;
        margin: 5px 0;
    }
    
    .health-form button,
    #health-request-form button {
        width: 100%;
        min-height: 44px;
        margin: 10px 0;
    }
    
    /* Consultas generales */
    .consultations-list {
        padding: 10px;
    }
    
    .consultation-item {
        padding: 10px;
        margin: 10px 0;
        font-size: 0.85rem;
    }
    
    /* Contador de caracteres */
    #char-count {
        font-size: 0.75rem;
    }
    
    /* ===== PERFIL RESPONSIVE ===== */
    
    /* Header del perfil */
    .profile-header {
        text-align: left;
    }
    
    /* Grid principal del perfil */
    .profile-main-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Layout del perfil */
    .animate-in > div[style*="grid-template-columns: 1fr 300px"] {
        display: block !important;
    }
    
    .profile-container {
        padding: 0 !important;
    }
    
    /* Formulario de perfil */
    #profile-form section.card {
        padding: 15px;
        margin: 10px 0;
    }
    
    #profile-form div[style*="grid-template-columns"] {
        display: block !important;
    }
    
    #profile-form div[style*="grid-template-columns"] > div {
        margin-bottom: 1rem;
    }
    
    #profile-form div[style*="grid-column"] {
        grid-column: auto !important;
    }
    
    .profile-field,
    .profile-section {
        padding: 15px;
        margin: 10px 0;
    }
    
    .profile-field input,
    .profile-field select {
        width: 100%;
        font-size: 16px;
    }
    
    /* Suscripción */
    .subscription-card,
    .subscription-info {
        padding: 15px;
        margin: 10px 0;
    }
    
    .subscription-actions button,
    .sub-actions button {
        width: 100%;
        margin: 5px 0;
    }
    
    .sub-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Aside en perfil */
    aside {
        margin-top: 2rem;
        width: 100% !important;
    }
    
    /* Cambiar contraseña */
    #change-password-form input {
        font-size: 16px;
        padding: 12px;
    }
    
    #change-password-form div[style*="grid"] {
        display: block !important;
    }
    
    #change-password-form div[style*="grid"] > div {
        margin-bottom: 0.8rem;
    }
    
    /* Banner de directo en perfil */
    .live-access-banner {
        padding: 15px;
        margin: 10px 0;
    }
    
    .live-access-banner h4 {
        font-size: 1rem;
    }
    
    .live-access-banner p {
        font-size: 0.85rem;
    }
    
    .live-access-banner button,
    .live-access-banner a {
        width: 100%;
        margin: 5px 0;
    }
    
    .live-access-banner.has-access {
        padding: 15px;
    }
    
    .live-access-banner > div {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* ===== TABLAS RESPONSIVE ===== */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    table th,
    table td {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    /* ===== CARDS MÁS PEQUEÑAS ===== */
    .card {
        padding: 15px;
        margin: 10px 0;
    }
    
    /* ===== BOTONES MÁS GRANDES PARA TOUCH ===== */
    button {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .btn {
        min-height: 44px;
        font-size: 0.8rem;
    }
    
    /* ===== FORMULARIOS ===== */
    input, textarea, select {
        width: 100%;
        font-size: 16px !important; /* Evita zoom en iOS */
        padding: 12px;
    }
    
    /* ===== ADMIN PANEL ===== */
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    /* ===== FORO ===== */
    .forum-categories {
        grid-template-columns: 1fr;
    }
    
    /* ===== ZONA DE PELIGRO ===== */
    .danger-zone {
        padding: 1rem;
    }
    
    /* ===== DÍAS DE ENTRENAMIENTO ===== */
    .days-row {
        gap: 8px;
    }
    
    .day-selector label {
        width: 40px;
        height: 40px;
        font-size: 0.7rem;
    }
}

/* Mobile pequeño (hasta 480px) */
@media screen and (max-width: 480px) {
    h1, .premium-title {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    .container {
        padding: 5px;
        margin: 5px;
    }
    
    .app-content {
        padding: 0 0.5rem;
        margin-top: 80px;
    }
    
    button {
        font-size: 0.8rem;
    }
    
    .calendar-day {
        min-height: 60px;
        font-size: 0.65rem;
    }
    
    .header-container {
        padding: 0 0.5rem;
    }
    
    .danger-zone {
        padding: 0.75rem;
    }
    
    .ex-pill {
        font-size: 0.65rem;
        padding: 0.5rem;
    }
    
    .card {
        padding: 10px;
    }
    
    .day-selector label {
        width: 35px;
        height: 35px;
        font-size: 0.65rem;
    }
}
