/**
 * Block Checkout OTP Verification Styles
 * Only applies when WooCommerce Block Checkout is active.
 *
 * Modal visually styled to look like the classic inline OTP container,
 * so the user experience is consistent between classic and block checkout.
 * No !important needed — class names are specific.
 */

/* ===== OVERLAY ===== */
.gw-otp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: gw-fade-in 0.18s ease;
}

/* ===== MODAL BOX (styled like inline .gw-otp-container) ===== */
.gw-otp-modal {
    background: #fafafa;
    padding: 36px 24px 22px;
    border-radius: 6px;
    max-width: 420px;
    width: 92%;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid #d9d9d9;
    animation: gw-slide-up 0.22s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

/* ===== TITLE ===== */
.gw-otp-modal h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    text-align: center;
}

/* ===== PHONE INPUT ===== */
.gw-otp-modal .gw-otp-input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    color: #333;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
}

.gw-otp-modal .gw-otp-input-field:focus {
    border-color: #7a7a7a;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* ===== MODAL BUTTONS (inside modal popup) ===== */
.gw-otp-modal .gw-otp-btn-primary {
    width: 100%;
    margin-top: 10px;
    padding: 12px 20px;
    background: #333;
    color: #fff;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    outline: none;
    transition: opacity 0.2s ease, transform 0.1s ease;
    line-height: 1.5;
}

.gw-otp-modal .gw-otp-btn-primary:hover {
    opacity: 0.85;
    background: #333;
    border-color: #333;
    color: #fff;
}

.gw-otp-modal .gw-otp-btn-primary:active {
    transform: scale(0.98);
}

.gw-otp-modal .gw-otp-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== VERIFY BUTTON (inside phone input) ===== */
/* Positioned inside the input, right-aligned.
   Colors come entirely from theme classes: g-web-login-otp-btn woocommerce-button button wp-element-button.
   This CSS only handles sizing/positioning. */

.gw-otp-verify-btn {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    width: auto !important;
    white-space: nowrap !important;
    padding: 0 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    border-radius: 0 4px 4px 0 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-shadow: none !important;
    box-shadow: none !important;
    outline: none !important;
    z-index: 1 !important;
    /* No background/color/border — those come from theme classes */
}

.gw-otp-verify-btn:focus-visible {
    outline: 2px solid currentColor !important;
    outline-offset: -2px !important;
}

/* Verified state — always green regardless of theme */
.gw-otp-verify-btn.gw-verified {
    cursor: default !important;
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    border-color: #c8e6c9 !important;
}

/* ===== OTP DIGIT INPUTS (same as inline) ===== */
.gw-otp-digits-wrap {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 16px 0;
}

.gw-otp-block-digit {
    width: 56px;
    height: 60px;
    text-align: center;
    font-size: 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    line-height: 1;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
}

.gw-otp-block-digit::-webkit-outer-spin-button,
.gw-otp-block-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.gw-otp-block-digit:focus {
    border-color: #555;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* ===== LINKS (Change Number / Resend) ===== */
.gw-otp-modal-links {
    text-align: center;
    margin-top: 8px;
    display: flex;
    justify-content: center;
    gap: 0;
}

.gw-otp-modal-links a {
    display: inline;
    padding: 4px 12px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    line-height: 1.5;
    color: #555;
    transition: color 0.2s ease;
}

.gw-otp-modal-links a:first-child {
    border-right: 1px solid #ddd;
}

.gw-otp-modal-links a:hover {
    color: #000;
    text-decoration: underline;
}

/* ===== ALERT MESSAGE (error/success inside modal) ===== */
.gw-otp-modal-alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.4;
    display: none;
}

.gw-otp-modal-alert.gw-error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.gw-otp-modal-alert.gw-success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===== LOADING INDICATOR ===== */
.gw-otp-modal-loading {
    display: none;
    text-align: center;
    padding: 24px;
}

.gw-otp-modal-loading.gw-active {
    display: block;
}

.gw-otp-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e5e5;
    border-top-color: #555;
    border-radius: 50%;
    animation: gw-spin 0.8s linear infinite;
}

.gw-otp-modal-loading p {
    margin: 10px 0 0;
    color: #666;
    font-size: 13px;
}

/* ===== CLOSE BUTTON (inline-style: top-right circle) ===== */
.gw-otp-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    line-height: 1;
    color: #aaa;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    transition: color 0.2s ease, background 0.2s ease;
    z-index: 1;
}

.gw-otp-modal-close:hover {
    color: #555;
    background: rgba(0, 0, 0, 0.1);
}

/* ===== INLINE NOTICE (shown below phone field) ===== */
.gw-otp-notice {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
    max-width: 90%;
    text-align: center;
    transition: opacity 0.3s ease;
}

/* ===== ANIMATIONS ===== */
@keyframes gw-spin {
    to { transform: rotate(360deg); }
}

@keyframes gw-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gw-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .gw-otp-modal {
        padding: 30px 16px 18px;
        width: 94%;
    }

    .gw-otp-block-digit {
        width: 48px;
        height: 52px;
        font-size: 24px;
        margin: 0;
    }

    .gw-otp-modal .gw-otp-input-field {
        font-size: 14px;
        padding: 8px 12px;
    }

    .gw-otp-modal .gw-otp-btn-primary {
        padding: 10px 16px;
        font-size: 14px;
    }

    .gw-otp-modal h3 {
        font-size: 15px;
    }
}
