/**
 * WooCommerce OTP Verification - Public Styles
 *
 * @package WC_OTP_Verification
 */

/* ==================================
   OTP Modal Styles
   ================================== */

.wc-otp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.wc-otp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.wc-otp-modal-content {
    position: relative;
    max-width: 480px;
    width: 90%;
    margin: 5% auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000000;
    animation: slideDown 0.3s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wc-otp-modal-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
    position: relative;
}

.wc-otp-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-otp-modal-close:hover {
    color: #333;
}

#wc-otp-checkout-verify-btn {
    background-color: #4CAF50;
    color: white;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

#wc-otp-checkout-verify-btn:hover:not(:disabled) {
    background-color: #45a049;
    transform: translateY(-1px);
}

#wc-otp-checkout-verify-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.wc-otp-checkout-status {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 4px;
    color: #2e7d32;
}

/* ==================================
   Login & Registration Custom UI
   ================================== */

#wc-otp-login-toggle-container {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

#wc-otp-login-otp-view {
    display: none;
    background: #fdfdfd;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.wc-otp-phone-input-wrapper {
    display: flex;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.3s ease;
    align-items: center;
}

.wc-otp-phone-input-wrapper:focus-within {
    border-color: #667eea;
}

.wc-otp-country-selector {
    padding: 0 15px;
    border-right: 1px solid #e0e0e0;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    height: 48px;
    font-weight: 600;
    color: #444;
}

.wc-otp-login-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.wc-otp-login-buttons .button {
    flex: 1;
    font-weight: 700;
    padding: 14px !important;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#wc-otp-login-with-otp-secondary-btn {
    margin: 15px 0;
    width: 100%;
    background-color: #f7f7f7 !important;
    color: #444 !important;
    border: 1px solid #ddd !important;
    font-weight: 600;
}

#wc-otp-login-with-otp-secondary-btn:hover {
    background-color: #efefef !important;
}

/* Registration Fields */
.wc-otp-register-fields {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff9f9;
    border-radius: 8px;
    border: 1px dashed #ffcdd2;
}

.wc-otp-reg-verify-link {
    background: #667eea !important;
    border: none !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer;
    padding: 0 15px !important;
    height: 48px;
    text-transform: uppercase;
    transition: all 0.2s;
    border-radius: 0 8px 8px 0;
}

.wc-otp-reg-verify-link:hover {
    background: #764ba2 !important;
}

.wc-otp-reg-verify-link:disabled {
    background: #ccc !important;
    cursor: not-allowed;
}

#reg_phone,
#wc-otp-login-phone {
    border: none !important;
    flex: 1;
    padding: 12px 15px !important;
    height: 48px !important;
    margin: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #333 !important;
}

.wc-otp-messages,
.wc-otp-login-messages,
.wc-otp-registration-messages {
    margin: 15px 0;
    min-height: 20px;
}

.wc-otp-modal-header h3 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

.wc-otp-subtitle {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.wc-otp-modal-body {
    padding: 32px;
}

/* ==================================
   Step Styles
   ================================== */

.wc-otp-step {
    display: none;
}

.wc-otp-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==================================
   Input Styles
   ================================== */

.wc-otp-input-group {
    margin-bottom: 24px;
}

.wc-otp-input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.wc-otp-input-group label .required {
    color: #e74c3c;
    margin-left: 2px;
}

.wc-otp-phone-input {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.wc-otp-phone-input:focus-within {
    border-color: #4CAF50;
}

.wc-otp-country-selector .country-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.wc-otp-country-selector .country-list li {
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
}

.wc-otp-country-selector .country-list li:hover {
    background: #f0f0f0;
}

.wc-otp-phone-input {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

#wc-otp-phone {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: none;
    outline: none;
    background: transparent;
}

#wc-otp-code,
.wc-otp-code-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    letter-spacing: 6px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

#wc-otp-code:focus,
.wc-otp-code-input:focus {
    border-color: #667eea;
    outline: none;
}

.wc-otp-help-text {
    margin: 8px 0 0;
    font-size: 12px;
    color: #999;
}

/* ==================================
   Button Styles
   ================================== */

.wc-otp-button {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wc-otp-button:not(.wc-otp-button-primary) {
    background: #4CAF50;
    color: #ffffff;
}

.wc-otp-button.wc-otp-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wc-otp-button.wc-otp-button-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.wc-otp-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wc-otp-button:active:not(:disabled) {
    transform: translateY(0);
}

.wc-otp-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wc-otp-button.loading {
    opacity: 0.8;
    cursor: wait;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==================================
   Timer Styles
   ================================== */

.wc-otp-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    padding: 12px;
    background: #fff3f3;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
}

.wc-otp-timer svg {
    flex-shrink: 0;
}

.countdown-timer {
    color: #FF6B6B;
    font-size: 16px;
    font-weight: 700;
}

/* ==================================
   Resend Section
   ================================== */

.wc-otp-resend-section {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.button-link {
    background: none;
    border: none;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.button-link:hover:not(:disabled) {
    color: #764ba2;
}

.button-link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: none;
}

/* ==================================
   Sent Info
   ================================== */

.wc-otp-sent-info {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    background: #f0fdf4;
    border-radius: 12px;
}

.wc-otp-sent-info svg {
    margin-bottom: 12px;
}

.wc-otp-sent-info p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.wc-otp-sent-info strong {
    color: #4CAF50;
}

/* ==================================
   Success Step
   ================================== */

.wc-otp-step-success {
    text-align: center;
    padding: 20px 0;
}

.wc-otp-success-icon {
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.wc-otp-step-success h4 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 600;
    color: #4CAF50;
}

.wc-otp-step-success p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ==================================
   Messages
   ================================== */

.wc-otp-messages {
    margin-top: 16px;
    display: none;
}

.wc-otp-messages .woocommerce-message,
.wc-otp-messages .woocommerce-error {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-otp-messages .woocommerce-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.wc-otp-messages .woocommerce-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.message-icon {
    font-weight: bold;
    font-size: 16px;
}

/* ==================================
   Checkout Notice
   ================================== */

.wc-otp-notice {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.wc-otp-notice strong {
    color: #ff9800;
}

/* ==================================
   Disabled Checkout Button
   ================================== */

#place_order.wc-otp-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc !important;
}

/* ==================================
   Body Lock
   ================================== */

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

/* ==================================
   Responsive Design
   ================================== */

@media (max-width: 768px) {
    .wc-otp-modal-content {
        width: 95%;
        margin: 3% auto;
        border-radius: 12px;
    }

    .wc-otp-modal-header {
        padding: 24px 20px 16px;
    }

    .wc-otp-modal-header h3 {
        font-size: 20px;
    }

    .wc-otp-modal-body {
        padding: 24px 20px;
    }

    .wc-otp-resend-section {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .wc-otp-modal-content {
        margin: 2% auto;
    }

    .wc-otp-subtitle {
        font-size: 13px;
    }

    #wc-otp-code {
        letter-spacing: 4px;
        font-size: 18px;
    }
}

/* ==================================
   Print Styles
   ================================== */

@media print {
    .wc-otp-modal {
        display: none !important;
    }
}

/* ==================================
   Accessibility
   ================================== */

.wc-otp-button:focus,
#wc-otp-phone:focus,
#wc-otp-code:focus,
.button-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wc-otp-modal-content {
        border: 2px solid #000;
    }

    .wc-otp-phone-input,
    #wc-otp-code {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .wc-otp-modal-content,
    .wc-otp-step.active,
    .wc-otp-success-icon {
        animation: none;
    }

    .wc-otp-button,
    .spinner {
        transition: none;
        animation: none;
    }
}

/* Login via OTP styling */
.wc-otp-login-otp-wrapper {
    margin-top: 15px;
    text-align: center;
}

#wc-otp-login-with-otp-btn {
    width: 100%;
}

/* Registration verify styling */
#wc_otp_reg_verify_btn {
    margin-top: 5px;
}