:root {
    --background: #ffffff;
    --surface: #f7f7f8;
    --surface-hover: #eeeeef;
    --border: #e5e5e7;
    --text: #171719;
    --muted: #77777d;
    --purple: #7357d8;
    --purple-soft: #eeeafe;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}


/* APP */

.app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* LOGO Y CABECERA */

.header {
    padding-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.logo {
    width: 190px;
    height: 190px;
    object-fit: contain;
    display: block;
    image-rendering: auto;
}

.subtitle {
    margin-top: -12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}


/* CONVERSACIÓN */

.conversation {
    width: min(820px, calc(100% - 32px));
    margin: 30px auto 170px;
    flex: 1;
}

.welcome {
    text-align: center;
    padding-top: 8vh;
}

.welcome h1 {
    margin: 0 0 10px;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.welcome p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.message {
    width: 100%;
    margin: 22px 0;
    display: flex;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.user-bubble {
    max-width: 75%;
    padding: 12px 17px;
    background: var(--surface);
    border-radius: 20px 20px 5px 20px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.assistant-message {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.assistant-avatar {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
}

.assistant-content {
    padding-top: 5px;
    line-height: 1.62;
    font-size: 15px;
    white-space: pre-wrap;
}

.thinking {
    color: var(--muted);
}


/* INDICADOR DE VOZ */

.voice-status {
    position: fixed;
    left: 50%;
    bottom: 112px;
    transform: translateX(-50%);
    z-index: 20;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 9px 14px;

    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: 999px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
    backdrop-filter: blur(12px);

    font-size: 13px;
}

.voice-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
    animation: pulse 1.4s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.35;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }

    100% {
        opacity: 0.35;
        transform: scale(0.85);
    }
}

.hidden {
    display: none !important;
}


/* BARRA INFERIOR */

.composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;

    padding: 10px 18px 13px;

    background: linear-gradient(
        to top,
        #ffffff 70%,
        rgba(255, 255, 255, 0)
    );
}

.input-shell {
    width: min(820px, 100%);
    margin: 0 auto;
    min-height: 58px;

    display: flex;
    align-items: flex-end;
    gap: 5px;

    padding: 9px 9px 9px 17px;

    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 28px;

    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.07);
}

#messageInput {
    flex: 1;
    min-width: 0;
    max-height: 150px;

    resize: none;
    overflow-y: auto;

    border: none;
    outline: none;
    background: transparent;

    color: var(--text);

    padding: 8px 6px 7px 0;
    line-height: 1.45;
}

#messageInput::placeholder {
    color: #9b9ba0;
}


/* BOTONES */

.icon-button,
.send-button {
    width: 40px;
    height: 40px;
    flex-shrink: 0;

    border: none;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
        transform 120ms ease,
        background 120ms ease;
}

.icon-button {
    background: transparent;
    color: #4b4b50;
}

.icon-button:hover {
    background: var(--surface);
}

.icon-button:active,
.send-button:active {
    transform: scale(0.94);
}

.icon-button svg {
    width: 21px;
    height: 21px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.realtime-button {
    background: var(--purple-soft);
    color: var(--purple);
}

.realtime-button:hover {
    background: #e5dffd;
}

.realtime-button.active {
    background: var(--purple);
    color: white;
}

.voice-symbol {
    font-size: 17px;
    line-height: 1;
}

.send-button {
    background: #19191b;
    color: white;
    font-size: 23px;
    font-weight: 400;
}

.send-button:hover {
    background: #303034;
}

.disclaimer {
    width: min(820px, 100%);
    margin: 7px auto 0;

    text-align: center;
    color: #a0a0a5;
    font-size: 11px;
}


/* MÓVIL */

@media (max-width: 600px) {

    .header {
        padding-top: 20px;
    }

    .logo {
        width: 140px;
        height: 140px;
    }

    .subtitle {
        margin-top: -8px;
    }

    .conversation {
        margin-top: 18px;
        margin-bottom: 155px;
    }

    .welcome {
        padding-top: 4vh;
    }

    .welcome h1 {
        font-size: 25px;
    }

    .user-bubble {
        max-width: 88%;
    }

    .composer {
        padding-left: 10px;
        padding-right: 10px;
    }
}
