/* ChatBot Migración Colombia — VERSION 1.2 NUEVA */

/* ===== Variables ===== */
:root {
    --navy:       #00368C;
    --blue:       #0057B8;
    --blue-mid:   #1A73E8;
    --blue-light: #E8F0FE;
    --sky:        #F0F6FF;
    --white:      #FFFFFF;
    --text-dark:  #1A2B4A;
    --text-mid:   #4A5568;
    --border:     #C8DBF5;
    --shadow:     rgba(0, 54, 140, 0.12);
    --warn:       #E53E3E;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

/* ===== Page background ===== */
.page-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(150deg, #001F5B 0%, #0045A4 55%, #003A8C 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* ===== Chat container ===== */
.chat-container {
    width: 100%;
    max-width: 500px;
    height: 94vh;
    height: 94dvh;
    max-height: 860px;
    background: var(--white);
    border-radius: 20px;
    box-shadow:
        0 24px 64px rgba(0, 30, 80, 0.45),
        0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== Header ===== */
.chat-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.2px;
}

.header-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CDB76;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(76, 219, 118, 0.3);
    animation: pulse-green 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 2px rgba(76, 219, 118, 0.3); }
    50%       { box-shadow: 0 0 0 5px rgba(76, 219, 118, 0.1); }
}

/* ===== Restart button ===== */
.restart-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 7px 12px;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
}

.restart-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.5);
}

.restart-btn:active {
    background: rgba(255, 255, 255, 0.38);
}

.restart-label {
    letter-spacing: 0.2px;
}

/* ===== Messages area ===== */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 14px 22px;
    background: var(--sky);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== Message rows ===== */
.message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: fade-up 0.28s ease;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bot-row  { justify-content: flex-start; }
.user-row { justify-content: flex-end; }

/* ===== Message avatar ===== */
.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

/* ===== Bubbles ===== */
.bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 16px;
    line-height: 1.6;
    word-break: break-word;
}

.bot-bubble {
    background: var(--white);
    color: var(--text-dark);
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 1px 4px var(--shadow);
    border-left: 3px solid var(--blue);
}

.user-bubble {
    background: var(--blue);
    color: var(--white);
    border-radius: 16px 4px 16px 16px;
    box-shadow: 0 2px 8px rgba(0, 87, 184, 0.3);
}

.bot-bubble a {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s, border-color 0.2s;
}

.bot-bubble a:hover {
    color: var(--navy);
    border-bottom-color: var(--navy);
}

.bot-bubble strong { color: var(--navy); }
.bot-bubble em     { color: var(--text-mid); font-style: italic; }

/* ===== Typing indicator ===== */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    min-width: 60px;
}

.dot {
    width: 7px;
    height: 7px;
    background: var(--blue-mid);
    border-radius: 50%;
    opacity: 0.5;
    animation: bounce 1.3s infinite ease-in-out;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
    40%           { transform: translateY(-6px);  opacity: 1;   }
}

/* ===== Footer ===== */
.chat-footer {
    padding: 10px 14px 14px;
    background: var(--white);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--blue-mid) var(--blue-light);
}

.chat-footer::-webkit-scrollbar { width: 7px; }
.chat-footer::-webkit-scrollbar-track {
    background: var(--blue-light);
    border-radius: 4px;
}
.chat-footer::-webkit-scrollbar-thumb {
    background: var(--blue-mid);
    border-radius: 4px;
}
.chat-footer::-webkit-scrollbar-thumb:hover {
    background: var(--blue);
}

/* ===== Options ===== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.option-btn {
    background: var(--white);
    color: var(--blue);
    border: 1.5px solid var(--blue);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 16px;
    font-family: var(--font);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.18s, color 0.18s, transform 0.12s, box-shadow 0.18s;
}

.option-btn:hover {
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 87, 184, 0.25);
    transform: translateY(-1px);
}

.option-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.new-query-btn {
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
    color: var(--white);
    border: none;
    text-align: center;
    font-weight: 700;
    padding: 12px 14px;
    box-shadow: 0 4px 14px rgba(0, 87, 184, 0.3);
}

.new-query-btn:hover {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
    color: var(--white);
    transform: translateY(-1px);
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
    .page-wrapper {
        padding: 0;
        align-items: stretch;
    }

    .chat-container {
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .restart-label {
        display: none;
    }

    .restart-btn {
        padding: 7px 10px;
    }
}
