/* General Styles */
html,
body {
    height: 100%;
    overflow-x: hidden;
}

/* Logo Styles */
.logo-img {
    height: 40px;
    width: auto;
    max-width: 200px;
}

/* Button Styles */
.btn-primary {
    background-color: #046a35;
    border-color: #046a35;
    border-radius: 1.5rem;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    /* Para el spinner */
}

.btn-primary:hover {
    background-color: #035428;
    border-color: #035428;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(4, 106, 53, 0.2);
}

.btn-primary:active,
.btn-primary:focus {
    background-color: #046a35 !important;
    border-color: #046a35 !important;
    box-shadow: 0 0 0 0.25rem rgba(4, 106, 53, 0.25) !important;
}

.btn-primary:disabled {
    background-color: #046a35;
    opacity: 0.7;
    transform: none;
    cursor: not-allowed;
}

/* Chat Container */
.chat-container {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

/* Chat Messages Area */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    opacity: 0;
    transform: translateY(20px);
    animation: messageSlide 0.3s ease-out forwards;
}

@keyframes messageSlide {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background-color: #046a35;
    color: white;
    margin-left: auto;
}

.ai-message {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    margin-right: auto;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    max-width: 100px;
    margin-right: auto;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #046a35;
    border-radius: 50%;
    margin: 0 2px;
    opacity: 0.4;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Loading Spinner for Send Button */
.loading-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Input Area */
.input-area {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    background-color: #ffffff;
}

#user-input {
    border-radius: 1.5rem;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

#user-input:focus {
    border-color: #046a35;
    box-shadow: 0 0 0 0.25rem rgba(4, 106, 53, 0.25);
}

#user-input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 2rem;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .logo-img {
        height: 30px;
    }

    .btn-primary {
        padding: 0.5rem 1rem;
    }

    .message {
        max-width: 90%;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #046a35;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #035428;
}

/* Añadir estos estilos al final de tu archivo CSS existente */

/* Message Time Styling */
.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.25rem;
    text-align: right;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.ai-message .message-time {
    color: rgba(0, 0, 0, 0.6);
}

/* Clear Button Styling */
.btn-light .fa-trash {
    color: #dc3545;
    transition: all 0.3s ease;
}

.btn-light:hover .fa-trash {
    color: #bb2d3b;
}

/* Message Content Styling */
.message-content {
    margin-bottom: 0.25rem;
}

/* Fade effect for welcome message */
.welcome-message {
    transition: opacity 0.5s ease-out;
}

/* [Mantener los estilos anteriores y añadir los siguientes] */

/* Card Message Styles */
.message-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 300px;
    margin: 1rem 0;
}

.message-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.message-card-content {
    padding: 1rem;
}

.message-card h3 {
    color: #046a35;
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
}

.message-card p {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
}

/* List Message Styles */
.message-list {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    margin: 0.5rem 0;
}

.message-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.message-list li:last-child {
    border-bottom: none;
}

.message-list li i {
    color: #046a35;
    margin-right: 0.5rem;
}

/* Quick Reply Buttons */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quick-reply-btn {
    background: #f8f9fa;
    border: 1px solid #046a35;
    color: #046a35;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.quick-reply-btn:hover {
    background: #046a35;
    color: white;
}

/* Info Box Styles */
.message-info {
    background: #e8f5e9;
    border-left: 4px solid #046a35;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0 15px 15px 0;
}

/* Warning Box Styles */
.message-warning {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0 15px 15px 0;
}

/* Image Grid Styles */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.image-grid img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
}

/* Itinerary Styles */
.itinerary {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    margin: 0.5rem 0;
}

.itinerary-day {
    border-left: 2px solid #046a35;
    padding-left: 1rem;
    margin: 1rem 0;
    position: relative;
}

.itinerary-day::before {
    content: '';
    width: 12px;
    height: 12px;
    background: #046a35;
    border-radius: 50%;
    position: absolute;
    left: -7px;
    top: 0;
}

/* Weather Info Styles */
.weather-info {
    display: flex;
    align-items: center;
    background: linear-gradient(45deg, #046a35, #0a8d47);
    color: white;
    padding: 1rem;
    border-radius: 15px;
    margin: 0.5rem 0;
}

.weather-info i {
    font-size: 2rem;
    margin-right: 1rem;
}

/* Loading Animation for Images */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: 1fr;
    }

    .message-card {
        max-width: 100%;
    }
}

/* Destination Card Styles */
.destination-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 15px var(--shadow-color);
    margin: 1rem 0;
}

.destination-image {
    position: relative;
    width: 100%;
    height: 200px;
}

.destination-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.destination-rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.destination-rating i {
    color: #ffc107;
}

.destination-content {
    padding: 1.5rem;
}

.destination-content h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.destination-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.destination-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin: 1rem 0;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature i {
    color: var(--brand-color);
    font-size: 1.1rem;
}

.destination-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    color: var(--brand-color);
    font-weight: bold;
}

.quick-replies {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
}

.quick-reply-btn {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid var(--brand-color);
    background: transparent;
    color: var(--brand-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.quick-reply-btn:hover {
    background: var(--brand-color);
    color: white;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .destination-card {
        max-width: 100%;
    }

    .destination-features {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-replies {
        flex-direction: column;
    }
}


/* Variables del tema */
:root {
    /* Tema claro (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #000000;
    --text-secondary: #666666;
    --border-color: #dee2e6;
    --brand-color: #046a35;
    --brand-hover: #035428;
    --message-bg: #f8f9fa;
    --chat-bg: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --hover-bg: #f0f0f0;
    --message-user-bg: #046a35;
    --message-user-text: #ffffff;
    --message-bot-bg: #f8f9fa;
    --message-bot-text: #000000;
}

[data-theme="dark"] {
    /* Tema oscuro con nueva paleta */
    --bg-primary: #2c2c29;
    --bg-secondary: #363633;
    --text-primary: #e9e9e9;
    --text-secondary: #b8b8b8;
    --border-color: #4a4a47;
    --brand-color: #049d4e;
    --brand-hover: #03b357;
    --message-bg: #363633;
    --chat-bg: #2c2c29;
    --input-bg: #363633;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --card-bg: #363633;
    --hover-bg: #40403d;
    --message-user-bg: #049d4e;
    --message-user-text: #ffffff;
    --message-bot-bg: #363633;
    --message-bot-text: #e9e9e9;
}

/* Transiciones suaves */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Estilos generales */
body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Navbar */
.navbar {
    background-color: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
}

/* Chat container */
.chat-container {
    background-color: var(--chat-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
}

/* Mensajes */
.message {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 1rem;
}

.user-message {
    background-color: var(--message-user-bg);
    color: var(--message-user-text);
}

.ai-message {
    background-color: var(--message-bot-bg);
    color: var(--message-bot-text);
    border: 1px solid var(--border-color);
}

/* Input área */
.input-area {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

#user-input {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

#user-input:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 0.25rem rgba(4, 157, 78, 0.25);
}

#user-input::placeholder {
    color: var(--text-secondary);
}

/* Botones */
.btn-primary {
    background-color: var(--brand-color);
    border-color: var(--brand-color);
}

.btn-primary:hover {
    background-color: var(--brand-hover);
    border-color: var(--brand-hover);
}

.btn-light {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-light:hover {
    background-color: var(--hover-bg);
    border-color: var(--border-color);
}

/* Toggle del tema */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    cursor: pointer;
    padding: 0;
    margin: 0 10px;
    overflow: hidden;
}

.theme-toggle::before {
    content: '🌞';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    transition: all 0.3s ease;
}

.theme-toggle::after {
    content: '🌙';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    transition: all 0.3s ease;
}

.theme-toggle .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background-color: var(--brand-color);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle .toggle-thumb {
    transform: translateX(30px);
}

/* Message time */
.message-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Typing indicator */
.typing-indicator {
    background-color: var(--message-bot-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    max-width: 100px;
    margin-right: auto;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--brand-color);
    border-radius: 50%;
    margin: 0 2px;
    display: inline-block;
    opacity: 0.4;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--brand-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-hover);
}

/* Welcome message */
.welcome-message h1,
.welcome-message p {
    color: var(--text-primary);
}

/* Loading spinner */
.loading-spinner {
    border: 2px solid var(--bg-primary);
    border-top: 2px solid var(--brand-color);
}


/* Background container */
body {
    min-height: 100vh;
    background-color: var(--bg-secondary);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/img/background.webp');
    /* Actualizado a WebP */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 106, 53, 0.85);
    /* Color corporativo con 85% de opacidad */
    z-index: -1;
}

/* Ajustes al contenedor del chat */
.chat-container {
    background-color: rgba(var(--chat-bg-rgb), 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Variables de color actualizadas */
:root {
    --chat-bg-rgb: 255, 255, 255;
    --bg-primary-rgb: 255, 255, 255;
    /* Mantener el resto de variables existentes */
}

[data-theme="dark"] {
    --chat-bg-rgb: 44, 44, 41;
    --bg-primary-rgb: 44, 44, 41;
    /* Mantener el resto de variables existentes */
}

/* Navbar con fondo semi-transparente */
.navbar {
    background-color: rgba(var(--bg-primary-rgb), 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Media queries para responsividad */
@media (max-width: 768px) {
    body::before {
        background-position: center center;
    }

    .chat-container {
        margin: 1rem !important;
    }
}

/* Ajustes adicionales para mejor contraste */
.welcome-message h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Optimizaciones móviles y auto-resize del input */
@media (max-width: 768px) {
    .input-area {
        padding: 0.75rem;
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--bg-primary);
        box-shadow: 0 -2px 10px var(--shadow-color);
        z-index: 1000;
    }

    #chat-form {
        display: flex;
        gap: 0.5rem;
        max-width: 100%;
        margin: 0 auto;
        align-items: flex-end;
    }

    #user-input {
        padding: 0.625rem 1rem;
        font-size: 16px;
        /* Previene zoom en iOS */
        min-height: 42px;
        max-height: 120px;
        resize: none;
        overflow-y: auto;
        line-height: 1.2;
    }

    #chat-form button[type="submit"] {
        padding: 0;
        width: 42px;
        height: 42px;
        min-width: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #chat-form button[type="submit"] i {
        font-size: 1rem;
    }

    /* Ajuste para el contenedor de mensajes */
    .chat-container {
        margin-bottom: 60px !important;
    }
}

/* Auto-resize del input */
@media (max-width: 768px) {
    #user-input {
        overflow-y: hidden;
    }
}

/* Soporte para teclado móvil */
@supports (-webkit-touch-callout: none) {
    .chat-container {
        padding-bottom: 80px !important;
    }

    .input-area {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
}

/* Ajustes adicionales para pantallas muy pequeñas */
@media (max-width: 360px) {
    .input-area {
        padding: 0.5rem;
    }

    #user-input {
        padding: 0.5rem 0.75rem;
    }

    .message {
        padding: 0.75rem;
    }
}
/* Footer Credits */
.footer-credits {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem;
    font-size: 0.85rem;
    color: white; /* Color blanco para el resto del texto */
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.footer-credits .powered {
    color: var(--brand-color); /* Cambia este color según tu preferencia */
    font-weight: 600;
}

.footer-credits span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-credits strong {
    color: white;
    font-weight: 600;
}

.openai-logo {
    height: 14px;
    width: auto;
    margin-left: 5px;
    filter: brightness(0) invert(1); /* Logo blanco en modo oscuro */
}
