/* ═══════════════════════════════════════════════════════════════
   HU Checkout Autofill - autofill.css  v2.0.0
   ═══════════════════════════════════════════════════════════════ */

/* ── City field: hidden by default, revealed with animation ─── */
.form-row.huca-city-hidden {
    overflow: hidden;
    max-height: 0 !important;
    opacity: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
}

.form-row:not(.huca-city-hidden) {
    max-height: 200px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
}

/* ── Geo button wrapper (injected right after postcode field) ── */
.huca-geo-wrap {
    margin: 6px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Geo button ─────────────────────────────────────────────── */
.huca-geo-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 15px;
    background: #ffffff;
    color: #444;
    border: 1.5px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
    line-height: 1.4;
    position: relative;
    user-select: none;
}

.huca-geo-btn:hover:not(:disabled) {
    border-color: #999;
    background: #f5f5f5;
    color: #111;
}

.huca-geo-btn:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Loading state */
.huca-geo-btn.huca-btn-loading {
    border-color: #b0c4de;
    background: #f0f5ff;
    color: #5580aa;
    cursor: wait;
}

/* Success state */
.huca-geo-btn.huca-btn-success {
    border-color: #6dbf8b;
    background: #f0faf4;
    color: #2d7a4f;
}

/* Error state */
.huca-geo-btn.huca-btn-error {
    border-color: #e0a0a0;
    background: #fff5f5;
    color: #b94040;
}

.huca-geo-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ── Spinner (shown inside button while loading) ─────────────── */
.huca-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid #b0c4de;
    border-top-color: #3a6fa8;
    border-radius: 50%;
    animation: huca-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.huca-btn-loading .huca-spinner {
    display: inline-block;
}

@keyframes huca-spin {
    to { transform: rotate(360deg); }
}

/* ── Status text beside the button ─────────────────────────── */
.huca-geo-status {
    font-size: 13px;
    color: #666;
    transition: color 0.2s;
    min-height: 18px;
}

.huca-geo-status.huca-detecting {
    color: #5580aa;
    font-style: italic;
    animation: huca-pulse-text 1.4s ease-in-out infinite;
}

.huca-geo-status.huca-error {
    color: #c0392b;
    font-style: normal;
}

.huca-geo-status.huca-success {
    color: #27ae60;
    font-weight: 500;
    font-style: normal;
}

@keyframes huca-pulse-text {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── Inline message below postcode field ─────────────────────── */
.huca-inline-msg {
    display: block;
    font-size: 12px;
    margin-top: 4px;
    transition: opacity 0.4s ease;
}

.huca-inline-msg.huca-fade-out {
    opacity: 0;
}

.huca-msg-success { color: #27ae60; }
.huca-msg-warn    { color: #e08c00; }
.huca-msg-error   { color: #c0392b; }

/* ── Country lock (when "Restrict to Hungary Only" is enabled) ── */

/* Block interaction on the native select */
.huca-country-locked {
    pointer-events: none !important;
    cursor: default !important;
}

/* Lock & dim the Select2 dropdown WooCommerce renders */
.huca-s2-locked {
    pointer-events: none !important;
    opacity: 0.72 !important;
    cursor: default !important;
}

/* Add a small flag/lock badge after the Select2 container */
.huca-s2-locked::after {
    content: '\1F1ED\1F1FA';  /* HU flag emoji */
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}

/* Make the Select2 container relative so the badge positions correctly */
.select2-container.huca-s2-locked {
    position: relative;
}
