/* Viajes LE GRAND Chatbot Widget Styles */
:root {
    /* Colores exactos del logo LE GRAND */
    --primary-color: #004080; /* Azul navy del logo */
    --primary-dark: #003366; /* Azul navy más oscuro para hover */
    --primary-light: #0052A3; /* Azul navy más claro para acentos */
    --secondary-color: #E60000; /* Rojo vibrante del logo */
    --secondary-dark: #CC0000; /* Rojo más oscuro para hover */
    --secondary-light: #FF1A1A; /* Rojo más claro para acentos */
    --white: #FFFFFF;
    --light-gray: #F5F7FA;
    --medium-gray: #8E8E93;
    --dark-gray: #2C2C2C;
    --text-black: #1A1A1A;
    --border-radius: 12px;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Reset y base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-black);
    overflow: hidden;
}

/* Contenedor principal del chatbot */
.chatbot-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    max-height: 100vh;
}

/* Ventana del chat */
.chat-window {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header del chat */
.chat-header {
    background: var(--primary-color);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    color: white;
    min-height: 75px;
    border-bottom: 3px solid var(--secondary-color);
    position: relative;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-light);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.avatar-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 50%;
}

.chat-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    color: white;
}

.chat-title p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8)!important;
    font-weight: 400;
}

/* Powered by EnsambleAI */
.powered-by-container {
    padding: 0px 12px 4px;
    background: var(--white);
    text-align: center;
    flex-shrink: 0;
}

.powered-by-link {
    font-size: 11px;
    color: var(--medium-gray);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.3px;
    /* display: inline-block; */
    text-align: center;
    line-height: 1.2;
}

.powered-by-link:hover {
    color: var(--primary-color);
}

.powered-by-link:active {
    color: var(--dark-gray);
}

.powered-by-logo {
    height: 24px !important;
    width: auto !important;
    margin-left: -8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    display: inline-block;
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    padding: 12px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--white);
    min-height: 220px;
}

/* Contenedor de botones de inicio */
.start-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 12px 50px;
    padding: 0;
    align-self: flex-start;
}

/* Animación de entrada escalonada (uno por uno) para botones de inicio */
.start-buttons-container .start-button {
    opacity: 0;
    transform: translateY(14px);
    animation: startButtonEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.start-buttons-container .start-button:nth-child(1) { animation-delay: 0.05s; }
.start-buttons-container .start-button:nth-child(2) { animation-delay: 0.18s; }
.start-buttons-container .start-button:nth-child(3) { animation-delay: 0.31s; }

@keyframes startButtonEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botones de inicio - estilo flotante */
.start-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-black);
    text-align: left;
    width: fit-content;
    max-width: 360px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    position: relative;
}

.start-button:hover {
    background: white;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 64, 128, 0.2);
}

.start-button:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.start-button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.start-button span {
    flex: 1;
    line-height: 1.4;
}

/* Mensajes individuales */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    align-items: flex-start;
}

.bot-message {
    align-self: flex-start;
    flex-direction: row;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-light);
}

.message-avatar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 50%;
}

.message-avatar svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.message-content {
    background: var(--light-gray);
    padding: 10px 12px;
    border-radius: 20px 20px 20px 6px;
    max-width: min(400px, calc(100vw - 120px));
    word-wrap: break-word;
    position: relative;
}

/* PDF Card (Web) */
.pdf-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 240px;
    max-width: 360px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.pdf-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-card-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 64, 128, 0.08);
    border-radius: 10px;
    font-size: 18px;
}

.pdf-card-title {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-black);
    line-height: 1.3;
    word-break: break-word;
}

.pdf-card-button {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.pdf-card-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.pdf-card-button:active {
    transform: translateY(0px);
    opacity: 0.98;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-content p {
    font-size: 14px;
    line-height: 1.45;
    margin: 0;
}

/* Estilos para formato markdown en mensajes */
.message-content strong {
    font-weight: 700;
    color: inherit;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
}

.user-message .message-content code {
    background: rgba(255, 255, 255, 0.25);
}

.message-content ul,
.message-content ol {
    margin: 6px 0;
    padding-left: 20px;
}

.message-content ul {
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin: 3px 0;
    line-height: 1.5;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.message-content a:hover {
    opacity: 0.8;
}

.user-message .message-content a {
    color: white;
    text-decoration: underline;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 8px 0 4px 0;
    font-weight: 700;
    line-height: 1.3;
}

.message-content h1 {
    font-size: 18px;
}

.message-content h2 {
    font-size: 16px;
}

.message-content h3 {
    font-size: 14px;
}

.message-content br {
    display: block;
    content: "";
    margin: 4px 0;
}

/* Powered by EnsambleAI */
.powered-by-container {
    padding: 4px 12px 2px;
    margin-top: -6px;
    background: var(--white);
    text-align: center;
    flex-shrink: 0;
}

.powered-by-link {
    font-size: 11px;
    color: var(--medium-gray);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.3px;
    /* display: inline-block; */
    text-align: center;
    line-height: 1.2;
}

.powered-by-link:hover {
    color: var(--primary-color);
}

.powered-by-link:active {
    color: var(--dark-gray);
}

.powered-by-logo {
    height: 24px !important;
    width: auto !important;
    margin-left: -8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    display: inline-block;
}

/* Contenedor de input */
.chat-input-container {
    padding: 8px 12px 2px 12px;
    margin-bottom: -3px;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    min-height: 80px;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--light-gray);
    border-radius: 25px;
    padding: 2px;
    transition: all 0.2s ease;
    border: 2px solid rgba(0, 64, 128, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow-light);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-black);
    outline: none;
    font-family: inherit;
    border-radius: 23px;
}

.chat-input::placeholder {
    color: var(--medium-gray);
}

.send-button {
    width: 50px;
    height: 50px;
    border: none;
    color: var(--primary-color);
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(230, 0, 0, 0.3);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

/* Botones de sugerencia */
.suggestion-buttons {
    margin: 12px 0 12px 50px;
    padding: 0;
}

.suggestion-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-button {
    background: var(--light-gray);
    border: 1px solid #e9ecef;
    border-radius: 18px;
    padding: 8px 10px;
    color: var(--text-black);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: fit-content;
    max-width: 280px;
    display: inline-block;
    font-family: inherit;
    white-space: nowrap;
}

.suggestion-button:hover {
    background: #e9ecef;
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
    border-color: var(--primary-color);
}

.suggestion-button:active {
    transform: translateY(0) scale(0.98);
}

.suggestion-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.suggestion-button.disabled:hover {
    background: var(--light-gray);
    color: var(--text-black);
    transform: none;
    box-shadow: none;
}

/* Indicador de escritura */
.typing-indicator {
    animation: slideIn 0.4s ease-out;
}

.typing-indicator .message-content {
    padding: 10px 14px;
    background: var(--light-gray);
    border-radius: 18px 18px 18px 4px;
    min-height: auto;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 16px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Animaciones */
@keyframes typingBounce {
    0% {
        transform: translateY(0px);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
    100% {
        transform: translateY(0px);
        opacity: 0.6;
    }
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease-out;
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
    opacity: 0.3;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    opacity: 0.6;
}

/* Botón de cierre */
.close-button {
    width: 36px;
    height: 36px;
    border: none;
    color: white;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.close-button:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.15);
}

.close-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Responsive adjustments - Mobile First */
@media (max-width: 768px) {
    html, body {
        font-size: 13px;
    }
    
    .chat-header {
        padding: 8px 12px;
        min-height: 60px;
    }
    
    .chat-avatar {
        width: 30px;
        height: 30px;
    }
    
    .avatar-logo {
        width: 18px;
        height: 18px;
    }
    
    .chat-title h3 {
        font-size: 13px;
        margin-bottom: 1px;
    }
    
    .chat-title p {
        font-size: 10px;
    }
    
    .chat-messages {
        padding: 10px;
        gap: 6px;
    }
    
    .message {
        max-width: 85%;
        gap: 8px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    .message-avatar img {
        width: 18px;
        height: 18px;
    }
    
    .message-content {
        padding: 8px 12px;
        max-width: min(300px, calc(100vw - 100px));
    }
    
    .message-content p {
        font-size: 13px;
        line-height: 1.45;
    }
    
    .message-content h1 { font-size: 16px; }
    .message-content h2 { font-size: 15px; }
    .message-content h3 { font-size: 14px; }
    
    .start-buttons-container {
        margin: 8px 0 12px 38px;
        gap: 6px;
    }
    
    .start-button {
        font-size: 12px;
        padding: 8px 12px;
        gap: 8px;
        max-width: 280px;
    }
    
    .start-button svg {
        width: 16px;
        height: 16px;
    }
    
    .suggestion-buttons {
        margin: 10px 0 10px 38px;
    }
    
    .suggestion-button {
        font-size: 11px;
        padding: 6px 10px;
        max-width: 220px;
    }
    
    .chat-input-container {
        padding: 8px 10px 4px 10px;
        min-height: 65px;
    }
    
    .chat-input-wrapper {
        border-radius: 22px;
    }
    
    .chat-input {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .send-button {
        width: 40px;
        height: 40px;
    }
    
    .send-button svg {
        width: 20px;
        height: 20px;
    }
    
    .close-button {
        width: 32px;
        height: 32px;
    }
    
    .close-button svg {
        width: 16px;
        height: 16px;
    }
    
    .powered-by-link {
        font-size: 10px;
    }
    
    .powered-by-logo {
        height: 20px !important;
    }
    
    .pdf-card {
        min-width: 200px;
        max-width: 280px;
        padding: 8px 10px;
    }
    
    .pdf-card-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .pdf-card-title {
        font-size: 12px;
    }
    
    .pdf-card-button {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    html, body {
        font-size: 12px;
    }
    
    .chat-header {
        padding: 6px 10px;
        min-height: 55px;
    }
    
    .chat-avatar {
        width: 28px;
        height: 28px;
    }
    
    .avatar-logo {
        width: 16px;
        height: 16px;
    }
    
    .chat-title h3 {
        font-size: 12px;
    }
    
    .chat-title p {
        font-size: 9px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .message-avatar img {
        width: 16px;
        height: 16px;
    }
    
    .message {
        max-width: 88%;
    }
    
    .message-content {
        max-width: min(260px, calc(100vw - 90px));
    }
    
    .start-buttons-container {
        margin: 6px 0 10px 36px;
    }
    
    .suggestion-buttons {
        margin: 8px 0 8px 36px;
    }
}

/* Desktop - Solo aplicar tamaños grandes en desktop real (no móvil) */
@media (min-width: 769px) {
    html, body {
        font-size: 14px;
    }
    
    .chat-messages {
        gap: 8px;
        padding: 12px 14px;
    }
    
    .message-content p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .chat-title h3 {
        font-size: 16px;
    }
    
    .chat-title p {
        font-size: 12px;
    }
}

/* Desktop grande - iframe 500x600 */
@media (min-width: 769px) and (min-height: 580px) {
    html, body {
        font-size: 15px;
    }
    
    .chat-messages {
        gap: 8px;
        padding: 14px 16px;
    }
    
    .message-content {
        padding: 12px 14px;
    }
    
    .message-content p {
        font-size: 15px;
        line-height: 1.52;
    }
    
    .message-content h1 { font-size: 20px; }
    .message-content h2 { font-size: 18px; }
    .message-content h3 { font-size: 16px; }
    
    .chat-input {
        font-size: 15px;
        padding: 10px 14px;
    }
    
    .chat-title h3 {
        font-size: 17px;
    }
    
    .chat-title p {
        font-size: 13px;
    }
    
    .start-button {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .suggestion-button {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .message-avatar {
        width: 42px;
        height: 42px;
    }
    
    .typing-indicator .message-content {
        padding: 12px 16px;
    }
}