/* OTP Modal - SIMPLE AUTO-VERIFY Mode */

.otp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.otp-modal-overlay.active {
    display: flex;
}

body.otp-modal-open {
    overflow: hidden;
}

/* Desktop Modal (≥1024px) */
@media (min-width: 1024px) {
    .otp-modal-content {
        background: white;
        border-radius: 16px;
        padding: 40px;
        max-width: 480px;
        width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-50px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Tablet Modal (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .otp-modal-content {
        background: white;
        border-radius: 16px;
        padding: 32px;
        max-width: 420px;
        width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        animation: slideDown 0.3s ease;
    }
}

/* Mobile Bottom Sheet (≤767px) */
@media (max-width: 767px) {
    .otp-modal-overlay {
        align-items: flex-end;
        justify-content: flex-start;
    }

    .otp-modal-content {
        background: white;
        border-radius: 20px 20px 0 0;
        padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
        width: 100%;
        max-height: 95vh;
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .otp-modal-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 0 auto 16px;
    }
}

/* Header */
.otp-modal-header {
    margin-bottom: 28px;
}

.otp-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin: 0;
}

/* Where Code Was Sent */
.otp-sent-to {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #F8F5EE;
    border-radius: 12px;
    margin-bottom: 20px;
}

.otp-sent-icon {
    font-size: 24px;
}

.otp-sent-text {
    font-size: 14px;
    color: #111;
    font-weight: 500;
}

/* Timer */
.otp-timer {
    text-align: center;
    padding: 12px;
    background: #ECE6D6;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #8C6218;
    margin-bottom: 24px;
}

.otp-timer .time {
    font-size: 16px;
    font-weight: 700;
    color: #B3261E;
    font-family: 'Monaco', monospace;
    letter-spacing: 1px;
}

/* OTP Input */
.otp-input-group {
    margin-bottom: 24px;
}

.otp-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #111;
    margin-bottom: 12px;
}

.otp-input-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.otp-input-container input {
    width: 52px;
    height: 56px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    border: 2px solid #E4DBC7;
    border-radius: 10px;
    color: #111;
    font-family: 'Monaco', monospace;
    transition: all 0.2s;
}

.otp-input-container input:focus {
    outline: none;
    border-color: #B8994B;
    box-shadow: 0 0 0 3px rgba(184, 153, 75, 0.1);
}

.otp-input-container input.error {
    border-color: #B3261E;
    background: #FFF0EE;
}

.otp-input-container input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error Message */
.otp-error {
    color: #B3261E;
    font-size: 13px;
    padding: 10px 12px;
    background: #FFF0EE;
    border-radius: 6px;
    display: none;
}

.otp-error.show {
    display: block;
}

/* Channel Toggle (Code-only only) */
.otp-channel-toggle {
    margin-bottom: 24px;
}

.toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.toggle-buttons {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #E4DBC7;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: #B8994B;
    background: #FFF9F0;
}

.toggle-btn.active {
    background: #B8994B;
    color: white;
    border-color: #B8994B;
}

/* Cancel Button Only */
.otp-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.otp-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.otp-btn-cancel {
    background: #F8F5EE;
    color: #111;
    border: 1px solid #E4DBC7;
    width: 100%;
}

.otp-btn-cancel:hover {
    background: #ECE6D6;
}

/* Resend Section */
.otp-resend-section {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #E4DBC7;
}

.otp-resend-btn {
    background: none;
    border: none;
    color: #12408B;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
}

.otp-resend-btn:hover {
    color: #0C2B5E;
    text-decoration: underline;
}

.otp-resend-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.otp-resend-btn.loading::after {
    content: ' ⟳';
    animation: spin 1s linear infinite;
}

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

.otp-resend-cooldown {
    font-size: 12px;
    color: #8C6218;
    margin-top: 8px;
    padding: 8px;
    background: #FFF9F0;
    border-radius: 6px;
}

/* Success State */
.otp-success {
    text-align: center;
    padding: 40px 20px;
}

.otp-success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.otp-success h3 {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin-bottom: 8px;
}

.otp-success p {
    font-size: 14px;
    color: #6B7280;
}

/* Confirm Modal */
.otp-confirm-content {
    padding: 24px;
    text-align: center;
}

.otp-confirm-content h3 {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin-bottom: 12px;
}

.otp-confirm-content p {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 24px;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .otp-input-container input {
        width: 40px;
        height: 48px;
        font-size: 20px;
    }

    .otp-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}
