/**
 * ISEP Floating Contact Form - Estilos v4.3
 * Panel abre hacia ARRIBA para no salirse de pantalla
 */

/* ============================================
   OCULTAR CAMPO PAÍS (countrytext) - FORZADO
   ============================================ */
.isep-floating-content .wpcf7-countrytext,
.isep-floating-content span[data-name="pais"],
.isep-floating-content .wpcf7-form-control-wrap[data-name="pais"],
.isep-floating-content label[for="pais"],
.isep-floating-content .col-12:has(#pais),
.isep-floating-content .col-12:has(.wpcf7-countrytext) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   OCULTAR CAMPOS HIDDEN Y HONEYPOT
   ============================================ */
.isep-floating-content .hidden-fields-container,
.isep-floating-content [class*="hidden-field"],
.isep-floating-content .wpcf7-form-control-wrap[data-name="website"],
.isep-floating-content input[name="website"],
.isep-floating-content .wpcf7-honeypot,
.isep-floating-content input[name="curso"],
.isep-floating-content input[name="url"],
.isep-floating-content input[name="selected-dial-code"],
.isep-floating-content input[name="pais"][type="hidden"],
.isep-floating-content input[type="hidden"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
}

/* ============================================
   CONTENEDOR PRINCIPAL - ABAJO A LA DERECHA
   ============================================ */
.isep-floating-form {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================
   BOTÓN TOGGLE CON MENSAJE HORIZONTAL
   ============================================ */
.isep-floating-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.isep-message-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    padding: 10px 14px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    animation: pulseMessage 2s ease-in-out infinite;
}

@keyframes pulseMessage {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.isep-toggle-message {
    color: white;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.isep-toggle-arrow {
    font-size: 18px;
    animation: bounceArrowRight 1s ease-in-out infinite;
}

@keyframes bounceArrowRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

.isep-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5);
    transition: all 0.3s ease;
    position: relative;
}

.isep-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

.isep-toggle-btn.emphasize {
    animation: emphasisPulse 0.8s ease-in-out;
}

@keyframes emphasisPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5); }
    50% { transform: scale(1.2); box-shadow: 0 8px 30px rgba(37, 211, 102, 0.8); }
}

.isep-toggle-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.isep-floating-toggle.active .isep-message-wrapper {
    display: none;
}

/* ============================================
   PANEL DEL FORMULARIO - ABRE HACIA ARRIBA
   ============================================ */
.isep-floating-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 380px;
    max-height: 0;
    overflow: hidden;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(10px);
}

.isep-floating-panel.active {
    max-height: calc(100vh - 100px);
    opacity: 1;
    transform: translateY(0);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Barra de scroll personalizada */
.isep-floating-panel::-webkit-scrollbar {
    width: 8px;
}

.isep-floating-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 20px 20px 0;
}

.isep-floating-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.isep-floating-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* Header del panel */
.isep-floating-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.isep-floating-header h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.isep-floating-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    font-size: 16px;
}

.isep-floating-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Contenido del formulario */
.isep-floating-content {
    padding: 15px;
}

/* ============================================
   ESTILOS DEL FORMULARIO CF7 - COMPACTO
   ============================================ */
.isep-floating-content .wpcf7-form {
    margin: 0;
}

.isep-floating-content .row {
    margin: 0 -6px;
}

.isep-floating-content .col-12,
.isep-floating-content .col-lg-6 {
    padding: 0 6px;
    margin-bottom: 10px;
}

.isep-floating-content .form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 3px;
}

.isep-floating-content .form-control {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.isep-floating-content .form-control:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Selector de teléfono con bandera */
.isep-floating-content .intl-tel-input,
.isep-floating-content .iti {
    width: 100%;
}

.isep-floating-content .intl-tel-input .form-control,
.isep-floating-content .iti .form-control {
    padding-left: 85px !important;
}

.isep-floating-content .flag-container,
.isep-floating-content .iti__flag-container {
    padding: 0 6px;
}

.isep-floating-content .selected-dial-code {
    font-size: 13px;
    color: #374151;
}

/* Radio buttons */
.isep-floating-content .wpcf7-radio {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.isep-floating-content .wpcf7-list-item {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.isep-floating-content .wpcf7-list-item input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.isep-floating-content .wpcf7-list-item-label {
    font-size: 13px;
    color: #374151;
}

/* Checkbox de aceptación */
.isep-floating-content .wpcf7-acceptance {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
}

.isep-floating-content .wpcf7-acceptance input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    accent-color: #667eea;
}

.isep-floating-content .wpcf7-acceptance a {
    color: #667eea;
    text-decoration: underline;
}

/* Botón de envío */
.isep-floating-content .btn-primary,
.isep-floating-content .wpcf7-submit {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
}

.isep-floating-content .btn-primary:hover,
.isep-floating-content .wpcf7-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Mensajes de respuesta */
.isep-floating-content .wpcf7-response-output {
    margin: 10px 0 0 0;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
}

/* Texto pequeño */
.isep-floating-content .small {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 10px;
}

.isep-floating-content .text-danger {
    color: #dc3545;
}

/* Spinner de carga */
.isep-floating-content .wpcf7-spinner {
    display: none;
}

/* Select dropdowns */
.isep-floating-content select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 18px;
    padding-right: 35px;
}

/* Grupos condicionales */
.isep-floating-content .wpcf7-conditional-group {
    display: none;
}

.isep-floating-content .wpcf7-conditional-group.active {
    display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .isep-floating-form {
        right: 10px;
        bottom: 10px;
    }
    
    .isep-floating-panel {
        width: calc(100vw - 20px);
        right: -10px;
        max-height: calc(100vh - 80px);
    }
    
    .isep-message-wrapper {
        display: none;
    }
    
    .isep-toggle-btn {
        width: 55px;
        height: 55px;
    }
}
