/**
 * Estilos del Chatbot MET Mallorca
 */

/* Importar fuente Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Variables CSS */
:root {
    --met-primary: #E86A1C;
    --met-primary-dark: #c55815;
    --met-secondary: #385074;
    --met-text: #333333;
    --met-text-light: #666666;
    --met-bg: #ffffff;
    --met-bg-light: #f8f9fa;
    --met-border: #e0e0e0;
    --met-shadow: rgba(232, 106, 28, 0.15);
    --met-shadow-dark: rgba(56, 80, 116, 0.2);
}

/* ========================================
   LOCATION SEARCHER COMPONENT
   ======================================== */

.met-location-searcher,
.met-time-searcher {
    width: 100%;
    position: relative;
    margin: 10px 0;
}

.met-location-input-wrapper,
.met-time-input-wrapper {
    position: relative;
    width: 100%;
}

.met-location-input,
.met-time-input {
    width: 100%;
    padding: 12px 40px 12px 16px !important;
    border: 2px solid var(--met-border) !important;
    border-radius: 8px !important;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    background: var(--met-bg);
    color: var(--met-text);
}

.met-location-input:focus,
.met-time-input:focus {
    outline: none;
    border-color: var(--met-primary);
    box-shadow: 0 0 0 3px rgba(232, 106, 28, 0.1);
}

.met-location-search-icon,
.met-time-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--met-text-light);
    pointer-events: none;
}

.met-location-dropdown,
.met-time-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--met-bg);
    border: 2px solid var(--met-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.met-location-results,
.met-time-results {
    padding: 4px;
}

.met-location-result-item,
.met-time-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--met-text);
}

.met-location-result-item:hover,
.met-location-result-item.active,
.met-time-result-item:hover,
.met-time-result-item.active {
    background: var(--met-bg-light);
    color: var(--met-primary);
}

.met-location-no-results,
.met-time-no-results {
    padding: 16px;
    text-align: center;
    color: var(--met-text-light);
    font-size: 14px;
}

.met-location-selected,
.met-time-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.met-location-selected-text,
.met-time-selected-text {
    flex: 1;
    margin-right: 10px;
}

.met-location-clear,
.met-time-clear {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.met-location-clear:hover,
.met-time-clear:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Geocoding loading and results */
.met-location-loading {
    padding: 16px;
    text-align: center;
    color: var(--met-primary);
    font-size: 14px;
}

.met-location-loading i {
    margin-right: 8px;
}

.met-location-geocoded .met-location-result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.met-location-hint {
    font-size: 12px;
    color: var(--met-text-light);
    font-style: italic;
    margin-top: 2px;
}

.met-location-result-item i.fa-map-marker-alt {
    color: var(--met-primary);
    margin-right: 6px;
}

.met-location-dropdown::-webkit-scrollbar,
.met-time-dropdown::-webkit-scrollbar {
    width: 6px;
}

.met-location-dropdown::-webkit-scrollbar-track,
.met-time-dropdown::-webkit-scrollbar-track {
    background: var(--met-bg-light);
    border-radius: 3px;
}

.met-location-dropdown::-webkit-scrollbar-thumb,
.met-time-dropdown::-webkit-scrollbar-thumb {
    background: var(--met-border);
    border-radius: 3px;
}

.met-location-dropdown::-webkit-scrollbar-thumb:hover,
.met-time-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--met-text-light);
}

/* Location Searcher dentro del Chatbot */
.met-chatbot-location-wrapper,
.met-chatbot-time-wrapper {
    position: relative;
    padding: 0;
    margin-bottom: 12px;
    background: var(--met-bg);
    width: 100%;
}

.met-chatbot-location-wrapper .met-location-searcher,
.met-chatbot-time-wrapper .met-time-searcher {
    margin: 0;
    width: 100%;
}

/* Time Searcher (reuse styles) */
.met-time-searcher {
    width: 100%;
    position: relative;
    margin: 10px 0;
}

.met-chatbot-location-wrapper,
.met-chatbot-time-wrapper {
    width: 100%;
}

.met-chatbot-location-wrapper .met-location-input,
.met-chatbot-time-wrapper .met-time-input {
    box-sizing: border-box;
}

.met-chatbot-location-wrapper .met-location-dropdown,
.met-chatbot-time-wrapper .met-time-dropdown {
    width: 100%;
    max-height: 300px;
    box-sizing: border-box;
}

.met-chatbot-location-wrapper .met-location-searcher,
.met-chatbot-time-wrapper .met-time-searcher {
    margin: 4px 0 14px;
}

.met-chatbot-location-wrapper .met-location-dropdown,
.met-chatbot-time-wrapper .met-time-dropdown {
    z-index: 10000 !important;
}

/* Widget contenedor */
.met-chatbot-widget {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Botón flotante */
.met-chatbot-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    border: none;
    box-shadow: 0 4px 20px var(--met-shadow), 0 2px 8px var(--met-shadow-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.met-chatbot-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 24px var(--met-shadow), 0 4px 12px var(--met-shadow-dark);
}

.met-chatbot-toggle i {
    font-size: 26px;
    color: white;
    transition: all 0.3s ease;
}

.met-chatbot-icon {
    display: block;
    color: white !important;
}

.met-chatbot-close {
    display: none;
    position: absolute;
}

.met-chatbot-widget.open .met-chatbot-icon,
.met-chatbot-toggle.is-open .met-chatbot-icon {
    display: none;
}

.met-chatbot-widget.open .met-chatbot-close,
.met-chatbot-toggle.is-open .met-chatbot-close {
    display: block;
}

/* Diálogo flotante de invitación */
.met-chatbot-invitation {
    position: absolute;
    bottom: 80px;
    right: 0;
    z-index: 9998;
    animation: slideInRight 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.met-chatbot-invitation-content {
    background: white;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    max-width: 280px;
}

.met-chatbot-invitation-text {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--met-text);
    flex: 1;
}

.met-chatbot-invitation-close {
    color: var(--met-text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.met-chatbot-invitation-close:hover {
    background: var(--met-bg-light);
    color: var(--met-text);
}

.met-chatbot-invitation-arrow {
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Animación de entrada */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Animación de salida */
@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
}

.met-chatbot-invitation.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Ventana del chat */
.met-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 120px);
    background: var(--met-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--met-shadow);
    display: none;
    flex-direction: column;
    overflow: visible;
    animation: slideUp 0.3s ease;
}

.met-chatbot-widget.open .met-chatbot-window {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.met-chatbot-header {
    background: linear-gradient(135deg, var(--met-secondary) 0%, var(--met-primary) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.met-chatbot-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px 24px;
}

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

.met-chatbot-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.met-chatbot-avatar i {
    font-size: 20px;
}

.met-chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.met-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.met-chatbot-status i {
    font-size: 8px;
    color: #4ade80;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.met-chatbot-minimize {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.met-chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
}

.met-chatbot-minimize svg {
    width: 20px;
    height: 20px;
}

/* Área de mensajes */
.met-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--met-bg-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.met-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.met-chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--met-border);
    border-radius: 3px;
}

/* Mensaje */
.met-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

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

.met-message.bot {
    align-items: flex-start;
}

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

.met-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.met-message-avatar i {
    font-size: 16px;
}

.met-message.user .met-message-avatar {
    background: linear-gradient(135deg, var(--met-secondary) 0%, #2a3f5a 100%);
}

.met-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.met-message.bot .met-message-content {
    background: white;
    color: var(--met-text);
    border-bottom-left-radius: 4px;
}

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

/* Typing indicator */
.met-typing {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.met-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--met-text-light);
    animation: typing 1.4s infinite;
}

.met-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.met-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Área de input */
.met-chatbot-input-area {
    background: white;
    border-top: 1px solid var(--met-border);
    padding: 16px;
}

/* Opciones (botones) */
.met-chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.met-option-button {
    background: white;
    border: 2px solid var(--met-primary);
    color: var(--met-primary);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
}

.met-option-button:hover {
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    color: white;
    transform: translateX(6px);
    box-shadow: 0 4px 12px var(--met-shadow);
    border-color: var(--met-primary);
}

.met-option-button i {
    font-size: 16px;
}

/* Input de texto */
.met-chatbot-text-input {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.met-chatbot-input {
    flex: 1;
    padding: 16px 18px;
    border: 2px solid var(--met-border);
    border-radius: 16px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif !important;
    outline: none;
    transition: all 0.3s ease;
    background: var(--met-bg-light);
    resize: none;
    min-height: 50px;
    max-height: 120px;
    line-height: 1.4;
}

.met-chatbot-input:focus {
    border-color: var(--met-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(232, 106, 28, 0.1);
}

.met-chatbot-input::placeholder {
    color: var(--met-text-light);
    opacity: 0.8;
}

.met-chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px var(--met-shadow);
}

.met-chatbot-send:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 12px var(--met-shadow);
}

.met-chatbot-send i {
    font-size: 16px;
}

/* Footer */
.met-chatbot-footer {
    background: var(--met-bg-light);
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid var(--met-border);
}

.met-chatbot-footer small {
    font-size: 11px;
    color: var(--met-text-light);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.met-chatbot-footer a {
    color: var(--met-primary);
    text-decoration: none;
}

.met-chatbot-footer a:hover {
    text-decoration: underline;
}

/* Estilos para mensajes con formulario embebido */
.met-message-form .met-message-content {
    max-width: 95%;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.met-form-content {
    width: 100%;
}

/* Estilos para el formulario de reservas embebido */
.met-form-content .chbs-main {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

.met-form-content form {
    margin: 0;
}

.met-form-content input,
.met-form-content select,
.met-form-content textarea {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

.met-form-content button[type="submit"] {
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    border: none;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.met-form-content button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--met-shadow);
}

/* Fallback cuando el plugin no está activo */
.met-booking-form-fallback {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.met-booking-form-fallback p {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.6;
}

.met-booking-form-fallback strong {
    color: var(--met-text);
    font-weight: 600;
}

.met-booking-link {
    display: inline-block;
    background: linear-gradient(135deg, var(--met-primary) 0%, var(--met-primary-dark) 100%);
    color: white !important;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.met-booking-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--met-shadow);
    text-decoration: none;
}

/* Ajustes para formularios largos */
.met-message-form {
    max-width: 100%;
}

.met-chatbot-messages .met-message-form .met-message-content {
    max-width: 100%;
}

/* ========================================
   LANGUAGE SELECTOR
   ======================================== */


.met-language-selector-wrapper {
    padding: 0 20px 12px 20px;
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.met-language-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 6px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.met-lang-btn {
    background: transparent;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 9px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 52px;
}

.met-lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.met-lang-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.met-flag {
    display: inline-block;
    width: 22px;
    height: 16px;
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.met-flag-es {
    background-image: url('https://flagcdn.com/w40/es.png');
}

.met-flag-de {
    background-image: url('https://flagcdn.com/w40/de.png');
}

.met-flag-en {
    background-image: url('https://flagcdn.com/w40/gb.png');
}

.met-lang-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: white;
    opacity: 0.85;
}

/* Responsive */
@media (max-width: 480px) {
    .met-chatbot-widget {
        position: fixed !important; /* Ensure chatbot widget remains positioned over content even when other styles set it to static */
        bottom: 10px;
        right: 10px;
    }
    
    .met-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }
    
    .met-chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .met-booking-form-fallback {
        padding: 16px;
    }
    
    .met-booking-link {
        display: block;
        text-align: center;
    }
    
    /* Ajustar selector de idioma en móvil */
    .met-language-selector {
        gap: 5px;
        padding: 4px;
    }
    
    .met-lang-btn {
        padding: 5px 7px;
        min-width: 48px;
    }
    
    .met-flag {
        font-size: 18px;
    }
    
    .met-lang-label {
        font-size: 8px;
    }
}
