* {
    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: #f7effb;
    background:
        radial-gradient(circle at 86% 12%, rgba(132, 48, 168, .28), transparent 29%),
        radial-gradient(circle at 12% 84%, rgba(70, 22, 93, .24), transparent 32%),
        linear-gradient(135deg, #050306 0%, #120b16 48%, #24102b 100%);
}

/* =========================================================
   AURORA — PÚRPURA PROFUNDO / NEGRO / ORO
   Inspirado en la referencia: superficie púrpura marmoleada,
   negro elegante y líneas metálicas doradas.
   ========================================================= */

.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(191, 139, 54, .48);
    border-radius: 42px;
    background:
        linear-gradient(145deg,
            rgba(28, 13, 32, .97),
            rgba(8, 7, 10, .99) 56%,
            rgba(42, 16, 47, .96));
    box-shadow:
        inset 0 0 90px rgba(79, 22, 99, .17),
        inset 0 1px 0 rgba(247, 202, 107, .10),
        0 28px 78px rgba(0, 0, 0, .68);
    backdrop-filter: blur(20px);
}

/* Resplandor púrpura */
.chat-container::before {
    content: "";
    position: absolute;
    width: 640px;
    height: 640px;
    right: -320px;
    top: -330px;
    border-radius: 50%;
    background: rgba(131, 40, 167, .20);
    filter: blur(105px);
    pointer-events: none;
}

/* Línea metálica dorada */
.chat-container::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    top: 188px;
    height: 1px;
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(139, 83, 24, .38),
            rgba(244, 201, 103, .95),
            rgba(139, 83, 24, .38),
            transparent
        );
    opacity: .68;
    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 15px rgba(169, 79, 208, .42))
        drop-shadow(0 0 25px rgba(237, 179, 73, .14));
}

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

.header-text strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(25px, 2.15vw, 38px);
    font-weight: 650;
    letter-spacing: .24em;
    color: #f7eaff;
    text-shadow:
        0 0 16px rgba(173, 82, 212, .48),
        0 2px 4px rgba(0, 0, 0, .78);
}

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

/* =========================
   Á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: 4px solid rgba(119, 57, 139, .46);
    border-radius: 34px;
    background:
        linear-gradient(145deg,
            rgba(24, 11, 28, .95),
            rgba(5, 5, 7, .98));
    box-shadow:
        inset 0 0 55px rgba(104, 36, 124, .12),
        inset 0 1px 0 rgba(239, 191, 91, .07),
        0 0 30px rgba(0, 0, 0, .38);
    scrollbar-width: thin;
    scrollbar-color: rgba(189, 131, 42, .72) transparent;
}

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

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

#chat::-webkit-scrollbar-thumb {
    background:
        linear-gradient(
            180deg,
            rgba(226, 174, 74, .90),
            rgba(102, 51, 116, .90)
        );
    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(185, 111, 215, .27);
    border-radius: 30px;
    background:
        linear-gradient(90deg,
            rgba(62, 27, 71, .74),
            rgba(18, 10, 21, .60));
    color: #f8eefb;
    font-size: 18px;
    box-shadow:
        inset 0 0 27px rgba(150, 62, 186, .07);
}

.welcome::before {
    content: "✦";
    position: absolute;
    left: -2px;
    top: 50%;
    width: 58px;
    height: 58px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 1px solid #d5a14a;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #77438b,
            #351a42 67%,
            #100914);
    color: #ffe6a7;
    font-size: 25px;
    box-shadow:
        0 0 20px rgba(168, 77, 205, .28),
        0 0 28px rgba(225, 166, 67, .10);
}

.user {
    align-self: flex-end;
    color: #fffaff;
    background:
        linear-gradient(135deg,
            rgba(112, 45, 132, .99),
            rgba(55, 20, 68, .99));
    border: 1px solid rgba(197, 120, 224, .50);
    border-bottom-right-radius: 4px;
    box-shadow:
        0 7px 22px rgba(0, 0, 0, .32),
        0 0 18px rgba(139, 55, 166, .10);
}

.bot {
    align-self: flex-start;
    color: #f3edf5;
    background:
        linear-gradient(135deg,
            rgba(35, 24, 39, .99),
            rgba(10, 8, 12, .99));
    border: 1px solid rgba(138, 106, 148, .29);
    border-bottom-left-radius: 4px;
    box-shadow: 0 7px 22px rgba(0, 0, 0, .25);
}

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

.msg button {
    border: 1px solid rgba(218, 164, 67, .70);
    border-radius: 10px;
    padding: 8px 13px;
    background:
        linear-gradient(135deg,
            rgba(92, 52, 17, .97),
            rgba(48, 24, 10, .99));
    color: #ffe4a4;
    font-size: 12px;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
}

.msg button:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(135deg,
            rgba(133, 74, 18, .98),
            rgba(66, 31, 10, .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(183, 128, 39, .52);
    border-radius: 34px;
    background:
        linear-gradient(135deg,
            rgba(47, 25, 54, .97),
            rgba(11, 9, 13, .99));
    box-shadow:
        inset 0 0 32px rgba(132, 44, 164, .08),
        inset 0 1px 0 rgba(245, 195, 92, .09),
        0 0 24px rgba(0, 0, 0, .36);
}

input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 66px;
    padding: 0 22px;
    border: 1px solid rgba(105, 75, 112, .38);
    border-radius: 0;
    outline: none;
    background:
        linear-gradient(180deg,
            rgba(8, 6, 10, .99),
            rgba(3, 3, 5, .99));
    color: #fff8ff;
    font-size: 18px;
    box-shadow:
        inset 0 0 23px rgba(0, 0, 0, .44);
}

input::placeholder {
    color: #98899d;
    opacity: 1;
}

input:focus {
    border-color: rgba(212, 160, 66, .70);
    box-shadow:
        inset 0 0 23px rgba(0, 0, 0, .44),
        0 0 17px rgba(195, 133, 39, .12);
}

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

button {
    flex: 0 0 76px;
    width: 76px;
    height: 66px;
    padding: 0;
    border: 1px solid rgba(218, 165, 66, .74);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #79502a,
            #4b2a18 68%,
            #1b1011);
    color: #fff3d5;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow:
        inset 0 0 18px rgba(225, 166, 68, .18),
        0 0 18px rgba(181, 113, 36, .11);
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

button:hover {
    transform: scale(1.04);
    background:
        radial-gradient(circle at 35% 30%,
            #a87531,
            #65391b 68%,
            #241213);
    box-shadow:
        inset 0 0 20px rgba(255, 210, 105, .25),
        0 0 25px rgba(205, 137, 40, .20);
}

#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: 600px) {
    body {
        padding: 8px;
        overflow: hidden;
    }

    .chat-container {
        height: calc(100dvh - 16px);
        min-height: 0;
        max-width: 100%;
        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;
    }
}
