/**
 * Frontend Checkout Styles
 * Smart Checkout Fields Manager
 */

/* Custom Field Headings */
.woocommerce-checkout .scfm-heading {
    font-size: 1.2em;
    font-weight: 600;
    margin: 20px 0 10px 0;
    padding: 10px 0;
    border-bottom: 2px solid #e0e0e0;
    color: #333;
}

/* Custom Field Paragraphs */
.woocommerce-checkout .scfm-paragraph {
    margin: 10px 0 15px 0;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #0073aa;
    color: #555;
    line-height: 1.6;
}

/* Checkbox Group Styling */
.woocommerce-checkout .scfm-checkbox-group {
    padding: 5px 0;
}

.woocommerce-checkout .scfm-checkbox-group label {
    display: block;
    margin: 8px 0;
    padding: 5px 0;
    cursor: pointer;
}

.woocommerce-checkout .scfm-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

/* Multiselect Field Styling - Ultra Specific Selectors */
select.scfm-multiselect[multiple],
select[multiple].scfm-multiselect,
.woocommerce-checkout select.scfm-multiselect,
.woocommerce form .form-row select.scfm-multiselect,
.woocommerce-checkout .woocommerce-input-wrapper select.scfm-multiselect,
.woocommerce .woocommerce-input-wrapper select.scfm-multiselect {
    height: auto !important;
    max-height: 200px !important;
    min-height: 120px !important;
    padding: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border: 2px solid #333 !important;
    border-radius: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 15px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif !important;
    line-height: 1.5 !important;
    appearance: listbox !important;
    -webkit-appearance: listbox !important;
    -moz-appearance: listbox !important;
}

select.scfm-multiselect[multiple] option,
.woocommerce-checkout select.scfm-multiselect option,
.woocommerce form .form-row select.scfm-multiselect option,
.woocommerce-checkout .woocommerce-input-wrapper select.scfm-multiselect option {
    padding: 12px 15px !important;
    margin: 0 !important;
    line-height: 1.6 !important;
    color: #000000 !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border: none !important;
    min-height: 40px !important;
    height: auto !important;
    display: block !important;
    cursor: pointer !important;
    font-weight: 400 !important;
    font-size: 15px !important;
    opacity: 1 !important;
    visibility: visible !important;
}

select.scfm-multiselect[multiple] option:checked,
.woocommerce-checkout select.scfm-multiselect option:checked,
.woocommerce form .form-row select.scfm-multiselect option:checked {
    background-color: #0073aa !important;
    background-image: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

select.scfm-multiselect[multiple] option:hover,
.woocommerce-checkout select.scfm-multiselect option:hover,
.woocommerce form .form-row select.scfm-multiselect option:hover {
    background-color: #e8f4f8 !important;
    background-image: none !important;
    color: #000000 !important;
}

select.scfm-multiselect[multiple]:focus,
.woocommerce-checkout select.scfm-multiselect:focus,
.woocommerce form .form-row select.scfm-multiselect:focus {
    border-color: #0073aa !important;
    outline: 2px solid #0073aa !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

/* Date/Time Input Styling */
.woocommerce-checkout input[type="date"],
.woocommerce-checkout input[type="datetime-local"],
.woocommerce-checkout input[type="time"],
.woocommerce-checkout input[type="month"],
.woocommerce-checkout input[type="week"] {
    padding: 8px 12px;
    min-height: 40px;
}

/* Number Input Styling */
.woocommerce-checkout input[type="number"] {
    -moz-appearance: textfield;
}

.woocommerce-checkout input[type="number"]::-webkit-outer-spin-button,
.woocommerce-checkout input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Validation Feedback */
.woocommerce-checkout .scfm-field-valid {
    border-color: #46b450 !important;
}

.woocommerce-checkout .scfm-field-invalid {
    border-color: #dc3232 !important;
}

.woocommerce-checkout .scfm-validation-message {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #dc3232;
}

.woocommerce-checkout .scfm-validation-message.scfm-success {
    color: #46b450;
}

/* Required Field Indicator */
.woocommerce-checkout .scfm-required-indicator {
    color: #dc3232;
    font-weight: bold;
    margin-left: 2px;
}

/* Radio Button Group */
.woocommerce-checkout .scfm-radio-group label {
    display: block;
    margin: 8px 0;
    padding: 8px 0;
    cursor: pointer;
}

.woocommerce-checkout .scfm-radio-group input[type="radio"] {
    margin-right: 8px;
    vertical-align: middle;
}

/* Textarea Enhancement */
.woocommerce-checkout textarea.scfm-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Loading State */
.woocommerce-checkout .scfm-field-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.woocommerce-checkout .scfm-field-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: scfm-spin 1s linear infinite;
}

@keyframes scfm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .woocommerce-checkout .scfm-heading {
        font-size: 1.1em;
        margin: 15px 0 8px 0;
    }
    
    .woocommerce-checkout .scfm-paragraph {
        font-size: 0.95em;
        padding: 8px;
    }
    
    .woocommerce-checkout select[multiple].scfm-multiselect {
        min-height: 100px;
    }
}

/* WooCommerce Theme Compatibility */
.woocommerce-checkout .woocommerce-input-wrapper .scfm-heading,
.woocommerce-checkout .woocommerce-input-wrapper .scfm-paragraph {
    width: 100%;
}

/* Focus States */
.woocommerce-checkout input:focus,
.woocommerce-checkout select:focus,
.woocommerce-checkout textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Disabled State */
.woocommerce-checkout input:disabled,
.woocommerce-checkout select:disabled,
.woocommerce-checkout textarea:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Custom Field Wrapper */
.woocommerce-checkout .scfm-custom-field {
    margin-bottom: 15px;
}

/* Help Text */
.woocommerce-checkout .scfm-help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* Error Shake Animation */
@keyframes scfm-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.woocommerce-checkout .scfm-field-error {
    animation: scfm-shake 0.5s;
}

/* Tooltip Error Style */
.scfm-validation-message.scfm-tooltip {
    position: absolute;
    background: #dc3232;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    top: -40px;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.scfm-validation-message.scfm-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #dc3232;
}

.woocommerce-checkout .form-row {
    position: relative;
}
