/**
 * Export CSV Modal - Estilos
 * 
 * @package HelloElementorChild
 * @since 1.0.0
 */

/* ============================================
   BOTÓN FLOTANTE DE EXPORTACIÓN (igual que botón Atrás)
   ============================================ */

.export-csv-floating-button {
    /* Posicionamiento fijo (igual que admin-leads-floating-back-button) */
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    
    /* Display y alineación */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    
    /* Espaciado */
    padding: 0.875rem 1.25rem !important;
    margin: 0 !important;
    
    /* Fondo y colores (tema verde) */
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    
    /* Bordes */
    border: none !important;
    border-radius: 50px !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
    
    /* Tipografía */
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.5 !important;
    white-space: nowrap !important;
    
    /* Interacción */
    cursor: pointer !important;
    user-select: none !important;
    pointer-events: auto !important;
    
    /* Transiciones */
    transition: all 0.3s ease !important;
    
    /* Z-index (justo debajo del botón Atrás que tiene 999999) */
    z-index: 999998 !important;
    
    /* Visibilidad */
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hover effect */
.export-csv-floating-button:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5) !important;
}

/* Active state */
.export-csv-floating-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}

/* Focus state (accesibilidad) */
.export-csv-floating-button:focus {
    outline: 2px solid #10b981 !important;
    outline-offset: 3px !important;
}

/* SVG icon inside button */
.export-csv-floating-button svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor !important;
    flex-shrink: 0 !important;
}

/* Button text */
.export-csv-floating-button .button-text {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: inherit !important;
}

/* Responsive: ocultar texto en móviles */
@media (max-width: 640px) {
    .export-csv-floating-button .button-text {
        display: none !important;
    }
    
    .export-csv-floating-button {
        padding: 0.75rem !important;
        border-radius: 50% !important;
        width: 48px !important;
        height: 48px !important;
    }
}

/* ============================================
   BOTÓN LEGACY (por compatibilidad)
   ============================================ */

/* Reset completo para evitar interferencias de Elementor/tema */
button.export-csv-button,
.export-csv-button {
    /* Display y posicionamiento */
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    
    /* Dimensiones y espaciado */
    padding: 10px 20px !important;
    margin: 0 0 0 auto !important;
    min-height: auto !important;
    height: auto !important;
    width: auto !important;
    max-width: none !important;
    
    /* Fondo y colores */
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    background-color: #10b981 !important;
    color: #ffffff !important;
    
    /* Bordes */
    border: none !important;
    border-radius: 8px !important;
    outline: none !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
    
    /* Tipografía */
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.5 !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    
    /* Interacción */
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    
    /* Transiciones */
    transition: all 0.3s ease !important;
    
    /* Visibilidad */
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    
    /* Z-index */
    z-index: 100 !important;
    
    /* Flex item */
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* Estados del botón */
button.export-csv-button:hover,
.export-csv-button:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    background-color: #059669 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
    transform: translateY(-2px) !important;
    color: #ffffff !important;
}

button.export-csv-button:active,
.export-csv-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important;
}

button.export-csv-button:focus,
.export-csv-button:focus {
    outline: 2px solid #10b981 !important;
    outline-offset: 2px !important;
}

button.export-csv-button:disabled,
.export-csv-button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background: #9ca3af !important;
    pointer-events: none !important;
}

/* Icono dentro del botón */
button.export-csv-button .btn-icon,
.export-csv-button .btn-icon {
    font-size: 16px !important;
    line-height: 1 !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Contenedor del botón en filters-wrapper */
.dashboard-filters .filters-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
    align-items: center !important;
}

/* Asegurar que el botón se vea en el contenedor de filtros */
.dashboard-filters .export-csv-button {
    margin-left: auto !important;
}

/* Wrapper del botón para admin-leads-wrapper */
.export-csv-button-wrapper {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    padding: 1rem !important;
    margin: 0 0 1rem 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
}

/* Específico para admin-leads-wrapper (estructura oscura) */
.admin-leads-wrapper .export-csv-button-wrapper {
    background: #111a22 !important;
    border-radius: 0.75rem !important;
    border: 1px solid #324d67 !important;
    margin-bottom: 1rem !important;
}

/* Asegurar que el botón dentro del wrapper sea visible */
.export-csv-button-wrapper .export-csv-button {
    flex-shrink: 0 !important;
}

/* ============================================
   OVERLAY DEL MODAL
   ============================================ */
.export-csv-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.export-csv-overlay.closing {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* ============================================
   MODAL PRINCIPAL
   ============================================ */
.export-csv-modal {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    animation: modalSlideIn 0.3s ease forwards;
}

@keyframes modalSlideIn {
    to {
        transform: scale(1);
    }
}

.export-csv-overlay.closing .export-csv-modal {
    animation: modalSlideOut 0.3s ease forwards;
}

@keyframes modalSlideOut {
    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* ============================================
   HEADER DEL MODAL
   ============================================ */
.export-modal-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.export-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.export-modal-title .icon {
    font-size: 24px;
}

.export-modal-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.export-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   BODY DEL MODAL
   ============================================ */
.export-modal-body {
    padding: 24px;
    max-height: calc(90vh - 160px);
    overflow-y: auto;
}

/* ============================================
   OPCIONES DE EXPORTACIÓN
   ============================================ */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #ffffff;
}

.export-option:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateX(4px);
}

.export-option.active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.export-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.export-option.disabled:hover {
    border-color: #e5e7eb;
    background: #f9fafb;
    transform: none;
}

.export-option input[type="radio"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.export-option-content {
    flex: 1;
}

.export-option-label {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    display: block;
}

.export-option-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.export-option-badge {
    display: inline-block;
    background: #3b82f6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ============================================
   INFORMACIÓN DE ESTADO
   ============================================ */
.export-info-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.export-info-box .icon {
    font-size: 20px;
    color: #f59e0b;
}

.export-info-box p {
    margin: 0;
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
}

/* ============================================
   FOOTER DEL MODAL
   ============================================ */
.export-modal-footer {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.export-modal-footer .btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-modal-footer .btn-cancel {
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.export-modal-footer .btn-cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.export-modal-footer .btn-export {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.export-modal-footer .btn-export:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.export-modal-footer .btn-export:active {
    transform: translateY(0);
}

.export-modal-footer .btn-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9ca3af;
    box-shadow: none;
}

/* ============================================
   LOADER DE EXPORTACIÓN
   ============================================ */
.export-progress {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: #eff6ff;
    border-radius: 8px;
}

.export-progress.active {
    display: block;
}

.export-progress-bar {
    width: 100%;
    height: 8px;
    background: #dbeafe;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.export-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.export-progress-text {
    text-align: center;
    font-size: 13px;
    color: #1e40af;
    font-weight: 600;
}

/* ============================================
   MENSAJE DE ÉXITO
   ============================================ */
.export-success {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: #d1fae5;
    border-left: 4px solid #10b981;
    border-radius: 8px;
}

.export-success.active {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.export-success .icon {
    font-size: 24px;
    color: #10b981;
}

.export-success-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #065f46;
    font-weight: 600;
}

.export-success-content small {
    font-size: 12px;
    color: #047857;
}

/* ============================================
   MENSAJE DE ERROR
   ============================================ */
.export-error {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
}

.export-error.active {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.export-error .icon {
    font-size: 24px;
    color: #ef4444;
}

.export-error-content p {
    margin: 0;
    font-size: 14px;
    color: #991b1b;
    font-weight: 600;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .export-csv-modal {
        width: 95%;
        max-height: 95vh;
    }

    .export-modal-header {
        padding: 16px;
    }

    .export-modal-title {
        font-size: 16px;
    }

    .export-modal-body {
        padding: 16px;
    }

    .export-option {
        padding: 12px;
    }

    .export-modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .export-modal-footer .btn {
        width: 100%;
    }
}
