/**
 * RichPearls OTP Login & Registration — Frontend Styles
 *
 * @package RichPearls_OTP
 */

:root {
    --rp-primary: #b33951;
    --rp-primary-dark: #8c253b;
    --rp-primary-light: #fdf2f4;
    --rp-dark: #1f2937;
    --rp-gray-50: #f9fafb;
    --rp-gray-100: #f3f4f6;
    --rp-gray-200: #e5e7eb;
    --rp-gray-400: #9ca3af;
    --rp-gray-600: #4b5563;
    --rp-gray-700: #374151;
    --rp-success: #059669;
    --rp-success-bg: #ecfdf5;
    --rp-danger: #dc2626;
    --rp-danger-bg: #fef2f2;
    --rp-warning: #d97706;
    --rp-warning-bg: #fffbeb;
    --rp-radius: 8px;
    --rp-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Standalone & Card Containers */
.richpearls-otp-container {
    max-width: 440px;
    margin: 30px auto;
    background: #ffffff;
    border: 1px solid var(--rp-gray-200);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    padding: 28px 24px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--rp-dark);
}

.richpearls-auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.richpearls-auth-title,
.richpearls-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--rp-dark);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.richpearls-auth-subtitle {
    font-size: 14px;
    color: var(--rp-gray-600);
    margin: 0;
    line-height: 1.4;
}

/* Tabs */
.richpearls-auth-tabs,
.richpearls-wc-tabs {
    display: flex;
    background: var(--rp-gray-100);
    border-radius: var(--rp-radius);
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
}

.richpearls-auth-tab,
.richpearls-wc-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--rp-gray-600);
    cursor: pointer;
    transition: var(--rp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.richpearls-auth-tab:hover,
.richpearls-wc-tab:hover {
    color: var(--rp-dark);
}

.richpearls-auth-tab.active,
.richpearls-wc-tab.active {
    background: #ffffff;
    color: var(--rp-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.richpearls-auth-panel {
    display: none;
}

.richpearls-auth-panel.active {
    display: block;
    animation: rpFadeIn 0.25s ease-out;
}

@keyframes rpFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Groups */
.richpearls-form-group {
    margin-bottom: 18px;
    text-align: left;
}

.richpearls-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--rp-gray-700);
    margin-bottom: 6px;
}

.richpearls-label .required {
    color: var(--rp-danger);
}

.richpearls-label .optional {
    color: var(--rp-gray-400);
    font-weight: 400;
}

.richpearls-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid var(--rp-gray-200);
    border-radius: var(--rp-radius);
    background: #ffffff;
    color: var(--rp-dark);
    box-sizing: border-box;
    transition: var(--rp-transition);
}

.richpearls-input:focus {
    outline: none;
    border-color: var(--rp-primary);
    box-shadow: 0 0 0 3px rgba(179, 57, 81, 0.15);
}

.richpearls-field-hint {
    font-size: 12px;
    color: var(--rp-gray-400);
    margin: 5px 0 0 0;
    line-height: 1.4;
}

/* Phone Input with Country Code Badge */
.richpearls-phone-input-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--rp-gray-200);
    border-radius: var(--rp-radius);
    overflow: hidden;
    transition: var(--rp-transition);
    background: #ffffff;
}

.richpearls-phone-input-wrap:focus-within {
    border-color: var(--rp-primary);
    box-shadow: 0 0 0 3px rgba(179, 57, 81, 0.15);
}

.richpearls-country-code {
    background: var(--rp-gray-100);
    color: var(--rp-gray-700);
    padding: 0 14px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--rp-gray-200);
    user-select: none;
}

.richpearls-phone-field {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    flex: 1;
    padding: 12px 14px;
    font-size: 15px;
    letter-spacing: 0.5px;
}

/* Buttons */
.richpearls-form-actions {
    margin-top: 20px;
}

.richpearls-btn {
    width: 100%;
    padding: 13px 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--rp-radius);
    border: none;
    cursor: pointer;
    transition: var(--rp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.richpearls-btn-primary {
    background: var(--rp-primary);
    color: #ffffff;
}

.richpearls-btn-primary:hover {
    background: var(--rp-primary-dark);
    color: #ffffff;
}

.richpearls-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading Spinner */
.richpearls-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: rpSpin 0.75s linear infinite;
    display: inline-block;
}

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

/* OTP Step Header & Phone Display */
.richpearls-otp-status-header {
    background: var(--rp-gray-50);
    border-radius: var(--rp-radius);
    padding: 12px 14px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px dashed var(--rp-gray-200);
}

.richpearls-otp-sent-text {
    margin: 0;
    font-size: 13px;
    color: var(--rp-gray-600);
}

.richpearls-otp-sent-text strong {
    color: var(--rp-dark);
}

.richpearls-edit-phone-btn {
    background: none;
    border: none;
    color: var(--rp-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--rp-transition);
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.richpearls-edit-phone-btn:hover {
    background: var(--rp-primary-light);
}

/* Multi-Digit OTP Input Boxes */
.richpearls-otp-boxes {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 6px 0;
}

.richpearls-otp-digit {
    width: 48px;
    height: 54px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border: 1.5px solid var(--rp-gray-200);
    border-radius: 8px;
    background: #ffffff;
    color: var(--rp-dark);
    transition: var(--rp-transition);
    box-sizing: border-box;
    padding: 0;
}

.richpearls-otp-digit:focus {
    outline: none;
    border-color: var(--rp-primary);
    box-shadow: 0 0 0 3px rgba(179, 57, 81, 0.15);
    background: #ffffff;
}

.richpearls-otp-digit.filled {
    border-color: var(--rp-primary);
    background: var(--rp-primary-light);
}

/* Remember Me Checkbox */
.richpearls-form-remember {
    margin: 14px 0 0 0;
    text-align: left;
}

.richpearls-checkbox-label {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: var(--rp-gray-600);
    cursor: pointer;
    gap: 6px;
}

.richpearls-checkbox-label input[type="checkbox"] {
    margin: 0;
    accent-color: var(--rp-primary);
}

/* Resend Timer */
.richpearls-resend-wrap {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}

.richpearls-countdown-text {
    color: var(--rp-gray-400);
}

.richpearls-resend-link {
    background: none;
    border: none;
    color: var(--rp-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.richpearls-resend-link:hover {
    color: var(--rp-primary-dark);
}

/* Test Mode Badge */
.richpearls-test-mode-badge {
    background: var(--rp-warning-bg);
    border: 1px solid var(--rp-warning);
    color: var(--rp-warning);
    border-radius: var(--rp-radius);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.richpearls-test-mode-badge .richpearls-debug-code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 2px;
    border: 1px dashed var(--rp-warning);
    color: var(--rp-dark);
}

/* Live Alert Banner */
.richpearls-alert {
    padding: 12px 14px;
    border-radius: var(--rp-radius);
    font-size: 13px;
    line-height: 1.4;
    margin-top: 16px;
    text-align: left;
    display: flex;
    align-items: center;
    animation: rpFadeIn 0.2s ease-out;
}

.richpearls-alert.alert-error {
    background: var(--rp-danger-bg);
    color: var(--rp-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.richpearls-alert.alert-success {
    background: var(--rp-success-bg);
    color: var(--rp-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

/* WooCommerce My Account Integration */
.richpearls-wc-otp-wrapper {
    margin-bottom: 24px;
}

.richpearls-wc-tab-content {
    display: none;
}

.richpearls-wc-tab-content.active {
    display: block;
    animation: rpFadeIn 0.2s ease-out;
}

/* Checkout Notice & Modal */
.richpearls-checkout-otp-notice {
    display: flex;
    align-items: center;
    gap: 8px;
}

.richpearls-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
}

.richpearls-modal-content {
    background: #ffffff;
    max-width: 420px;
    width: 100%;
    border-radius: 12px;
    padding: 28px 24px;
    position: relative;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
    animation: rpScaleIn 0.2s ease-out;
}

@keyframes rpScaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.richpearls-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--rp-gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.richpearls-modal-close:hover {
    color: var(--rp-dark);
}

.richpearls-modal-content h3 {
    margin: 0 0 6px 0;
    font-size: 20px;
}

.richpearls-modal-sub {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: var(--rp-gray-600);
}

/* Already logged in banner */
.richpearls-already-logged-in {
    background: var(--rp-gray-50);
    border: 1px solid var(--rp-gray-200);
    border-radius: var(--rp-radius);
    padding: 16px;
    text-align: center;
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .richpearls-otp-container {
        padding: 20px 16px;
        margin: 15px auto;
        box-shadow: none;
        border: none;
    }

    .richpearls-otp-boxes {
        gap: 6px;
    }

    .richpearls-otp-digit {
        width: 42px;
        height: 48px;
        font-size: 19px;
    }
}
