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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #faf5f5; /* Tono muy suave de fondo */
    overflow: hidden;
    font-family: 'Quicksand', sans-serif;
    color: #4a4a4a;
}

/* Fondo Dinámico con CSS (Más sutil y minimalista) */
.animated-bg {
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #fdf5f6 40%, #f9ecec 100%);
    z-index: -1;
}

/* Contenedor principal de la app (Modelo iPhone) */
.app-container {
    width: 375px;
    max-width: 100%;
    height: 812px;
    max-height: 90vh; /* Para que quepa en pantallas pequeñas */
    background: #ffffff;
    border-radius: 45px;
    
    /* Efecto 3D del chasis del celular */
    box-shadow: 0 0 0 10px #1f1f1f, 
                0 0 0 12px #333333, 
                0 30px 40px rgba(0,0,0,0.2); 
                
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Notch / Dynamic Island */
.app-container::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 28px;
    background: #1f1f1f;
    border-radius: 20px;
    z-index: 100;
}

/* Home bar inferior */
.app-container::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 5px;
    background: #e0e0e0;
    border-radius: 3px;
    z-index: 100;
}

/* Animaciones y transiciones */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s ease;
    background: #ffffff;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
}
.hidden-left {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
}
.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* ==================================
   PANTALLA 1: INICIO
   ================================== */
#screen-1 {
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.header-decoration {
    height: 60px;
}

.icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 70px;
}

.icon-box {
    width: 100px;
    height: 100px;
    border-radius: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #faf7f7;
    box-shadow: 10px 10px 20px rgba(220,200,200,0.2), -10px -10px 20px #ffffff;
    transition: transform 0.3s ease;
}
.icon-box:hover {
    transform: translateY(-5px);
}
.icon-box img {
    width: 44px;
    height: 44px;
    opacity: 0.8;
}

.titles {
    text-align: center;
    margin-bottom: 60px;
}
.titles h1 {
    font-family: 'Lora', serif;
    font-size: 42px;
    color: #333333;
    font-weight: 500;
    letter-spacing: -1px;
    margin-bottom: 8px;
}
.titles p {
    font-size: 11px;
    color: #999;
    letter-spacing: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.btn-primary {
    background: #c39e9e;
    color: #ffffff;
    border: none;
    padding: 16px 55px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(195, 158, 158, 0.4);
    transition: all 0.3s ease;
}
.btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 5px 15px rgba(195, 158, 158, 0.3);
}

/* ==================================
   PANTALLA 2: SEGURIDAD
   ================================== */
#screen-2 {
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.security-header {
    text-align: center;
    margin-bottom: 50px;
}
.security-header h2 {
    font-family: 'Lora', serif;
    color: #333333;
    font-size: 26px;
    font-weight: 500;
    margin-bottom: 12px;
}
.security-header p {
    color: #888;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.security-input-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#security-answer {
    width: 90%;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    background: transparent;
    padding: 15px 10px;
    font-size: 16px;
    color: #555;
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease;
    margin-bottom: 10px;
}
#security-answer:focus {
    border-bottom: 1px solid #c39e9e;
}
#security-answer::placeholder {
    color: #ccc;
    font-style: italic;
}

.btn-secondary {
    background: #ffffff;
    color: #c39e9e;
    border: 1px solid #c39e9e;
    padding: 12px 45px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:active {
    background: #fdf5f6;
    transform: scale(0.95);
}

.btn-text {
    background: none;
    border: none;
    color: #aaa;
    font-size: 13px;
    margin-top: 40px;
    cursor: pointer;
    text-decoration: underline;
}

.mt-30 { margin-top: 30px; }

/* Shake Animación para Error */
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(3px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
.error-msg {
    color: #d97777;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
}


/* ==================================
   PANTALLA 3: CHAT
   ================================== */
#screen-3 {
    background: #faf7f7;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 50px 20px 20px;
    background: #ffffff;
    box-shadow: 0 2px 15px rgba(0,0,0,0.02);
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.profile-pic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #eadecd; /* Color por defecto si no hay imagen */
}

.profile-text h2 {
    font-family: 'Lora', serif;
    font-size: 16px;
    color: #333333;
    font-weight: 600;
    margin-bottom: 2px;
}
.status {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}
.online-dot {
    color: #c39e9e;
    animation: blink 2s infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

.icon-btn { background: none; border: none; cursor: pointer; display: flex; align-items: center;}
.icon-btn:active { transform: scale(0.9); }

.chat-subtitle {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    margin: 20px 0 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.chat-container::-webkit-scrollbar { width: 0px; }

/* Burbujas de mensaje */
.msg {
    max-width: 75%;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    font-weight: 400;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) both;
}
@keyframes popIn {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-ai {
    background: #ffffff;
    color: #555;
    align-self: flex-start;
    border-radius: 20px 20px 20px 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.01);
}

.msg-user {
    background: #c39e9e;
    color: #ffffff;
    align-self: flex-end;
    border-radius: 20px 20px 5px 20px;
    box-shadow: 0 4px 15px rgba(195, 158, 158, 0.2);
}

/* Indicador Escribiendo animado */
.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 16px 20px;
}
.typing-dots span {
    width: 5px;
    height: 5px;
    background-color: #c39e9e;
    border-radius: 50%;
    animation: bounceDots 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounceDots {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.5;}
    40% { transform: scale(1); opacity: 1;}
}

/* Area de escritura */
.chat-input-area {
    display: flex;
    align-items: center;
    padding: 15px 20px 30px;
    background: #ffffff;
    gap: 12px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.02);
}
.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f9f5f5;
    border-radius: 25px;
    padding: 6px 15px;
    gap: 10px;
    transition: background 0.3s;
}
.input-wrapper:focus-within {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03) inset;
}
.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    outline: none;
    font-size: 14px;
    color: #555;
}
.input-wrapper input::placeholder {
    color: #bbb;
}

.send-btn {
    width: 42px;
    height: 42px;
    background: #c39e9e;
    border-radius: 50%;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(195, 158, 158, 0.3);
    transition: transform 0.2s ease;
}
.send-btn:active {
    transform: scale(0.9);
}
