:root {
    --goya-blue-900: #123b6a;
    --goya-blue-800: #1b4d86;
    --goya-blue-700: #245fa3;
    --goya-blue-100: #e9f1fb;
    --goya-sky: #d9e8fb;
    --goya-gold: #d4ac54;
    --goya-ink: #1d2f45;
    --goya-paper: #f3f7fc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Source Sans 3", sans-serif;
    color: var(--goya-ink);
    background:
        radial-gradient(1200px 400px at 10% -10%, #bcd7fa 0%, rgba(188, 215, 250, 0) 60%),
        radial-gradient(900px 360px at 90% 0%, #e9f2ff 0%, rgba(233, 242, 255, 0) 65%),
        var(--goya-paper);
}

.site-shell {
    min-height: 100vh;
}

.gov-topbar {
    background: var(--goya-blue-900);
    border-bottom: 3px solid var(--goya-gold);
    color: #fff;
}

.gov-topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-family: "Montserrat", sans-serif;
}

.gov-brandline {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.gov-links {
    font-size: 0.82rem;
    opacity: 0.9;
}

.hero-ribbon {
    position: relative;
    background: linear-gradient(120deg, var(--goya-blue-900), var(--goya-blue-700));
    overflow: hidden;
}

.hero-ribbon::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    right: -80px;
    top: -130px;
}

.hero-ribbon::after {
    content: "";
    position: absolute;
    width: 430px;
    height: 430px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    right: 120px;
    top: -260px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(214, 170, 59, 0.18), transparent 26%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 18px 26px;
    color: #fff;
}

.hero-kicker {
    margin: 0;
    font-family: "Montserrat", sans-serif;
    font-size: 0.8rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: #f5dd9e;
}

.hero-title {
    margin: 6px 0 2px;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(1.35rem, 2.7vw, 2rem);
    line-height: 1.1;
    font-weight: 800;
}

.hero-subtitle {
    margin: 0 0 12px;
    font-size: 1rem;
    max-width: 720px;
    color: rgba(255, 255, 255, 0.93);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.9rem;
    backdrop-filter: blur(6px);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #ffd56a;
    box-shadow: 0 0 0 5px rgba(255, 213, 106, 0.2);
}

.chat-layout {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 18px 28px;
}

.chat-wrapper {
    background: #fff;
    border: 1px solid #d9e5f5;
    border-radius: 18px;
    box-shadow: 0 16px 38px rgba(20, 44, 86, 0.14);
    overflow: hidden;
}

.chat-headline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #f7fbff, #edf4fd);
    border-bottom: 1px solid #dbe8fa;
}

.chat-emblem {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(160deg, var(--goya-blue-800), var(--goya-blue-700));
    color: #fff;
    display: grid;
    place-items: center;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
}

.chat-emblem-logo {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    background: linear-gradient(150deg, var(--goya-blue-900), var(--goya-blue-700));
}

.bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    object-fit: cover;
    border: 1px solid rgba(18, 59, 106, 0.28);
    background: #123a67;
    flex-shrink: 0;
    display: block;
}

.chat-headline h2 {
    margin: 0;
    font-family: "Montserrat", sans-serif;
    font-size: 1.02rem;
    color: #183c6d;
}

.chat-headline p {
    margin: 1px 0 0;
    font-size: 0.86rem;
    color: #49668d;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 260px);
    min-height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background:
        linear-gradient(180deg, rgba(232, 240, 250, 0.26) 0%, rgba(255, 255, 255, 0.74) 28%, #fff 100%),
        repeating-linear-gradient(0deg, rgba(208, 223, 244, 0.18), rgba(208, 223, 244, 0.18) 1px, transparent 1px, transparent 36px);
}

.chat-input-shell {
    border-top: 1px solid #d8e5f6;
    padding: 14px;
    background: #f8fbff;
}

.chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#message-input {
    flex: 1;
    border: 1px solid #bdd0ea;
    border-radius: 13px;
    background: #fff;
    font-size: 1rem;
    color: #163356;
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#message-input:focus {
    border-color: #2f6db7;
    box-shadow: 0 0 0 3px rgba(47, 109, 183, 0.2);
}

#message-input::placeholder {
    color: #6f8ab1;
}

#send-button {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(150deg, var(--goya-blue-700), var(--goya-blue-900));
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 8px 16px rgba(15, 43, 86, 0.26);
}

#send-button:hover {
    transform: translateY(-1px);
}

#send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-footer {
    margin: 0;
    padding: 11px 16px;
    font-size: 0.78rem;
    text-align: center;
    color: #4f6d95;
    background: #eff5fd;
    border-top: 1px solid #d8e5f6;
}

/* Animaciones para el indicador de escritura */
@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.typing-dot {
    animation: bounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Scrollbar personalizada */
.chat-messages::-webkit-scrollbar {
    width: 7px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #e8eef8;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #9cb9de;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6f97cc;
}

/* Markdown basico en mensajes */
.message-content h3 {
    font-weight: 700;
    margin-top: 0.55rem;
    margin-bottom: 0.35rem;
}

.message-content p {
    margin-bottom: 0.55rem;
}

.message-content ul,
.message-content ol {
    margin-left: 1.4rem;
    margin-bottom: 0.55rem;
}

.message-content li {
    margin-bottom: 0.24rem;
}

.message-content code {
    background: rgba(10, 47, 99, 0.1);
    color: #0d2e58;
    padding: 0.12rem 0.3rem;
    border-radius: 0.22rem;
    font-size: 0.88rem;
}

@media (max-width: 900px) {
    .gov-links {
        display: none;
    }

    .hero-content {
        padding-top: 18px;
        padding-bottom: 20px;
    }

    .chat-layout {
        padding: 10px 10px 16px;
    }

    .chat-panel {
        height: calc(100vh - 220px);
        min-height: 430px;
    }

    .chat-headline {
        padding: 12px;
    }

    .chat-headline h2 {
        font-size: 0.97rem;
    }

    .chat-headline p {
        font-size: 0.8rem;
    }
}
