/* ==========================================================================
   Muévete+ — Hoja de Estilos Accesible para Personas Mayores
   WCAG 2.1 AAA Compliant — Mobile First Design
   ========================================================================== */

:root {
    --bg-main: #f4f7f5;
    --bg-card: #ffffff;
    --primary: #1b4d3e;       /* Verde bosque profundo, alto contraste */
    --primary-hover: #12352b;
    --accent: #d96b27;        /* Naranja cálido y motivador */
    --accent-hover: #b8541a;
    --text-dark: #1f2937;     /* Casi negro para máxima legibilidad */
    --text-muted: #4b5563;
    --border-color: #d1d5db;
    --success: #2e7d32;
    --error: #c62828;
    
    --font-base: 18px;        /* Tipografía base grande */
    --radius: 16px;           /* Bordes redondeados y amables */
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Modo Texto Grande Activado por Usuario */
body.text-large {
    --font-base: 22px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: var(--font-base);
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--bg-main);
    padding-bottom: 90px; /* Espacio para barra de navegación fija */
    -webkit-tap-highlight-color: transparent;
}

/* Header Accesible */
.app-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
}

.logo-plus {
    color: #ffb74d;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
}

/* Badge de Estado de Conexión */
.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #9e9e9e;
}

.status-badge.online .status-dot { background-color: #00e676; }
.status-badge.offline .status-dot { background-color: #ff5252; }

/* Banner de Seguridad */
.safety-banner {
    background-color: #fff3e0;
    border-bottom: 2px solid #ffe0b2;
    padding: 10px 16px;
    font-size: 0.9rem;
    text-align: center;
    color: #e65100;
}

/* Contenedor Principal */
.main-content {
    max-width: 800px;
    margin: 16px auto;
    padding: 0 16px;
}

/* Tarjeta de Bienvenida y Racha */
.welcome-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-left: 6px solid var(--accent);
}

.greeting-box h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.sub-greeting {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
}

.streak-badge {
    background-color: #fff8e1;
    border: 2px solid #ffe082;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: bold;
    color: #b78103;
    font-size: 1rem;
    text-align: center;
}

/* Tarjetas Selectoras */
.config-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (min-width: 600px) {
    .config-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.selector-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.selector-card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--primary);
}

/* Opciones de Botones Grandes */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn-option {
    background-color: #f0f4f1;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    min-height: 52px;
    transition: all 0.2s ease;
}

.btn-option:hover {
    background-color: #e2ede8;
}

.btn-option.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.custom-input-box {
    margin-top: 12px;
}

.custom-input-box label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.custom-input-box input {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

/* Botón CTA Grande */
.action-box {
    text-align: center;
    margin: 24px 0;
}

.btn-cta {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 18px 36px;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(217, 107, 39, 0.35);
    width: 100%;
    max-width: 400px;
    min-height: 64px;
}

.btn-cta:hover {
    background-color: var(--accent-hover);
}

.btn-cta:disabled {
    background-color: #cccccc;
    box-shadow: none;
    cursor: not-allowed;
}

/* Loader y Alertas */
.loading-container {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.alert-info {
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    color: #0d47a1;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* Tarjeta de Visualización de Actividad */
.activity-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-top: 16px;
    border-top: 6px solid var(--primary);
}

.activity-header {
    margin-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 12px;
}

.activity-title {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.activity-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.tag {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
}

.step-card {
    background-color: #fafafa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}

.step-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 8px;
}

.step-instructions {
    padding-left: 20px;
}

.step-instructions li {
    margin-bottom: 6px;
}

.motivation-box {
    background-color: #f3e5f5;
    border-left: 4px solid #8e24aa;
    padding: 12px 16px;
    border-radius: 8px;
    font-style: italic;
    margin: 16px 0;
}

/* Botones de Acción Estándar */
.btn-primary, .btn-secondary, .btn-danger {
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    min-height: 50px;
}

.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary { background-color: #e0e0e0; color: var(--text-dark); }
.btn-danger { background-color: var(--error); color: #ffffff; }

.btn-large { width: 100%; font-size: 1.1rem; }

/* Historial */
.history-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-info h4 { font-size: 1.1rem; color: var(--primary); }
.history-meta { font-size: 0.85rem; color: var(--text-muted); }

/* Formulario Perfil */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.privacy-note {
    background-color: #f5f5f5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Barra de Navegación Inferior Móvil */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-top: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 200;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
}

.nav-icon { font-size: 1.4rem; }

.nav-item.active {
    color: var(--primary);
}

/* Utilidades */
.hidden { display: none !important; }
.tab-content { animation: fadeIn 0.3s ease; }

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