/* ===========================
   HOSTING506 CONTACT WIDGET - FRONTEND STYLES
   =========================== */

/* Variables CSS */
:root {
    --h506cw-bubble-size: 60px;
    --h506cw-panel-width: 320px;
    --h506cw-spacing: 20px;
    --h506cw-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --h506cw-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    --h506cw-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* Reset y estilos base del widget */
.h506cw-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.h506cw-widget {
    position: fixed;
    bottom: var(--h506cw-spacing);
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.h506cw-widget.h506cw-position-left {
    left: var(--h506cw-spacing);
}

.h506cw-widget.h506cw-position-right {
    right: var(--h506cw-spacing);
}

/* Burbuja Principal */
.h506cw-bubble {
    width: var(--h506cw-bubble-size);
    height: var(--h506cw-bubble-size);
    border-radius: 50%;
    background-color: #2563eb;
    box-shadow: var(--h506cw-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--h506cw-transition);
    animation: h506cw-pulse 2s ease-in-out infinite;
}

.h506cw-bubble:hover {
    transform: scale(1.1);
    box-shadow: var(--h506cw-shadow-lg);
}

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

/* Animación de pulso sutil */
@keyframes h506cw-pulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

.h506cw-widget.h506cw-active .h506cw-bubble {
    animation: none;
    transform: rotate(90deg);
}

/* Icono de la burbuja */
.h506cw-bubble-icon {
    color: white;
    font-size: 28px;
    transition: var(--h506cw-transition);
    opacity: 1;
    position: absolute;
}

.h506cw-bubble .h506cw-close-icon {
    position: absolute;
    color: white;
    font-size: 30px;
    font-weight: 700;
    opacity: 0;
    transition: var(--h506cw-transition);
    transform: scale(0) rotate(-90deg);
}

.h506cw-widget.h506cw-active .h506cw-bubble .h506cw-bubble-icon {
    opacity: 0;
    transform: scale(0) rotate(90deg);
}

.h506cw-widget.h506cw-active .h506cw-bubble .h506cw-close-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Panel de Opciones */
.h506cw-panel {
    position: absolute;
    bottom: calc(var(--h506cw-bubble-size) + 15px);
    background: white;
    border-radius: 16px;
    box-shadow: var(--h506cw-shadow-lg);
    width: var(--h506cw-panel-width);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--h506cw-transition);
    pointer-events: none;
}

.h506cw-widget.h506cw-position-left .h506cw-panel {
    left: 0;
}

.h506cw-widget.h506cw-position-right .h506cw-panel {
    right: 0;
}

.h506cw-widget.h506cw-active .h506cw-panel {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.h506cw-panel-inner {
    padding: 8px;
}

/* Opciones del Panel */
.h506cw-option {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    margin: 4px 0;
    border-radius: 10px;
    background: var(--h506cw-button-bg-color, #f8fafc);
    color: #333;
    text-decoration: none !important;
    transition: var(--h506cw-transition);
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.h506cw-option:focus,
.h506cw-option:visited,
.h506cw-option:active {
    text-decoration: none !important;
    color: #333;
}

.h506cw-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.h506cw-option:hover::before {
    left: 100%;
}

.h506cw-option:hover {
    background: var(--h506cw-button-hover-bg-color, #e2e8f0);
    border-color: #e2e8f0;
    transform: translateX(4px);
}

.h506cw-option:active {
    transform: scale(0.98);
}

.h506cw-option i {
    font-size: var(--h506cw-icon-size, 22px);
    margin-right: 14px;
    color: var(--h506cw-icon-color, #64748b);
    transition: var(--h506cw-transition);
    min-width: 24px;
    text-align: center;
}

.h506cw-option:hover i {
    color: var(--h506cw-icon-hover-color, #2563eb) !important;
    transform: scale(1.1);
}

.h506cw-option-label {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
}

/* Animación de entrada escalonada */
.h506cw-widget.h506cw-active .h506cw-option {
    animation: h506cw-slideIn 0.4s ease-out backwards;
}

.h506cw-widget.h506cw-active .h506cw-option:nth-child(1) { animation-delay: 0.05s; }
.h506cw-widget.h506cw-active .h506cw-option:nth-child(2) { animation-delay: 0.1s; }
.h506cw-widget.h506cw-active .h506cw-option:nth-child(3) { animation-delay: 0.15s; }
.h506cw-widget.h506cw-active .h506cw-option:nth-child(4) { animation-delay: 0.2s; }
.h506cw-widget.h506cw-active .h506cw-option:nth-child(5) { animation-delay: 0.25s; }
.h506cw-widget.h506cw-active .h506cw-option:nth-child(6) { animation-delay: 0.3s; }

@keyframes h506cw-slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Contenedor de Búsqueda */
.h506cw-search-container {
    position: absolute;
    bottom: 0;
    background: white;
    border-radius: 16px;
    box-shadow: var(--h506cw-shadow-lg);
    width: var(--h506cw-panel-width);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--h506cw-transition);
    pointer-events: none;
}

.h506cw-widget.h506cw-position-left .h506cw-search-container {
    left: 0;
}

.h506cw-widget.h506cw-position-right .h506cw-search-container {
    right: 0;
}

.h506cw-widget.h506cw-search-active .h506cw-search-container {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.h506cw-widget.h506cw-search-active .h506cw-panel {
    display: none;
}

/* Header de Búsqueda */
.h506cw-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.h506cw-search-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.h506cw-search-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--h506cw-transition);
}

.h506cw-search-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Input de Búsqueda */
.h506cw-search-input-wrapper {
    position: relative;
    padding: 16px 20px;
}

.h506cw-search-input {
    width: 100%;
    padding: 12px 40px 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: var(--h506cw-transition);
    outline: none;
    font-family: inherit;
}

.h506cw-search-input:focus {
    border-color: var(--h506cw-primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.h506cw-search-input-wrapper .h506cw-icon {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #94a3b8;
    pointer-events: none;
}

.h506cw-search-input-wrapper i {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #94a3b8;
    pointer-events: none;
}

/* Resultados de Búsqueda */
.h506cw-search-results {
    max-height: 340px;
    overflow-y: auto;
    padding: 0 12px 12px;
}

.h506cw-search-results::-webkit-scrollbar {
    width: 6px;
}

.h506cw-search-results::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.h506cw-search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.h506cw-search-results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.h506cw-search-result-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
    transition: var(--h506cw-transition);
    cursor: pointer;
    text-decoration: none !important;
    display: block;
    color: inherit;
}

.h506cw-search-result-item:hover {
    background: #e2e8f0;
    transform: translateX(4px);
    text-decoration: none !important;
}

.h506cw-search-result-item:focus,
.h506cw-search-result-item:visited,
.h506cw-search-result-item:active {
    text-decoration: none !important;
    color: inherit;
}

.h506cw-search-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.h506cw-search-result-excerpt {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.h506cw-search-no-results,
.h506cw-search-loading {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.h506cw-search-loading::after {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    margin: 16px auto 0;
    border: 3px solid #e2e8f0;
    border-top-color: var(--h506cw-primary-color, #2563eb);
    border-radius: 50%;
    animation: h506cw-spin 0.8s linear infinite;
}

@keyframes h506cw-spin {
    to { transform: rotate(360deg); }
}

/* Responsivo con Font Awesome */
@media screen and (max-width: 480px) {
    .h506cw-option i {
        font-size: 20px;
        min-width: 22px;
    }
    
    .h506cw-bubble-icon {
        font-size: 24px !important;
    }
}

/* Responsive */
@media screen and (max-width: 480px) {
    :root {
        --h506cw-panel-width: calc(100vw - 40px);
        --h506cw-spacing: 15px;
        --h506cw-bubble-size: 55px;
    }
    
    .h506cw-panel,
    .h506cw-search-container {
        max-width: calc(100vw - 30px);
    }
}

/* Accesibilidad */
.h506cw-option:focus,
.h506cw-bubble:focus,
.h506cw-search-close:focus,
.h506cw-search-input:focus {
    outline: 2px solid var(--h506cw-primary-color, #2563eb);
    outline-offset: 2px;
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    .h506cw-panel,
    .h506cw-search-container {
        background: #1e293b;
    }
    
    .h506cw-option {
        background: #1e293b;
        color: #e2e8f0;
    }
    
    .h506cw-option:hover {
        background: #334155;
        border-color: #475569;
    }
    
    .h506cw-option-label,
    .h506cw-search-header h3,
    .h506cw-search-result-title {
        color: #e2e8f0;
    }
    
    .h506cw-search-input {
        background: #334155;
        border-color: #475569;
        color: #e2e8f0;
    }
    
    .h506cw-search-result-item {
        background: #334155;
    }
    
    .h506cw-search-result-item:hover {
        background: #475569;
    }
}
