/* Colors and radius follow the WoodMart theme settings when present. */
.otps-wrap {
    --otps-accent: var(--wd-primary-color, #2563eb);
    --otps-border: var(--wd-form-brd-color, #d1d5db);
    --otps-radius: var(--wd-form-brd-radius, 8px);
    max-width: 480px;
    margin: 0 auto 24px;
    padding: 20px;
    border: 1px solid var(--otps-border);
    border-radius: 12px;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
}

.otps-wrap[hidden] {
    display: none !important;
}

.otps-wrap.otps-embedded {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

/* WoodMart off-canvas login panel: show either the login form or ours. */
.login-form-side .otps-side {
    display: none;
    padding: 20px;
}

.login-form-side.otps-side-register .otps-side {
    display: block;
}

.login-form-side.otps-side-register form.woocommerce-form-login,
.login-form-side.otps-side-register .create-account-question {
    display: none !important;
}

.otps-switch {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.95em;
}

.otps-wrap .otps-step[hidden],
.otps-wrap .otps-msg[hidden] {
    display: none !important;
}

.otps-wrap *,
.otps-wrap *::before,
.otps-wrap *::after {
    box-sizing: inherit;
}

.otps-title {
    margin: 0 0 16px;
    font-size: 1.25em;
}

.otps-row--half {
    display: flex;
    gap: 12px;
}

.otps-row--half > .otps-field {
    flex: 1 1 0;
    min-width: 0;
}

.otps-field {
    margin-bottom: 14px;
}

.otps-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.95em;
}

.otps-req {
    color: #dc2626;
}

.otps-wrap .otps-field input {
    width: 100%;
    height: auto;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--otps-border);
    border-radius: var(--otps-radius);
    font: inherit;
    background: #fff;
}

.otps-wrap .otps-field input:focus {
    outline: none;
    border-color: var(--otps-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.otps-code {
    text-align: center;
    letter-spacing: 0.4em;
    font-size: 1.4em !important;
}

.otps-consent {
    margin-bottom: 16px;
}

.otps-consent-text {
    max-height: 160px;
    overflow-y: auto;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--otps-border);
    border-radius: var(--otps-radius);
    background: #f9fafb;
    font-size: 0.9em;
    line-height: 1.8;
}

.otps-consent-text p {
    margin: 0 0 8px;
}

.otps-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95em;
}

.otps-check input {
    margin-top: 4px;
}

.otps-wrap .otps-btn {
    display: block;
    min-height: 42px;
    text-transform: none;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: var(--otps-radius);
    background: var(--otps-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.otps-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.otps-sent-to {
    margin: 0 0 14px;
    font-size: 0.95em;
}

.otps-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.9em;
}

.otps-wrap .otps-link {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--otps-accent);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.otps-link:disabled {
    color: #9ca3af;
    cursor: default;
    text-decoration: none;
}

.otps-timer {
    color: #6b7280;
}

.otps-msg {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--otps-radius);
    font-size: 0.95em;
    line-height: 1.7;
}

.otps-msg--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.otps-msg--success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.otps-msg--info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.otps-busy {
    opacity: 0.7;
    pointer-events: none;
}

@media (max-width: 480px) {
    .otps-wrap {
        padding: 16px;
    }

    .otps-row--half {
        flex-direction: column;
        gap: 0;
    }
}

/* Checkout pre-invoice modal */
body.otps-modal-open {
    overflow: hidden;
}

.otps-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

.otps-modal[hidden] {
    display: none !important;
}

.otps-modal .otps-modal-box {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    margin: 0;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.otps-wrap .otps-modal-close {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 32px;
    height: 32px;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #6b7280;
    font-size: 24px;
    line-height: 32px;
    cursor: pointer;
}

.otps-buyer {
    margin: 0 0 10px;
    font-size: 0.92em;
}

.otps-wrap .otps-invoice-table {
    width: 100%;
    margin: 0 0 14px;
    border-collapse: collapse;
    font-size: 0.92em;
}

.otps-wrap .otps-invoice-table th,
.otps-wrap .otps-invoice-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--otps-border);
    text-align: right;
    vertical-align: top;
}

.otps-wrap .otps-invoice-table td:nth-child(2),
.otps-wrap .otps-invoice-table thead th:nth-child(2) {
    text-align: center;
    white-space: nowrap;
}

.otps-wrap .otps-invoice-table td:last-child,
.otps-wrap .otps-invoice-table th:last-child {
    text-align: left;
    white-space: nowrap;
}

.otps-wrap .otps-invoice-table tfoot th {
    border-bottom: 0;
    font-size: 1.05em;
}

.otps-wrap .otps-invoice-table td:first-child {
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    .otps-modal {
        padding: 8px;
    }

    .otps-modal .otps-modal-box {
        padding: 14px;
    }

    .otps-wrap .otps-invoice-table {
        font-size: 0.85em;
    }

    .otps-wrap .otps-invoice-table th,
    .otps-wrap .otps-invoice-table td {
        padding: 6px 4px;
    }

    .otps-wrap .otps-invoice-table td:last-child,
    .otps-wrap .otps-invoice-table th:last-child {
        white-space: normal;
    }
}
