/*!
 * File: wp-content/plugins/smart-cf7-form-selection/assets/css/frontend.css
 * 
 * Smart CF7 Form Selection Buttons - Frontend Styles
 * Fixed form display issues - ensuring forms are visible after AJAX load
 * 
 * Fecha de edición: 2025-07-16 | Versión: 1.0.5 | URL: https://claude.ai
 * 
 * Uses Bootstrap 5 classes and BEM methodology
 * Keeps styling minimal to avoid interfering with existing CF7 forms
 */

/* Smart CF7 Selector Container */
.smart-cf7-selector {
    margin-bottom: 2rem;
    font-family: inherit;
}

/* Header Section */
.smart-cf7-selector__header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.smart-cf7-selector__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--bs-heading-color, #212529);
}

.smart-cf7-selector__description {
    font-size: 1rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0;
    line-height: 1.5;
}

/* Buttons Section */
.smart-cf7-selector__buttons {
    margin-bottom: 1.5rem;
    justify-content: center;
}

.smart-cf7-selector__button {
    position: relative;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    border-radius: var(--bs-border-radius, 0.375rem);
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 3rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.25rem;
}

.smart-cf7-selector__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.smart-cf7-selector__button:active {
    transform: translateY(0);
}

.smart-cf7-selector__button--selected {
    position: relative;
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
}

.smart-cf7-selector__button--selected::after {
    content: "✓";
    position: absolute;
    top: 0;
    right: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: #003655;
    border-radius: 50%;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Button Content Elements */
.smart-cf7-selector__button-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: inherit;
    display: block;
    width: 100%;
}

.smart-cf7-selector__button-address {
    color: inherit;
    opacity: 0.85;
    display: block;
    width: 100%;
    line-height: 1.3;
    margin-top: 0.25rem;
}

.smart-cf7-selector__button-hours {
    font-size: 0.813rem;
    color: inherit;
    opacity: 0.75;
    display: block;
    width: 100%;
    line-height: 1.3;
    margin-top: 0.25rem;
    font-style: italic;
}

/* Form Container - FIXED DISPLAY ISSUES */
.smart-cf7-selector__form-container {
    display: none; /* Initially hidden */
    margin-top: 2rem;
    padding: 0;
    border-radius: var(--bs-border-radius, 0.375rem);
    background: transparent;
    opacity: 1; /* Ensure it's visible when shown */
    visibility: visible; /* Ensure it's visible when shown */
}

.smart-cf7-selector__form-container--active {
    display: block !important; /* Force display when active */
}

.smart-cf7-selector__form-wrapper {
    position: relative;
    min-height: 200px;
    display: block;
    width: 100%;
}

/* Loading State - FIXED VISIBILITY */
.smart-cf7-selector__loading {
    display: none; /* Initially hidden */
    text-align: center;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary-color, #6c757d);
    width: 100%;
}

.smart-cf7-selector__loading--active {
    display: flex !important; /* Force display when active */
}

.smart-cf7-selector__loading p {
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Form Content - FIXED DISPLAY AND OPACITY ISSUES */
.smart-cf7-selector__form-content {
    display: none; /* Initially hidden */
    opacity: 1; /* Remove opacity transition that was causing issues */
    width: 100%;
    visibility: visible;
}

.smart-cf7-selector__form-content--active {
    display: block !important; /* Force display when active */
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure CF7 forms are properly displayed */
.smart-cf7-selector__form-content .wpcf7 {
    max-width: 100%;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.smart-cf7-selector__form-content .wpcf7-form {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Form Actions */
.smart-cf7-selector__form-actions {
    margin-top: 1rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    display: block;
}

.smart-cf7-selector__change-btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Error Messages - Ensure they're visible */
.smart-cf7-selector__error {
    display: block !important;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background-color: var(--bs-danger-bg-subtle, #f8d7da);
    border: 1px solid var(--bs-danger-border-subtle, #f5c2c7);
    border-radius: var(--bs-border-radius, 0.375rem);
    color: var(--bs-danger-text-emphasis, #842029);
}

/* No Locations Message */
.smart-cf7-selector__no-locations {
    text-align: center;
    padding: 2rem;
    color: var(--bs-secondary-color, #6c757d);
    font-style: italic;
    display: block;
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
    .smart-cf7-selector__button {
        min-height: 100px;
    }
    
    .smart-cf7-selector__button-name {
        font-size: 1rem;
    }
    
    .smart-cf7-selector__button-address,
    .smart-cf7-selector__button-hours {
        font-size: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .smart-cf7-selector__button {
        min-height: 80px;
    }
    
    .smart-cf7-selector__button-name {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }
    
    .smart-cf7-selector__button-address {
        font-size: 0.75rem;
    }
    
    .smart-cf7-selector__button-hours {
        font-size: 0.7rem;
    }
    
    .smart-cf7-selector__form-container {
        padding-top: 1.5rem;
        margin-top: 1.5rem;
    }
}

/* Print styles */
@media print {
    .smart-cf7-selector__buttons {
        display: none;
    }
    
    .smart-cf7-selector__form-actions {
        display: none;
    }
    
    .smart-cf7-selector__loading {
        display: none;
    }
}

/* Integration with existing CF7 theme styles */
.smart-cf7-selector__form-content .wpcf7-not-valid-tip {
    display: block;
    color: var(--bs-danger, #dc3545);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.smart-cf7-selector__form-content .wpcf7-validation-errors {
    display: block;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--bs-danger-bg-subtle, #f8d7da);
    border: 1px solid var(--bs-danger-border-subtle, #f5c2c7);
    border-radius: var(--bs-border-radius, 0.375rem);
    color: var(--bs-danger-text-emphasis, #842029);
}

.smart-cf7-selector__form-content .wpcf7-response-output {
    display: block;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--bs-border-radius, 0.375rem);
}

.smart-cf7-selector__form-content .wpcf7-response-output.wpcf7-mail-sent-ok {
    background-color: var(--bs-success-bg-subtle, #d1e7dd);
    border: 1px solid var(--bs-success-border-subtle, #badbcc);
    color: var(--bs-success-text-emphasis, #0f5132);
}

.smart-cf7-selector__form-content .wpcf7-response-output.wpcf7-mail-sent-ng {
    background-color: var(--bs-danger-bg-subtle, #f8d7da);
    border: 1px solid var(--bs-danger-border-subtle, #f5c2c7);
    color: var(--bs-danger-text-emphasis, #842029);
}

.smart-cf7-selector__form-content .wpcf7-response-output.wpcf7-spam-blocked {
    background-color: var(--bs-warning-bg-subtle, #fff3cd);
    border: 1px solid var(--bs-warning-border-subtle, #ffecb5);
    color: var(--bs-warning-text-emphasis, #664d03);
}