/* ========================================
   WIDGET DE WHATSAPP FLOTANTE
   Estilo basado en leadconnectorhq widget
   ======================================== */

/* Variables CSS */
:root {
    --chat-widget-active-color: #039855;
    --chat-widget-bubble-color: #039855;
    --chat-widget-primary-color: #039855;
    --chat-widget-header-color: #05603A;
    --chat-widget-header-darken-color: #002d07;
    --chat-widget-button-color: #039855;
    --chat-widget-background-color: #ffffff;
    --chat-widget-avatar-background-color: #ffffff;
    --chat-widget-avatar-border-color: #039855;
    --chat-widget-received-message-color: #F2F4F7;
    --chat-widget-sender-message-color: #039855;
    --chat-widget-sender-message-text-color: #ffffff;
    --chat-widget-received-message-text-color: #111828;
    --chat-widget-header-message-text-color: #ffffff;
    --chat-widget-welcome-message-text-color: #344054;
    --chat-widget-font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --gradient-accent: linear-gradient(135deg, #ff00d4 0%, #00d9ff 50%, #00ff88 100%);
}

/* Contenedor principal del widget */
.lc_text-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    font-family: var(--chat-widget-font-family);
}

/* Botón flotante circular */
.lc_text-widget--bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--chat-widget-bubble-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1001;
}

.lc_text-widget--bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 0px 20px rgba(255, 255, 255, 0.4);
}

.lc_text-widget--bubble:active {
    transform: scale(0.95);
}

.lc_text-widget--bubble .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.lc_text-widget--bubble svg {
    width: 26px;
    height: 26px;
}

/* Contenedor del widget (formulario) */
.lc_text-widget--box {
    position: absolute;
    right: 0;
    bottom: 80px;
    width: 340px;
    max-height: 625px;
    background-color: var(--chat-widget-background-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.lc_text-widget--box.active {
    display: flex;
}

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

/* Header del widget */
.lc_text-widget_heading--root {
    background: linear-gradient(to right, #002d07 0%, #05603a 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.header-circular-image-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: #020b32;
    padding: 4px;
}

.header-circular-image-container img {
    width: calc(130% - 8px);
    height: calc(130% - 8px);
    object-fit: cover;
    border-radius: 50%;
}

.lc_text-widget_heading--content {
    flex: 1;
}

.lc_text-widget_heading--content div[role="heading"] {
    color: var(--chat-widget-header-message-text-color);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.lc_text-widget_heading_close--btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-widget-header-message-text-color);
    transition: transform 0.2s ease;
}

.lc_text-widget_heading_close--btn:hover {
    transform: rotate(180deg);
}

.lc_text-widget_heading_close--btn svg {
    width: 20px;
    height: 20px;
}

/* Contenedor del formulario */
.lc_text-widget--formContainer {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(625px - 180px);
    overflow-y: auto;
    background-color: #ffffff;
}

/* Sub-heading */
.lc_text-widget_sub-heading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 0;
    padding: 10px;
    background-color: #F2F4F7;
    border-radius: 12px;
}

.sub-heading-icon-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background-color: #020b32;
    padding: 4px;
}

.sub-heading-logo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.lc_text-widget_sub-heading--root {
    flex: 1;
}

.lc_text-widget_sub-heading--root div {
    color: var(--chat-widget-welcome-message-text-color);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* Formulario */
.lc_text-widget--form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lc_text-widget--text-input {
    position: relative;
    margin-bottom: 10px;
}

.lc_text-widget--text-input:last-of-type {
    margin-bottom: 0;
}

.phone-input-container {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.country-selector-wrapper {
    display: flex;
    align-items: center;
}

.country-selector-wrapper {
    position: relative;
}

.country-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 12px 12px 16px;
    border: 1px solid #E5E7EB;
    border-right: none;
    border-radius: 8px 0 0 8px;
    background-color: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease;
    position: relative;
    z-index: 10;
}

.country-selector:hover {
    border-color: var(--chat-widget-primary-color);
}

.country-selector.active {
    border-color: var(--chat-widget-primary-color);
}

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    max-height: 300px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
    margin-top: 4px;
}

.country-dropdown::-webkit-scrollbar {
    width: 6px;
}

.country-dropdown::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 3px;
}

.country-dropdown::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.country-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

.country-dropdown.active {
    display: block;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #F3F4F6;
}

.country-option:last-child {
    border-bottom: none;
}

.country-option:hover {
    background-color: #F9FAFB;
}

.country-option .country-flag {
    width: 20px;
    height: 15px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.country-option .country-flag .fi {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}

.country-option-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.country-option-code {
    font-size: 14px;
    font-weight: 600;
    color: #111828;
}

.country-option-name {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 15px;
    flex-shrink: 0;
}

.country-flag .fi {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}

.country-code {
    font-size: 14px;
    color: #111828;
    font-weight: 500;
    min-width: 35px;
}

.country-arrow {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.phone-input {
    border-radius: 0 8px 8px 0 !important;
    border-left: none !important;
    padding-left: 12px !important;
}

.phone-input:focus {
    border-left: 1px solid var(--chat-widget-primary-color) !important;
}

.phone-input-container:focus-within .country-selector {
    border-color: var(--chat-widget-primary-color);
}

.lc_text-widget--text-input-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--chat-widget-font-family);
    color: #111828;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.lc_text-widget--text-input-input:focus {
    outline: none;
    border-color: var(--chat-widget-primary-color);
    box-shadow: 0 0 0 3px rgba(3, 152, 85, 0.1);
}

.lc_text-widget--text-input-input::placeholder {
    color: #9CA3AF;
}

.lc_text-widget--text-input-input.error {
    border-color: #DC2626;
    color: #DC2626;
}

.lc_text-widget--text-input-input.error::placeholder {
    color: #DC2626;
}

.lc_text-widget--text-input-input.error:focus {
    border-color: #DC2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.lc_text-widget--text-input textarea {
    resize: vertical;
    min-height: 80px;
    font-family: var(--chat-widget-font-family);
}

/* Checkbox de términos y condiciones */
.lc_legal-text {
    margin-top: 2px;
    margin-bottom: 2px;
}

.lc_checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.lc_checkbox {
    display: none;
}

.lc_checkbox-custom {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--chat-widget-primary-color);
    border-radius: 4px;
    background-color: #ffffff;
    position: relative;
    margin-top: 2px;
    transition: all 0.2s ease;
}

.lc_checkbox:checked + .lc_checkbox-custom {
    background-color: var(--chat-widget-primary-color);
    border-color: var(--chat-widget-primary-color);
}

.lc_checkbox:checked + .lc_checkbox-custom::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.lc_legal-msg {
    color: var(--chat-widget-welcome-message-text-color);
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

/* Botón de envío */
.lc_send_button--container {
    margin-top: 2px;
}

.btn-whatsapp {
    width: 100%;
    background-color: var(--chat-widget-button-color);
    color: var(--chat-widget-sender-message-text-color);
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-whatsapp:hover {
    background-color: var(--chat-widget-header-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 152, 85, 0.3);
}

.btn-whatsapp:active {
    transform: translateY(0);
}

.btn-whatsapp:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.btn-whatsapp:disabled:hover {
    background-color: #9CA3AF;
    transform: none;
    box-shadow: none;
}

.send-cta-root {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.send-cta-root span {
    color: #ffffff;
    font-weight: 600;
}

.send-cta-root svg {
    width: 18px;
    height: 16px;
}

.send-cta-root svg path {
    stroke: #ffffff;
}

/* Footer branding */
.lc_text-widget--agency-branding {
    background-color: #ffffff;
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #E5E7EB
}

.lc_text-widget--agency-branding-inner {
    color: var(--chat-widget-welcome-message-text-color);
    font-size: 11px;
    margin-bottom: 4px;
}

.lc_text-widget--agency-branding a {
    color: var(--chat-widget-primary-color);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.lc_text-widget--agency-branding a:hover {
    color: var(--chat-widget-header-color);
    text-decoration: underline;
}

/* Imágenes circulares */
.circular-image {
    border-radius: 50%;
    object-fit: cover;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .lc_text-widget {
        right: 15px;
        bottom: 15px;
    }

    .lc_text-widget--bubble {
        width: 56px;
        height: 56px;
    }

    .lc_text-widget--box {
        width: calc(100vw - 30px);
        max-width: 340px;
        right: 0;
        bottom: 76px;
    }
}

/* Animación de pulso para el botón - removida, sin box-shadow */

/* Scrollbar personalizado para el contenedor del formulario */
.lc_text-widget--formContainer::-webkit-scrollbar {
    width: 6px;
}

.lc_text-widget--formContainer::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 3px;
}

.lc_text-widget--formContainer::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.lc_text-widget--formContainer::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}
