* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    padding: 22px 4vw 28px;
    overflow: hidden;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: #eef8ff;
    background:
        radial-gradient(circle at 82% 14%, rgba(0, 119, 255, .22), transparent 28%),
        radial-gradient(circle at 14% 84%, rgba(0, 65, 143, .24), transparent 32%),
        linear-gradient(135deg, #020406 0%, #07121c 45%, #000306 100%);
}

/* =========================================================
   AURORA — NEGRO / AZUL ELÉCTRICO / AZUL PROFUNDO
   Inspirado en la referencia: cuero azul texturizado,
   negro profundo y contrastes azules intensos.
   ========================================================= */

.chat-container {
    width: 100%;
    max-width: 1480px;
    height: calc(100vh - 50px);
    min-height: 620px;
    margin: 0 auto;
    padding: 22px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(24, 112, 207, .55);
    border-radius: 40px;
    background:
        linear-gradient(145deg,
            rgba(9, 22, 33, .98),
            rgba(2, 8, 13, .99) 58%,
            rgba(4, 18, 31, .98));
    box-shadow:
        inset 0 0 90px rgba(0, 0, 0, .62),
        inset 0 1px 0 rgba(61, 150, 235, .10),
        0 30px 90px rgba(0, 0, 0, .70);
    backdrop-filter: blur(22px);
}

/* Halo azul */
.chat-container::before {
    content: "";
    position: absolute;
    width: 620px;
    height: 620px;
    left: -340px;
    top: -320px;
    border-radius: 50%;
    background: rgba(0, 96, 255, .16);
    filter: blur(95px);
    pointer-events: none;
}

/* Trazo azul eléctrico */
.chat-container::after {
    content: "";
    position: absolute;
    left: 7%;
    right: 7%;
    top: 188px;
    height: 1px;
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(18, 85, 160, .35),
            rgba(26, 143, 255, .95),
            rgba(18, 85, 160, .35),
            transparent
        );
    opacity: .82;
    pointer-events: none;
}

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

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

.avatar-header {
    width: 94px;
    height: 94px;
    object-fit: contain;
    border-radius: 0;
    filter:
        drop-shadow(0 0 14px rgba(0, 112, 255, .55))
        drop-shadow(0 0 30px rgba(0, 52, 132, .28))
        drop-shadow(0 5px 16px rgba(0, 0, 0, .70));
}

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

.header-text strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(25px, 2.15vw, 38px);
    font-weight: 700;
    letter-spacing: .22em;
    color: #f2f7fb;
    text-shadow:
        0 0 16px rgba(25, 130, 255, .40),
        0 2px 3px rgba(0, 0, 0, .78);
}

.header-text span {
    display: block;
    max-width: 1080px;
    margin-top: 9px;
    font-size: clamp(14px, 1.15vw, 19px);
    line-height: 1.45;
    color: #bdceda;
    opacity: .95;
}

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

#chat {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 3px solid rgba(16, 88, 158, .48);
    border-radius: 31px;
    background:
        linear-gradient(145deg,
            rgba(5, 17, 27, .98),
            rgba(1, 6, 10, .99));
    box-shadow:
        inset 0 0 65px rgba(0, 0, 0, .54),
        inset 0 1px 0 rgba(40, 129, 218, .08),
        0 0 35px rgba(0, 0, 0, .34);
    scrollbar-width: thin;
    scrollbar-color: rgba(17, 117, 230, .78) transparent;
}

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

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

#chat::-webkit-scrollbar-thumb {
    background:
        linear-gradient(
            180deg,
            rgba(29, 145, 255, .92),
            rgba(4, 57, 130, .92)
        );
    border-radius: 20px;
}

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

.msg {
    margin: 8px 0;
    padding: 14px 19px;
    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.58;
}

.welcome {
    align-self: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px 22px 14px 72px;
    position: relative;
    border: 1px solid rgba(24, 103, 184, .40);
    border-radius: 29px;
    background:
        linear-gradient(90deg,
            rgba(8, 39, 69, .88),
            rgba(4, 18, 31, .70));
    color: #edf7fc;
    font-size: 18px;
    box-shadow:
        inset 0 0 28px rgba(0, 66, 145, .13);
}

.welcome::before {
    content: "✦";
    position: absolute;
    left: -2px;
    top: 50%;
    width: 54px;
    height: 54px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 1px solid rgba(28, 146, 255, .92);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #176cb2,
            #082e59 62%,
            #030b13);
    color: #d9eeff;
    font-size: 23px;
    box-shadow:
        0 0 22px rgba(0, 111, 255, .34),
        0 0 35px rgba(0, 58, 145, .14);
}

.user {
    align-self: flex-end;
    color: #ffffff;
    background:
        linear-gradient(135deg,
            rgba(0, 82, 170, .99),
            rgba(3, 38, 91, .99));
    border: 1px solid rgba(28, 133, 240, .58);
    border-bottom-right-radius: 6px;
    box-shadow:
        0 7px 22px rgba(0, 0, 0, .30),
        0 0 18px rgba(0, 83, 183, .10);
}

.bot {
    align-self: flex-start;
    color: #eaf2f8;
    background:
        linear-gradient(135deg,
            rgba(24, 30, 35, .99),
            rgba(7, 11, 15, .99));
    border: 1px solid rgba(68, 91, 106, .34);
    border-bottom-left-radius: 6px;
    box-shadow:
        0 7px 22px rgba(0, 0, 0, .24);
}

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

.msg button {
    border: 1px solid rgba(24, 137, 255, .72);
    border-radius: 10px;
    padding: 8px 13px;
    background:
        linear-gradient(135deg,
            rgba(7, 63, 128, .96),
            rgba(3, 25, 57, .99));
    color: #cfe9ff;
    font-size: 12px;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
}

.msg button:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(135deg,
            rgba(10, 93, 180, .98),
            rgba(4, 37, 79, .99));
}

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

.input-area {
    flex: 0 0 auto;
    min-height: 96px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border: 1px solid rgba(20, 105, 190, .58);
    border-radius: 32px;
    background:
        linear-gradient(135deg,
            rgba(7, 34, 57, .99),
            rgba(2, 12, 20, .99));
    box-shadow:
        inset 0 0 35px rgba(0, 45, 100, .24),
        inset 0 1px 0 rgba(54, 145, 234, .08),
        0 0 30px rgba(0, 0, 0, .34);
}

input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 64px;
    padding: 0 21px;
    border: 1px solid rgba(48, 84, 108, .48);
    border-radius: 18px;
    outline: none;
    background:
        linear-gradient(180deg,
            rgba(2, 10, 16, .99),
            rgba(0, 5, 9, .99));
    color: #f3f8fc;
    font-size: 17px;
    box-shadow:
        inset 0 0 28px rgba(0, 0, 0, .48);
}

input::placeholder {
    color: #78909e;
    opacity: 1;
}

input:focus {
    border-color: rgba(22, 135, 255, .82);
    box-shadow:
        inset 0 0 28px rgba(0, 0, 0, .48),
        0 0 18px rgba(0, 108, 255, .16);
}

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

button {
    border: 1px solid rgba(25, 142, 255, .78);
    background:
        radial-gradient(circle at 35% 30%,
            #1165a7,
            #073967 67%,
            #031a31);
    color: #f0f7fc;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

.input-area > button {
    height: 64px;
    padding: 0 20px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 700;
    box-shadow:
        inset 0 0 18px rgba(24, 130, 227, .25),
        0 0 20px rgba(0, 91, 255, .11);
}

#voiceBtn {
    width: 64px;
    height: 64px;
    margin-right: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 21px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    transform: translateY(-1px);
    background:
        radial-gradient(circle at 35% 30%,
            #1785d2,
            #084c86 67%,
            #052641);
    box-shadow:
        inset 0 0 22px rgba(48, 162, 255, .27),
        0 0 26px rgba(0, 108, 255, .20);
}

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

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

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

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

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

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

    .header {
        min-height: 142px;
        padding: 0 8px;
        gap: 5px;
    }

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

    .header-text strong {
        font-size: 23px;
        letter-spacing: .15em;
    }

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

    #chat {
        padding: 18px 13px;
        border-width: 3px;
        border-radius: 23px;
    }

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

    .welcome {
        padding: 11px 11px 11px 57px;
        font-size: 15px;
    }

    .welcome::before {
        width: 45px;
        height: 45px;
        font-size: 19px;
    }

    .input-area {
        min-height: 72px;
        padding: 8px;
        gap: 7px;
        border-radius: 23px;
    }

    input {
        height: 54px;
        padding: 0 13px;
        border-radius: 15px;
        font-size: 16px;
    }

    .input-area > button {
        height: 54px;
        padding: 0 14px;
        border-radius: 15px;
        font-size: 12px;
    }

    #voiceBtn {
        width: 54px;
        height: 54px;
        font-size: 19px;
    }
}
