/* ==========================================================================
   TU REFUGIO - ESTILOS PRINCIPALES Y SISTEMA DE DISEÑO
   Pensado con delicadeza, calidez y belleza para Naye
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;1,400;1,500&family=Caveat:wght@600&display=swap');

:root {
    /* Paleta Neutra Cálida (Día por defecto suave) */
    --font-main: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --font-hand: 'Caveat', cursive;

    /* Colores Base - Modo Suave Cálido */
    --bg-base: #fdfbf7;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-surface-elevated: rgba(255, 255, 255, 0.9);
    --border-subtle: rgba(230, 222, 212, 0.6);
    --border-hover: rgba(200, 185, 170, 0.8);
    
    --text-primary: #2d2621;
    --text-secondary: #6e645a;
    --text-muted: #9c9083;

    /* Acentos */
    --accent-primary: #d48b70;
    --accent-primary-light: #fbeee8;
    --accent-gold: #e2a84a;
    --accent-rose: #d97d91;
    --accent-sage: #7da58a;
    --accent-lavender: #9d8df1;

    /* Sombras y Luces */
    --shadow-soft: 0 10px 30px -8px rgba(110, 95, 80, 0.08);
    --shadow-card: 0 16px 40px -10px rgba(110, 95, 80, 0.12);
    --shadow-glow: 0 0 35px rgba(212, 139, 112, 0.25);
    --blur-glass: blur(16px);

    /* Radios y Espaciados */
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --radius-full: 9999px;

    --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-fast: all 0.2s ease;
}

/* Modo Nocturno Aterciopelado (Protección visual cálida) */
[data-theme="dark"] {
    --bg-base: #141318;
    --bg-surface: rgba(28, 26, 36, 0.75);
    --bg-surface-elevated: rgba(36, 33, 46, 0.9);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);

    --text-primary: #f5f2eb;
    --text-secondary: #bcb4a8;
    --text-muted: #7f786f;

    --shadow-soft: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 18px 45px -10px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 40px rgba(157, 141, 241, 0.2);
}

/* Reset y Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--bg-base);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.8s ease, color 0.5s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* Optimización de interacción táctil para iOS Safari */
button, 
.mood-card, 
.btn, 
.icon-btn, 
.quick-action-btn, 
.hug-trigger-btn,
.breathing-circle-inner {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* Canvas de Fondo para Partículas Vivas */
#atmosphere-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.85;
    transition: opacity 1s ease;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Capa de atmósfera dinámica de fondo */
.atmosphere-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.9;
    transition: background 1.2s ease, opacity 1s ease;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Contenedor Principal con Soporte para Safe Area (Notch e Isla Dinámica) */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(100px, calc(env(safe-area-inset-bottom) + 95px));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Barra Superior / Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-soft);
    margin-bottom: 30px;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon {
    font-size: 1.4rem;
    animation: gentle-float 4s ease-in-out infinite;
}

.brand-text {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand-for-naye {
    font-size: 0.78rem;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
    border: 1px solid rgba(212, 139, 112, 0.2);
}

[data-theme="dark"] .brand-for-naye {
    background: rgba(212, 139, 112, 0.2);
    color: #f7b29a;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-fast);
    position: relative;
}

.icon-btn:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-rose);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(217, 125, 145, 0.4);
}

/* Sección Hero / Pregunta Inicial Compacta */
.hero-section {
    text-align: center;
    margin: 8px auto 26px;
    max-width: 680px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(1.9rem, 4.2vw, 2.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.hero-title span {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-rose) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtext {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 440px;
    margin: 0 auto;
}

/* Grid de Estados de Ánimo (Emociones) */
.mood-selector-container {
    margin-bottom: 45px;
}

.mood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    max-width: 1000px;
    margin: 0 auto;
}

.mood-card {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: left;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.mood-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mood-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card);
}

.mood-card:hover::before {
    opacity: 1;
}

.mood-card.active {
    border-color: var(--accent-primary);
    background: var(--bg-surface-elevated);
    box-shadow: var(--shadow-glow), var(--shadow-card);
    transform: translateY(-3px) scale(1.02);
}

.mood-card-emoji {
    font-size: 1.8rem;
    line-height: 1;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.08));
    transition: transform 0.3s ease;
}

.mood-card:hover .mood-card-emoji {
    transform: scale(1.15) rotate(5deg);
}

.mood-card-info {
    display: flex;
    flex-direction: column;
}

.mood-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

.mood-card-chip {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Opción especial "No sé cómo me siento" resaltada con delicadeza */
.mood-card.special-mood {
    grid-column: 1 / -1;
    justify-content: center;
    max-width: 380px;
    margin: 8px auto 0;
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(157, 141, 241, 0.12) 100%);
    border-style: dashed;
}

/* ==========================================================================
   MUNDO ACTIVO: TARJETA DE EXPERIENCIA E ILUSTRACIÓN
   ========================================================================== */
.experience-world {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 60px;
    scroll-margin-top: 30px;
}

.experience-world.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.sanctuary-card {
    background: var(--bg-surface-elevated);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: clamp(28px, 5vw, 48px);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 36px;
    align-items: center;
}

@media (max-width: 860px) {
    .sanctuary-card {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px 18px;
    }
}

/* Lado Visual: Ilustración y Atmósfera */
.sanctuary-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .sanctuary-visual {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
}

.illustration-wrapper {
    width: 100%;
    max-width: 320px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.06));
}

.visual-aura-badge {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

/* Lado Contenido: Frases, Carta y Cuidado */
.sanctuary-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mood-badge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.mood-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
}

.atmosphere-actions {
    display: flex;
    gap: 6px;
}

.mood-subtitle-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-style: italic;
}

/* Frase Principal */
.quote-container {
    position: relative;
    margin-bottom: 24px;
    padding-left: 20px;
    border-left: 3px solid var(--accent-primary);
}

.quote-text {
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 2.4vw, 1.6rem);
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}

/* Mini consejo de autocuidado */
.care-tip-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 26px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.care-tip-icon {
    font-size: 1.2rem;
    color: var(--accent-sage);
    flex-shrink: 0;
    margin-top: 1px;
}

#care-tip-text {
    transition: opacity 0.3s ease;
}

/* Barra de Botones de Interacción */
.experience-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    user-select: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(212, 139, 112, 0.35);
}

.btn-primary:hover {
    background: #c87a5e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 139, 112, 0.45);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-fav {
    color: var(--text-muted);
}

.btn-fav.active {
    color: var(--accent-rose);
    border-color: rgba(217, 125, 145, 0.3);
    background: rgba(217, 125, 145, 0.1);
}

.btn-fav.active .fav-heart-icon {
    animation: heart-pop 0.4s ease;
}

/* Barra Flotante / Acceso Rápido "Necesito un abrazo" */
.floating-refuge-bar {
    position: fixed;
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
    left: 50%;
    transform: translate3d(-50%, 0, 0);
    -webkit-transform: translate3d(-50%, 0, 0);
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface-elevated);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    padding: 8px 12px 8px 20px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 12px 35px -6px rgba(0, 0, 0, 0.15);
}

.hug-trigger-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent-rose) 0%, var(--accent-primary) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(217, 125, 145, 0.4);
    transition: var(--transition-smooth);
}

.hug-trigger-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 22px rgba(217, 125, 145, 0.55);
}

.hug-icon-anim {
    font-size: 1.2rem;
    animation: gentle-pulse 2s infinite;
}

.quick-bar-sep {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
}

.quick-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.quick-action-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Footer Cálido */
.site-footer {
    margin-top: auto;
    text-align: center;
    padding: 30px 10px 60px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-dedication {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.footer-heart {
    color: var(--accent-rose);
    display: inline-block;
    animation: gentle-pulse 2s infinite;
}

.secret-star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    opacity: 0.35;
    transition: all 0.3s ease;
    padding: 2px 6px;
    vertical-align: middle;
    display: inline-block;
    color: var(--accent-gold);
    touch-action: manipulation;
}

.secret-star-btn:hover {
    opacity: 1;
    transform: scale(1.3) rotate(15deg);
    filter: drop-shadow(0 0 8px var(--accent-gold));
}

/* Keyframes Globales */
@keyframes gentle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(125, 165, 138, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(125, 165, 138, 0); }
    100% { box-shadow: 0 0 0 0 rgba(125, 165, 138, 0); }
}
