/**
 * WPBee Honey Leads - Frontend Forms CSS
 * 
 * Styles for modal windows and form display
 */

/* Modal Overlay */
.wbhl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wbhl-modal-overlay.show {
    opacity: 1;
}

/* Modal Container */
.wbhl-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.wbhl-modal-overlay.show .wbhl-modal {
    transform: scale(1);
}

/* Modal Header */
.wbhl-modal-header {
    padding: 20px 20px 0;
    border-bottom: 1px solid #eee;
    /* Align title and close button on one row */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wbhl-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.wbhl-modal-header p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

/* Subtitle below header (moved out of header for clean layout) */
.wbhl-form-subtitle {
    margin: 8px 0 16px 0;
    color: #666;
    font-size: 14px;
}

/* Ensure close button is correctly positioned when inside modal header */
.wbhl-modal-header .wbhl-modal-close {
    position: static;
    top: auto;
    right: auto;
    margin-left: auto;
    font-size: 28px;
    line-height: 1;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

/* Modal Body */
.wbhl-modal-body {
    padding: 20px;
}

/* Close Button */
.wbhl-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

/* When close button is moved into header, reset positioning and push to right */
.wbhl-modal-close--in-header {
    position: static;
    top: auto;
    right: auto;
    margin-left: auto; /* push to right edge in flex row */
    font-size: 28px; /* slightly smaller fits header line */
}

.wbhl-modal-close:hover {
    color: #333;
}

/* Form Styles */
.wbhl-form {
    /* Reset some default styles */
    margin: 0;
    padding: 0;
}

.wbhl-form-header {
    margin-bottom: 20px;
    /* Align title and close button on one row */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wbhl-form-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.wbhl-form-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Form Fields */
.wbhl-form-fields {
    margin-bottom: 20px;
}

.wbhl-form-field {
    margin-bottom: 15px;
}

.wbhl-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wbhl-form-field label .required {
    color: #d63638;
}

.wbhl-form-field input[type="text"],
.wbhl-form-field input[type="email"],
.wbhl-form-field input[type="number"],
.wbhl-form-field input[type="date"],
.wbhl-form-field textarea,
.wbhl-form-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.wbhl-form-field input:focus,
.wbhl-form-field textarea:focus,
.wbhl-form-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Textarea specific */
.wbhl-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Radio and Checkbox fields */
.wbhl-form-field fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.wbhl-form-field legend {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.wbhl-radio-label,
.wbhl-checkbox-label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
    cursor: pointer;
    font-size: 14px;
}

.wbhl-radio-label input,
.wbhl-checkbox-label input {
    margin-right: 8px;
    cursor: pointer;
}

/* Submit Button */
.wbhl-form-footer {
    text-align: right;
}

.wbhl-submit-btn {
    background: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s;
    width: 100%;
}

.wbhl-submit-btn:hover {
    background: #005a87;
}

.wbhl-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.wbhl-form.wbhl-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wbhl-form.wbhl-loading .wbhl-submit-btn:after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: wbhl-spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes wbhl-spin {
    to { transform: rotate(360deg); }
}

/* Preloader */
.wbhl-preloader {
    text-align: center;
    padding: 60px 20px;
}

.wbhl-preloader-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: wbhl-spin 1s linear infinite;
    margin-bottom: 20px;
}

.wbhl-preloader p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* Messages */
.wbhl-form-messages {
    margin-top: 15px;
}

.wbhl-success-message,
.wbhl-error-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.wbhl-success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    text-align: center;
    font-size: 16px;
    padding: 30px;
}

/* When form is hidden and only success message is shown */
.wbhl-modal-body .wbhl-success-message:only-child {
    margin: 40px 0;
    font-size: 18px;
}

.wbhl-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Trigger Button (for shortcode) */
.wbhl-trigger-btn {
    background: #0073aa;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.wbhl-trigger-btn:hover {
    background: #005a87;
}

/* Animations */
@keyframes wbhlFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

@keyframes wbhlFadeOut {
    from { 
        opacity: 1; 
        transform: scale(1); 
    }
    to { 
        opacity: 0; 
        transform: scale(0.9); 
    }
}

.wbhl-modal.fade-in {
    animation: wbhlFadeIn 0.3s ease-out;
}

.wbhl-modal.fade-out {
    animation: wbhlFadeOut 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 600px) {
    .wbhl-modal {
        max-width: 95%;
        margin: 10px;
    }
    
    .wbhl-modal-header,
    .wbhl-modal-body {
        padding: 15px;
    }
    
    .wbhl-modal-header h2 {
        font-size: 20px;
    }
    
    .wbhl-submit-btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}

/* Dark mode support removed */

/* Inline form styles */
.wbhl-form.wbhl-inline {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Form validation styles */
.wbhl-form-field.error input,
.wbhl-form-field.error textarea,
.wbhl-form-field.error select {
    border-color: #d63638;
}

.wbhl-form-field .error-message {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
}

/* Custom scrollbar for modal */
.wbhl-modal::-webkit-scrollbar {
    width: 8px;
}

.wbhl-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wbhl-modal::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.wbhl-modal::-webkit-scrollbar-thumb:hover {
    background: #555;
}