/* ═══════════════════════════════════════════════════════════════════════════
   2Factor OTP Auth — Frontend Styles
   Inherits WooCommerce & MediBazar theme variables.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Panel layout ─────────────────────────────────────────────────────────── */

.tfoa-panel {
    position: relative;
}

/* ── Notices ──────────────────────────────────────────────────────────────── */

.tfoa-notices:empty {
    display: none;
}

.tfoa-notices .woocommerce-message,
.tfoa-notices .woocommerce-error {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border-left-width: 4px;
    border-left-style: solid;
    list-style: none;
}

.tfoa-notices .woocommerce-message {
    background: #f0fdf4;
    border-left-color: #16a34a;
    color: #166534;
}

.tfoa-notices .woocommerce-error {
    background: #fef2f2;
    border-left-color: #dc2626;
    color: #991b1b;
}

/* ── Error field styling (red border for validation) ──────────────────────── */

.tfoa-error-field,
.tfoa-error-field:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.tfoa-phone-wrap:has(.tfoa-error-field) {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

/* ── Hint text ────────────────────────────────────────────────────────────── */

.tfoa-hint {
    display: block;
    font-size: 0.8em;
    color: #6b7280;
    margin-top: 4px;
}

/* ── OTP input — large digits ─────────────────────────────────────────────── */

.tfoa-otp-input {
    font-size: 1.6rem !important;
    letter-spacing: 0.4rem !important;
    text-align: center !important;
    max-width: 180px !important;
    font-weight: 700 !important;
}

/* ── Action row ───────────────────────────────────────────────────────────── */

.tfoa-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Resend button ────────────────────────────────────────────────────────── */

.tfoa-resend-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    color: #6b7280;
    padding: 0;
    text-decoration: underline;
    transition: color 0.2s;
}

.tfoa-resend-btn:not(:disabled):hover {
    color: #111827;
}

.tfoa-resend-btn:disabled {
    cursor: not-allowed;
    text-decoration: none;
    opacity: 0.6;
}

/* ── Change phone link ────────────────────────────────────────────────────── */

.tfoa-change-phone {
    font-size: 0.875em;
    color: #6b7280;
    text-decoration: none;
    display: inline-block;
    margin-top: 0.5rem;
    transition: color 0.2s;
}

.tfoa-change-phone:hover {
    color: #111827;
    text-decoration: underline;
}

/* ── OTP info text ────────────────────────────────────────────────────────── */

.tfoa-otp-info {
    font-size: 0.9em;
    color: #374151;
    margin-bottom: 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 0.65rem 1rem;
    border-radius: 4px;
}

/* ── Step transition ──────────────────────────────────────────────────────── */

.tfoa-step {
    animation: tfoa-fade-in 0.25s ease;
}

@keyframes tfoa-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Spinner on loading buttons ───────────────────────────────────────────── */

button[disabled].woocommerce-button {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ── Mobile tweaks ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .tfoa-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .tfoa-otp-input {
        max-width: 100% !important;
    }
}

/* ── Country code dropdown + phone input ──────────────────────────────────── */

/* Outer wrapper: dropdown + input sit side by side */
.tfoa-phone-wrap {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tfoa-phone-wrap:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Dial wrapper: the visible button on the left */
.tfoa-dial-wrap {
    position: relative;
    flex-shrink: 0;
    border-right: 1px solid #d1d5db;
    background: #f9fafb;
}

/* Real <select> — invisible but fully accessible/clickable */
.tfoa-dial-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 1rem;
    border: none;
    background: transparent;
    z-index: 2;
}

/* Visible "fake" button showing flag + code + chevron */
.tfoa-dial-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px 0 12px;
    height: 100%;
    min-height: 44px;
    pointer-events: none;
    white-space: nowrap;
    user-select: none;
}

.tfoa-dial-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.tfoa-dial-code {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    min-width: 32px;
}

.tfoa-dial-arrow {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-left: 2px;
}

/* Phone number input — takes the remaining space */
.tfoa-phone-wrap .tfoa-phone-number {
    flex: 1 1 auto;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding-left: 12px !important;
    min-width: 0;
    background: #fff;
}

.tfoa-phone-wrap .tfoa-phone-number:focus {
    outline: none;
    box-shadow: none !important;
}

/* Remove the hint text below — no longer needed */
.tfoa-hint { display: none; }

/* Mobile: stack dial + number if very narrow */
@media (max-width: 380px) {
    .tfoa-phone-wrap {
        flex-direction: column;
        border-radius: 4px;
    }
    .tfoa-dial-wrap {
        border-right: none;
        border-bottom: 1px solid #d1d5db;
    }
    .tfoa-phone-wrap .tfoa-phone-number {
        border-radius: 0 !important;
        padding-left: 12px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v1.0.3 — Name row, Address section, Location button
   ═══════════════════════════════════════════════════════════════════════════ */

/* Optional badge next to label */
.tfoa-optional {
    font-size: 0.8em;
    color: #9ca3af;
    font-weight: 400;
    margin-left: 4px;
}

/* ── First Name + Last Name — 2 columns ───────────────────────────────────── */

.tfoa-name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

@media (max-width: 480px) {
    .tfoa-name-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ── Address section container ────────────────────────────────────────────── */

.tfoa-address-section {
    margin-top: 1.25rem;
    margin-bottom: 1rem;
    padding: 1rem 1rem 0.25rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

/* Header row: label left, button right */
.tfoa-address-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tfoa-address-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}

/* City/State and Postcode/Country — 2 columns */
.tfoa-address-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

@media (max-width: 480px) {
    .tfoa-address-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .tfoa-address-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── "Use My Location" pill button ───────────────────────────────────────── */

.tfoa-location-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1.5px solid #6366f1;
    color: #6366f1;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    white-space: nowrap;
    line-height: 1.5;
}

.tfoa-location-btn:hover:not(:disabled) {
    background: #6366f1;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.tfoa-location-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spin the pin icon while detecting */
.tfoa-loc-loading .tfoa-loc-icon {
    display: inline-block;
    animation: tfoa-spin 0.85s linear infinite;
}

@keyframes tfoa-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v1.0.7 — Invoice Download Button
   ═══════════════════════════════════════════════════════════════════════════ */

.tfoa-invoice-wrap {
    margin: 1.5rem 0;
    text-align: center;
}

.tfoa-invoice-btn.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a1a2e;
    color: #fff !important;
    border: none;
    padding: 12px 26px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(26,26,46,0.18);
}

.tfoa-invoice-btn.button:hover {
    background: #16213e;
    box-shadow: 0 4px 16px rgba(26,26,46,0.28);
    color: #fff !important;
}

/* My Account orders — Invoice action link */
.woocommerce-orders-table .woocommerce-button.tfoa_invoice,
a.tfoa_invoice {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    text-decoration: underline;
    transition: color 0.18s;
}
a.tfoa_invoice::before {
    content: "↓";
    font-size: 14px;
}
a.tfoa_invoice:hover { color: #6366f1; }


/* Fix search overlay not showing on page load */
#tfoa-mobile-search-overlay {
  display: none !important;
}

#tfoa-mobile-search-overlay.tfoa-search-open {
  display: flex !important;
}

@media (max-width: 991px) {
  .tfoa-search-icon-btn {
    position: relative !important;
    z-index: 999 !important;
    vertical-align: middle !important;
  }
}



/* ── Search icon — below header as its own row ── */
@media (max-width: 991px) {

  /* Hide search icon from header */
  .tfoa-search-icon-btn {
    display: none !important;
  }

  /* Search overlay trigger — full width bar below header */
  #tfoa-mobile-search-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    padding-top: 70px !important;
  }

  #tfoa-mobile-search-overlay.tfoa-search-open {
    display: flex !important;
  }

  /* Sticky search bar below header */
  #tfoa-mobile-search-inner {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    padding: 10px 16px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10) !important;
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
  }

  #tfoa-mobile-search-input {
    font-size: 16px !important;
    padding: 10px 14px !important;
    width: 100% !important;
    border-radius: 8px !important;
  }

}





/* ─────────────────────────────────────────────────────────────────────────────
   Cart quantity update — smooth, no flash
   ────────────────────────────────────────────────────────────────────────────
   WooCommerce blocks the cart table with a white overlay while the AJAX update
   runs — our JS zeroes the overlay opacity, but we also add a gentle CSS
   transition so the table fades slightly instead of blinking.
   ─────────────────────────────────────────────────────────────────────────── */

/* While WooCommerce is updating, dim the cart subtly instead of hard-blocking */
.woocommerce-cart-form.processing,
.woocommerce-cart-form .cart.is-loading {
    opacity : 0.65;
    transition : opacity 0.25s ease;
    pointer-events : none;
}

/* Zero out the blockUI overlay that causes the "white flash / pulse" */
.woocommerce-cart-form .blockOverlay,
.cart_totals .blockOverlay {
    background : transparent !important;
    opacity    : 0          !important;
    transition : none       !important;
}

/* Keep quantity +/- buttons visually consistent while debounce is pending */
.woocommerce-cart-form .quantity .plus,
.woocommerce-cart-form .quantity .minus {
    cursor : pointer;
    -webkit-user-select : none;
    user-select : none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Checkout redirect notice — shown when guest is sent to login from checkout
   ─────────────────────────────────────────────────────────────────────────── */
#tfoa-login-notices .woocommerce-info {
    display       : flex;
    align-items   : center;
    gap           : 8px;
    font-size     : 14px;
    border-color  : #1a1a2e;
    background    : #f0f4ff;
    color         : #1a1a2e;
    border-radius : 6px;
    padding       : 12px 16px;
}
