/* =========================================================================
   Flux Hosted Fields — Styled to match flux-input component
   Colors driven by CSS variables set from WooCommerce admin:
     --flux-accent       (focus border)
     --flux-accent-ring  (focus shadow)
     --flux-btn-bg       (button background)
   ========================================================================= */

/* --- Labels ------------------------------------------------------------ */

.flux-hosted-fields-form label,
.flux-hf-modal-body label {
    display: block;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #667085;
    margin-bottom: 4px;
}

/* --- Field Containers (iframe wrappers — matches flux-input-wrapper) ---- */

.flux-hf-field-container {
    position: relative;
    background: #f9fafb;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px 14px;
    height: 50px;
    cursor: text;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.flux-hf-field-container:hover {
    background: #f4f5f7;
}

.flux-hf-field-container.focused {
    background: #fff;
    border-color: var(--flux-accent, #0f9a7b);
    box-shadow: 0 0 0 2px var(--flux-accent-ring, rgba(15, 154, 123, 0.08));
}

.flux-hf-field-container.invalid {
    background: #fff;
    border-color: #f04438;
    box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.06);
}

.flux-hf-field-container.valid {
    /* No green border — matches flux-input (only border on focus/error) */
    border-color: transparent;
}

/* --- Layout ------------------------------------------------------------ */

.flux-hf-row {
    margin-bottom: 16px;
}

.flux-hf-row-split {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.flux-hf-row-split > .flux-hf-field {
    flex: 1;
}

.flux-hf-section-title {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #8993a4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 12px 0;
}

.flux-hf-section-title:first-child {
    margin-top: 0;
}

/* --- Errors ------------------------------------------------------------ */

.flux-hf-error {
    color: #f04438;
    font-size: 12px;
    margin-top: 4px;
    min-height: 0;
}

.flux-hf-optional {
    font-weight: 400;
    color: #8993a4;
}

/* =========================================================================
   Address Suggestions Dropdown
   ========================================================================= */

.flux-hf-address-wrapper {
    position: relative;
}

.flux-hf-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    display: none;
    max-height: 250px;
    overflow-y: auto;
}

.flux-hf-suggestions-dropdown.visible {
    display: block;
}

.flux-hf-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f2f4f7;
    transition: background 0.1s;
}

.flux-hf-suggestion-item:last-child {
    border-bottom: none;
}

.flux-hf-suggestion-item:hover {
    background: #f9fafb;
}

.flux-hf-suggestion-main {
    font-size: 14px;
    color: #1a1d21;
    font-weight: 500;
}

.flux-hf-suggestion-secondary {
    font-size: 12px;
    color: #8993a4;
    margin-top: 2px;
}

/* =========================================================================
   Auth Status & Error Messages
   ========================================================================= */

.flux-hf-auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    font-size: 13px;
    margin-top: 16px;
}

.flux-hf-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #bbf7d0;
    border-top-color: #15803d;
    border-radius: 50%;
    animation: flux-hf-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes flux-hf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.flux-hf-error-msg {
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 12px;
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
    font-size: 13px;
}

/* =========================================================================
   Modal Overlay
   ========================================================================= */

.flux-hf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.flux-hf-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.flux-hf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f2f4f7;
}

.flux-hf-modal-title {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #1a1d21;
}

.flux-hf-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #8993a4;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.flux-hf-modal-close:hover {
    color: #1a1d21;
}

.flux-hf-modal-body {
    padding: 20px;
}

.flux-hf-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #f2f4f7;
}

.flux-hf-modal-pay-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 0;
    background: var(--flux-btn-bg, #023857);
    color: #fff;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.flux-hf-modal-pay-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.flux-hf-modal-pay-btn:disabled {
    background: #d0d5dd;
    cursor: not-allowed;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 480px) {
    .flux-hf-row-split {
        flex-direction: column;
        gap: 0;
    }

    .flux-hf-row-split > .flux-hf-field {
        margin-bottom: 16px;
    }

    .flux-hf-modal {
        max-width: 100%;
        border-radius: 10px;
    }

    .flux-hf-field-container {
        height: 54px;
        border-radius: 10px;
    }
}
