/* =====================================================================
   style.css - Diseño 100% responsivo, romántico y animado
   ===================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #0c090d;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

button, input {
    font: inherit;
    color: inherit;
}

[hidden] {
    display: none !important;
}

/* =====================================================================
   CONTENEDOR PRINCIPAL: 100% RESPONSIVO
   Se adapta perfectamente a pantallas de celular, tablets y monitores de PC.
   No más cuadro pequeño apretado: el contenido respira con elegancia.
   ===================================================================== */
.app-container {
    width: 100%;
    max-width: 820px; /* Amplitud ideal para lectura cómoda en laptops y PC */
    height: 100vh;
    height: 100dvh;
    background-color: #1a151b;
    position: relative;
    overflow: hidden;
    color: #fff;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* En computadoras y tablets se enmarca con una sombra suave y moderna */
@media (min-width: 821px) {
    .app-container {
        border-left: 1px solid rgba(255, 117, 151, 0.15);
        border-right: 1px solid rgba(255, 117, 151, 0.15);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.9), 0 0 25px rgba(255, 117, 151, 0.1);
    }
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    background-color: #1a151b;
    overflow: hidden;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---------- Botones universales ---------- */
.btn-primary {
    background: linear-gradient(135deg, #ff85a1 0%, #ff5c85 100%);
    color: #fff;
    border: none;
    padding: 16px 28px;
    border-radius: 35px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.25s ease, opacity 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(255, 92, 133, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 92, 133, 0.55);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled,
.btn-send:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.icon-btn {
    background: none;
    border: none;
    color: #e0d0db;
    font-size: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.2s, color 0.2s;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ff85a1;
}

.icon-static {
    color: #ccc;
    font-size: 20px;
    width: 44px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

/* =====================================================================
   PANTALLA 1 (INICIO) CON CARRUSEL Y EFECTO DE LATIDO
   ===================================================================== */

/* Contenedor del carrusel de imágenes */
.slideshow-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    background: radial-gradient(circle at 30% 25%, #ff7597 0%, transparent 50%),
                radial-gradient(circle at 75% 65%, #6a3d7a 0%, transparent 55%),
                linear-gradient(160deg, #3a1f3d 0%, #150f18 100%);
}

.slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.8s ease-in-out, transform 8s ease-out;
    transform: scale(1);
    will-change: opacity, transform;
}

.slide.active {
    opacity: 1;
    transform: scale(1.04);
}

/* Fondo degradado romántico en caso de que aún no cargue imagen */
.slide.no-image {
    background: radial-gradient(circle at 30% 25%, #ff7597 0%, transparent 50%),
                radial-gradient(circle at 75% 65%, #6a3d7a 0%, transparent 55%),
                linear-gradient(160deg, #3a1f3d 0%, #150f18 100%);
}

.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(20, 10, 18, 0.2) 0%,
        rgba(26, 15, 24, 0.6) 45%,
        rgba(18, 10, 16, 0.95) 85%,
        rgba(15, 8, 14, 0.98) 100%
    );
    z-index: 2;
}

/* Partículas y corazones flotantes */
.floating-hearts {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.f-heart {
    position: absolute;
    font-size: 22px;
    opacity: 0;
    animation: floatUp 6s infinite ease-in-out;
}

.f-heart.h1 { left: 12%; animation-delay: 0s;   animation-duration: 5.5s; font-size: 24px; }
.f-heart.h2 { left: 32%; animation-delay: 1.8s; animation-duration: 6.5s; font-size: 18px; }
.f-heart.h3 { left: 55%; animation-delay: 0.8s; animation-duration: 7s;   font-size: 26px; }
.f-heart.h4 { left: 78%; animation-delay: 2.5s; animation-duration: 6s;   font-size: 20px; }
.f-heart.h5 { left: 88%; animation-delay: 3.8s; animation-duration: 5.8s; font-size: 22px; }

@keyframes floatUp {
    0% {
        transform: translateY(105vh) scale(0.6) rotate(-10deg);
        opacity: 0;
    }
    15% {
        opacity: 0.7;
    }
    85% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-10vh) scale(1.1) rotate(20deg);
        opacity: 0;
    }
}

/* Contenido de la parte inferior de inicio */
.content-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 24px 24px calc(36px + env(safe-area-inset-bottom));
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

/* ---------- LATIDOS DEL CORAZÓN (ANIMACIÓN) ---------- */
.icon-hearts {
    position: relative;
    display: inline-block;
    color: #ff6b81;
    margin-bottom: 18px;
    cursor: default;
}

.main-heart {
    display: inline-block;
    animation: heartbeat 1.35s infinite ease-in-out;
    filter: drop-shadow(0 0 16px rgba(255, 107, 129, 0.75));
    will-change: transform, filter;
}

.heart-small {
    position: absolute;
    top: -6px;
    right: -16px;
    color: #ff85a1;
    animation: heartPulseSmall 1.8s infinite ease-in-out alternate;
    filter: drop-shadow(0 0 10px rgba(255, 133, 161, 0.8));
}

@keyframes heartbeat {
    0%   { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255, 107, 129, 0.6)); }
    14%  { transform: scale(1.26); filter: drop-shadow(0 0 28px rgba(255, 107, 129, 1)); }
    28%  { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255, 107, 129, 0.6)); }
    42%  { transform: scale(1.32); filter: drop-shadow(0 0 32px rgba(255, 107, 129, 1)); }
    70%  { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255, 107, 129, 0.6)); }
    100% { transform: scale(1); }
}

@keyframes heartPulseSmall {
    0%   { transform: translateY(0) rotate(-12deg) scale(0.9); }
    100% { transform: translateY(-7px) rotate(14deg) scale(1.2); }
}

/* Tipografía de inicio responsiva y legible */
#ui-title {
    font-size: clamp(22px, 4.2vw, 32px);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 25px rgba(255, 117, 151, 0.35);
    letter-spacing: -0.3px;
}

#ui-subtitle {
    font-size: clamp(14px, 2.4vw, 17px);
    color: #f7eef5;
    margin-bottom: 24px;
    line-height: 1.55;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

/* Indicadores de fotos */
.dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    transition: background-color 0.4s ease, transform 0.3s ease;
}

.dot.active {
    background-color: #ff85a1;
    transform: scale(1.25);
    box-shadow: 0 0 10px rgba(255, 133, 161, 0.8);
}

/* =====================================================================
   CABECERAS
   ===================================================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
    flex-shrink: 0;
    background-color: rgba(26, 21, 27, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 117, 151, 0.12);
}

.header h2 {
    font-size: 22px;
    font-family: 'Brush Script MT', 'Segoe Script', cursive;
    font-weight: normal;
    text-align: center;
    color: #ffc2d1;
}

/* =====================================================================
   PANTALLA 2 (PREGUNTA SECRETA)
   ===================================================================== */
.content-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    max-width: 540px;
    width: 100%;
    margin: 0 auto;
    overflow-y: auto;
}

.quiz-icon {
    color: #ff6b81;
    align-self: center;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 15px rgba(255, 107, 129, 0.6));
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #ff85a1;
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

#ui-question {
    font-size: clamp(19px, 3.2vw, 24px);
    margin-bottom: 24px;
    color: #ffe0e6;
    text-align: center;
    line-height: 1.4;
    font-weight: 600;
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid #4a364b;
    background-color: #251c27;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    text-align: center;
}

.input-field:focus {
    border-color: #ff7597;
    box-shadow: 0 0 20px rgba(255, 117, 151, 0.25);
}

.error-text {
    color: #ff5768;
    text-align: center;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
}

.shake {
    animation: shake 0.35s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-8px); }
    75%      { transform: translateX(8px); }
}

.bottom-action {
    padding: 16px 24px calc(24px + env(safe-area-inset-bottom));
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

/* =====================================================================
   PANTALLA 3 (CHAT)
   ===================================================================== */
.chat-header {
    justify-content: flex-start;
    border-bottom: 1px solid rgba(255, 117, 151, 0.15);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

/* Foto de perfil circular en chat (soporta PNG y JPEG) */
.profile-pic {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: #ff7597;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 19px;
    color: #fff;
    border: 2px solid #ff7597;
    box-shadow: 0 0 12px rgba(255, 117, 151, 0.5);
    overflow: hidden;
}

.profile-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-texts strong {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.name-heart {
    color: #ff6b81;
    font-size: 12px;
}

.status-line {
    font-size: 12px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #2ed573;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px #2ed573;
}

/* Área de conversación */
.chat-container {
    flex: 1;
    min-height: 0;
    padding: 20px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 117, 151, 0.3) transparent;
}

.chat-container::-webkit-scrollbar {
    width: 5px;
}

.chat-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 117, 151, 0.3);
    border-radius: 10px;
}

.message {
    max-width: 78%;
    padding: 12px 18px;
    border-radius: 22px;
    font-size: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    animation: fadeInMsg 0.25s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

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

.message .text {
    white-space: pre-wrap;
    display: block;
}

.message.bot {
    align-self: flex-start;
    background-color: #2d2230;
    color: #f5f0f5;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #ff94ac 0%, #ff7094 100%);
    color: #1a0f16;
    font-weight: 500;
    border-bottom-right-radius: 6px;
}

.message.error {
    align-self: center;
    max-width: 90%;
    background-color: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.45);
    color: #ffb8c0;
    font-size: 13px;
    border-radius: 14px;
}

.message .time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    display: block;
    text-align: right;
    margin-top: 5px;
}

.message.user .time {
    color: rgba(26, 15, 22, 0.65);
}

/* Indicador de escribiendo */
.typing-indicator {
    color: #ff85a1;
    font-size: 13px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background-color: rgba(45, 34, 48, 0.7);
    border-radius: 15px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: #ff85a1;
    border-radius: 50%;
    animation: blink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40%           { opacity: 1;    transform: translateY(-3px); }
}

/* Barra de entrada de texto */
.chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    gap: 10px;
    background-color: #1a151b;
    border-top: 1px solid rgba(255, 117, 151, 0.12);
    flex-shrink: 0;
}

.emoji-btn {
    color: #b09cb0;
    font-size: 24px;
}

.input-wrapper {
    flex: 1;
    min-width: 0;
    background-color: #251c27;
    border-radius: 28px;
    border: 1px solid #4a364b;
    display: flex;
    align-items: center;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #ff7597;
    box-shadow: 0 0 15px rgba(255, 117, 151, 0.2);
}

#chat-input {
    width: 100%;
    padding: 12px 18px;
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
    font-size: 16px;
}

.btn-send {
    background: linear-gradient(135deg, #ff85a1 0%, #ff5c85 100%);
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(255, 92, 133, 0.4);
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 92, 133, 0.55);
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-send i {
    color: #fff;
    font-size: 18px;
}
