* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    padding: 22px 4.7vw 28px;
    overflow: hidden;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: #F5F7FF;
    background:
        radial-gradient(circle at 88% 18%, rgba(139, 92, 246, .28), transparent 29%),
        radial-gradient(circle at 10% 82%, rgba(76, 29, 149, .20), transparent 32%),
        linear-gradient(135deg, #070A12 0%, #0D1020 48%, #17112A 100%);
}

/* =========================================================
   AURORA — GRAFITO / VIOLETA ELÉCTRICO / CIAN
   Paleta moderna: grafito profundo, violeta eléctrico y cian luminoso.
   ========================================================= */

.chat-container {
    width: 100%;
    max-width: 1500px;
    height: calc(100vh - 50px);
    min-height: 620px;
    margin: 0 auto;
    padding: 24px 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 42px;
    background:
        linear-gradient(145deg,
            rgba(15, 18, 30, .98),
            rgba(8, 8, 9, .99) 55%,
            rgba(23, 17, 42, .97));
    box-shadow:
        inset 0 0 90px rgba(124, 58, 237, .09),
        inset 0 1px 0 rgba(255, 255, 255, .08),
        0 28px 82px rgba(0, 0, 0, .72);
    backdrop-filter: blur(20px);
}

/* Halo violeta */
.chat-container::before {
    content: "";
    position: absolute;
    width: 680px;
    height: 680px;
    right: -340px;
    bottom: -350px;
    border-radius: 50%;
    background: rgba(109, 40, 217, .20);
    filter: blur(105px);
    pointer-events: none;
}

/* =========================
   ENCABEZADO
   ========================= */

.header {
    flex: 0 0 auto;
    min-height: 180px;
    padding: 2px 80px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    background: transparent;
    box-shadow: none;
}

.avatar-header {
    width: 94px;
    height: 94px;
    object-fit: contain;
    border-radius: 0;
    filter:
        drop-shadow(0 0 14px rgba(139, 92, 246, .44))
        drop-shadow(0 0 30px rgba(255, 255, 255, .10));
}

.header-text {
    line-height: 1.2;
}

.header-text strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(25px, 2.15vw, 38px);
    font-weight: 700;
    letter-spacing: .24em;
    color: #F5F7FF;
    text-shadow:
        0 0 15px rgba(168, 85, 247, .55),
        0 2px 4px rgba(0, 0, 0, .82);
}

.header-text span {
    display: block;
    max-width: 1100px;
    margin-top: 10px;
    font-size: clamp(15px, 1.2vw, 20px);
    font-weight: 400;
    opacity: .94;
    color: #C9D2E6;
}

/* =========================
   ÁREA DE CHAT
   ========================= */

#chat {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 26px 30px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 3px solid rgba(255, 255, 255, .11);
    border-radius: 34px;
    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, .055),
            rgba(255, 255, 255, .018) 55%,
            rgba(34, 211, 238, .035));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .14),
        inset 0 -1px 0 rgba(255, 255, 255, .035),
        inset 0 0 45px rgba(124, 58, 237, .075),
        0 0 30px rgba(0, 0, 0, .42);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 211, 238, .72) transparent;
}

#chat::-webkit-scrollbar {
    width: 7px;
}

#chat::-webkit-scrollbar-track {
    background: transparent;
}

#chat::-webkit-scrollbar-thumb {
    background:
        linear-gradient(
            180deg,
            rgba(103, 232, 249, .94),
            rgba(76, 29, 149, .94)
        );
    border-radius: 20px;
}

/* =========================
   MENSAJES
   ========================= */

.msg {
    margin: 8px 0;
    padding: 13px 18px;
    display: inline-block;
    width: fit-content;
    max-width: 82%;
    min-width: 120px;
    border-radius: 20px;
    word-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;
    font-size: 16px;
    line-height: 1.55;
}

.welcome {
    align-self: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 13px 22px 13px 76px;
    position: relative;
    border: 1px solid rgba(34, 211, 238, .28);
    border-radius: 30px;
    background:
        linear-gradient(90deg,
            rgba(255, 255, 255, .075),
            rgba(139, 92, 246, .075),
            rgba(255, 255, 255, .025));
    color: #F5F7FF;
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    font-size: 18px;
    box-shadow:
        inset 0 0 28px rgba(124, 58, 237, .055);
}

.welcome::before {
    content: "✦";
    position: absolute;
    left: -2px;
    top: 50%;
    width: 58px;
    height: 58px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 1px solid #22D3EE;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #8B5CF6,
            #720b0b 68%,
            #120B1E);
    color: #F5F7FF;
    font-size: 25px;
    box-shadow:
        0 0 22px rgba(34, 211, 238, .36),
        0 0 42px rgba(124, 58, 237, .12);
}

.user {
    align-self: flex-end;
    color: #F5F7FF;
    background:
        linear-gradient(135deg,
            rgba(139, 92, 246, .34),
            rgba(34, 211, 238, .13));
    backdrop-filter: blur(16px) saturate(155%);
    -webkit-backdrop-filter: blur(16px) saturate(155%);
    border: 1px solid rgba(103, 232, 249, .58);
    border-bottom-right-radius: 4px;
    box-shadow:
        0 7px 22px rgba(0, 0, 0, .34),
        0 0 20px rgba(124, 58, 237, .09);
}

.bot {
    align-self: flex-start;
    color: #E9EEFA;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, .075),
            rgba(255, 255, 255, .025));
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    border: 1px solid rgba(126, 119, 119, .28);
    border-bottom-left-radius: 4px;
    box-shadow: 0 7px 22px rgba(0, 0, 0, .27);
}

/* =========================
   BOTÓN COPIAR
   ========================= */

.msg button {
    border: 1px solid rgba(34, 211, 238, .72);
    border-radius: 10px;
    padding: 8px 13px;
    background:
        linear-gradient(135deg,
            rgba(38, 21, 68, .98),
            rgba(12, 14, 24, .99));
    color: #ffeaea;
    font-size: 12px;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
}

.msg button:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(135deg,
            rgba(67, 38, 112, .99),
            rgba(18, 18, 32, .99));
}

/* =========================
   BARRA DE ENTRADA
   ========================= */

.input-area {
    flex: 0 0 auto;
    min-height: 98px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    bottom: auto;
    border: 1px solid rgba(255, 255, 255, .17);
    border-radius: 34px;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, .085),
            rgba(124, 58, 237, .065),
            rgba(34, 211, 238, .035));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .18),
        inset 0 -1px 0 rgba(255, 255, 255, .035),
        inset 0 0 32px rgba(124, 58, 237, .10),
        0 0 24px rgba(0, 0, 0, .40);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
}

input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 66px;
    padding: 0 22px;
    border: 1px solid rgba(104, 92, 92, .38);
    border-radius: 0;
    outline: none;
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, .055),
            rgba(255, 255, 255, .018));
    color: #F5F7FF;
    font-size: 18px;
    box-shadow:
        inset 0 0 23px rgba(0, 0, 0, .45);
}

input::placeholder {
    color: #8490A8;
    opacity: 1;
}

input:focus {
    border-color: rgba(34, 211, 238, .75);
    box-shadow:
        inset 0 0 23px rgba(0, 0, 0, .45),
        0 0 18px rgba(124, 58, 237, .13);
}

/* =========================
   BOTONES EXISTENTES
   ========================= */

button {
    flex: 0 0 76px;
    width: 76px;
    height: 66px;
    padding: 0;
    border: 1px solid rgba(34, 211, 238, .80);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #7C3AED,
            #261544 70%,
            #10081A);
    color: #F5F7FF;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow:
        inset 0 0 19px rgba(103, 232, 249, .23),
        0 0 21px rgba(124, 58, 237, .13);
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

button:hover {
    transform: scale(1.04);
    background:
        radial-gradient(circle at 35% 30%,
            #A855F7,
            #3B1766 70%,
            #160A25);
    box-shadow:
        inset 0 0 22px rgba(207, 250, 254, .30),
        0 0 28px rgba(124, 58, 237, .23);
}

#voiceBtn {
    margin-right: 8px;
    width: 66px;
    height: 66px;
    flex-basis: 66px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#voiceBtn.recording {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.14); }
    100% { transform: scale(1); }
}

/* =========================
   CELULAR
   ========================= */

@media (max-width: 700px) {
    body {
        padding: 8px;
        overflow: hidden;
    }

    .chat-container {
        height: calc(100dvh - 16px);
        min-height: 0;
        padding: 14px 12px;
        gap: 12px;
        border-radius: 24px;
    }

    .chat-container::after {
        top: 151px;
        left: 8%;
        right: 8%;
    }

    .header {
        min-height: 150px;
        padding: 0 10px;
        gap: 5px;
    }

    .avatar-header {
        width: 76px;
        height: 76px;
    }

    .header-text strong {
        font-size: 24px;
        letter-spacing: .17em;
    }

    .header-text span {
        margin-top: 7px;
        font-size: 13px;
        line-height: 1.35;
    }

    #chat {
        padding: 20px 15px;
        border-width: 3px;
        border-radius: 25px;
    }

    .msg {
        max-width: 90%;
        font-size: 15px;
        padding: 11px 14px;
    }

    .welcome {
        padding: 12px 12px 12px 58px;
        font-size: 15px;
    }

    .welcome::before {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }

    .input-area {
        min-height: 76px;
        padding: 9px;
        gap: 8px;
        border-radius: 25px;
    }

    input {
        height: 56px;
        padding: 0 14px;
        font-size: 16px;
    }

    button {
        flex-basis: 58px;
        width: 58px;
        height: 56px;
        font-size: 11px;
    }

    #voiceBtn {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        font-size: 19px;
    }
}
