/**
 * Spotmart Mobile Authentication Styles
 *
 * @package Spotmart_Mobile_Authentication
 */

/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    --spotmart-primary: #e74c3c;
    --spotmart-primary-dark: #c0392b;
    --spotmart-success: #27ae60;
    --spotmart-error: #e74c3c;
    --spotmart-warning: #f39c12;
    --spotmart-gray-light: #f5f5f5;
    --spotmart-gray: #999;
    --spotmart-gray-dark: #333;
    --spotmart-border: #ddd;
    --spotmart-radius: 4px;
    --spotmart-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Base Form Styles
   ========================================================================== */
.spotmart-mobile-login-form,
.spotmart-mobile-register-form,
.spotmart-registration-form {
    max-width: 450px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: var(--spotmart-radius);
    box-shadow: var(--spotmart-shadow);
}

.spotmart-form-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    color: var(--spotmart-gray-dark);
}

.spotmart-form-group {
    margin-bottom: 20px;
}

.spotmart-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--spotmart-gray-dark);
}

.spotmart-form-group label .required {
    color: var(--spotmart-error);
}

.spotmart-form-group label .optional {
    color: var(--spotmart-gray);
    font-weight: normal;
    font-size: 13px;
}

.spotmart-form-group input[type="text"],
.spotmart-form-group input[type="tel"],
.spotmart-form-group input[type="email"],
.spotmart-form-group select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid var(--spotmart-border);
    border-radius: var(--spotmart-radius);
    transition: border-color 0.2s ease;
}

.spotmart-form-group input:focus,
.spotmart-form-group select:focus {
    outline: none;
    border-color: var(--spotmart-primary);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.1);
}

.spotmart-form-group input[readonly] {
    background-color: var(--spotmart-gray-light);
    cursor: not-allowed;
}

/* ==========================================================================
   Mobile Input Group
   ========================================================================== */
.spotmart-mobile-group {
    display: flex;
    gap: 10px;
}

.spotmart-mobile-group input {
    flex: 1;
}

.spotmart-mobile-group .button,
.spotmart-mobile-group button {
    white-space: nowrap;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    background: var(--spotmart-primary);
    color: #fff;
    border: none;
    border-radius: var(--spotmart-radius);
    cursor: pointer;
    transition: background 0.2s ease;
}

.spotmart-mobile-group .button:hover,
.spotmart-mobile-group button:hover {
    background: var(--spotmart-primary-dark);
}

.spotmart-mobile-group .button:disabled,
.spotmart-mobile-group button:disabled {
    background: var(--spotmart-gray);
    cursor: not-allowed;
}

/* ==========================================================================
   OTP Section
   ========================================================================== */
.spotmart-otp-section {
    margin-top: 20px;
    padding: 20px;
    background: var(--spotmart-gray-light);
    border-radius: var(--spotmart-radius);
}

.spotmart-otp-section .otp-input-wrapper {
    display: flex;
    gap: 10px;
}

.spotmart-otp-section input {
    flex: 1;
    text-align: center;
    font-size: 20px;
    letter-spacing: 8px;
    font-weight: 600;
}

/* ==========================================================================
   Timer & Resend
   ========================================================================== */
.otp-timer,
#otp-timer,
#reg-otp-timer,
#seller-otp-timer,
#account-otp-timer {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    color: var(--spotmart-gray);
    text-align: center;
}

.resend-link,
#resend-login-otp,
#resend-registration-otp {
    display: inline-block;
    margin-top: 10px;
    color: var(--spotmart-primary);
    text-decoration: none;
    cursor: pointer;
}

.resend-link:hover {
    text-decoration: underline;
}

.resend-link.disabled {
    color: var(--spotmart-gray);
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   Messages
   ========================================================================== */
.spotmart-message,
#login-message,
#registration-message {
    display: none;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: var(--spotmart-radius);
    font-size: 14px;
}

.spotmart-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.spotmart-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Inline status messages */
.mobile-status,
.mobile-verification-status,
#mobile-status,
#seller-mobile-status {
    display: block;
    margin-top: 8px;
    font-size: 13px;
}

.mobile-status .success,
.mobile-verification-status .success {
    color: var(--spotmart-success);
}

.mobile-status .error,
.mobile-verification-status .error {
    color: var(--spotmart-error);
}

/* ==========================================================================
   Details Section
   ========================================================================== */
.spotmart-details-section {
    display: none;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--spotmart-border);
}

.spotmart-details-section.visible {
    display: block;
}

/* Two column layout for names */
.spotmart-name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 480px) {
    .spotmart-name-row {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Submit Button
   ========================================================================== */
.spotmart-submit-btn,
#mobile-login-btn,
#register-submit-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    background: var(--spotmart-primary);
    color: #fff;
    border: none;
    border-radius: var(--spotmart-radius);
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 20px;
}

.spotmart-submit-btn:hover,
#mobile-login-btn:hover,
#register-submit-btn:hover {
    background: var(--spotmart-primary-dark);
}

.spotmart-submit-btn:disabled,
#mobile-login-btn:disabled,
#register-submit-btn:disabled {
    background: var(--spotmart-gray);
    cursor: not-allowed;
}

/* ==========================================================================
   Step Indicator
   ========================================================================== */
.spotmart-step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.step-indicator {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--spotmart-gray);
}

.step-indicator:not(:last-child)::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 2px;
    background: var(--spotmart-border);
    margin: 0 15px;
}

.step-indicator .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--spotmart-border);
    color: var(--spotmart-gray);
    font-weight: 600;
    margin-right: 8px;
}

.step-indicator.active {
    color: var(--spotmart-primary);
}

.step-indicator.active .step-number {
    background: var(--spotmart-primary);
    color: #fff;
}

.step-indicator.completed {
    color: var(--spotmart-success);
}

.step-indicator.completed .step-number {
    background: var(--spotmart-success);
    color: #fff;
}

.step-indicator.completed .step-number::after {
    content: '✓';
}

/* ==========================================================================
   Registration Type Toggle
   ========================================================================== */
.registration-type-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    border: 1px solid var(--spotmart-border);
    border-radius: var(--spotmart-radius);
    overflow: hidden;
}

.registration-type-toggle button {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    background: #fff;
    color: var(--spotmart-gray-dark);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.registration-type-toggle button:not(:last-child) {
    border-right: 1px solid var(--spotmart-border);
}

.registration-type-toggle button.active {
    background: var(--spotmart-primary);
    color: #fff;
}

/* ==========================================================================
   WooCommerce Login Form Override
   ========================================================================== */
.woocommerce-form-login .spotmart-mobile-login-wrapper {
    margin-bottom: 20px;
}

.woocommerce-form-login .spotmart-mobile-group {
    margin-top: 10px;
}

.woocommerce-form-login .spotmart-otp-section {
    margin: 20px 0;
}

/* Hide default password field on OTP-only login */
.woocommerce-form-login.otp-login .woocommerce-form-row--password,
.woocommerce-form-login.otp-login .lost_password,
.woocommerce-form-login.otp-login .woocommerce-form__label-for-checkbox {
    display: none !important;
}

/* ==========================================================================
   Admin Styles
   ========================================================================== */
.spotmart-mobile-field-wrapper {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.spotmart-mobile-field-wrapper .mobile-field-group {
    display: flex;
    gap: 10px;
}

.spotmart-mobile-field-wrapper .mobile-field-group input {
    flex: 1;
}

.spotmart-verify-mobile-btn,
.spotmart-verify-otp-btn {
    padding: 8px 15px !important;
    font-size: 13px !important;
}

/* Admin user list mobile column */
.column-user_mobile {
    width: 120px;
}

/* ==========================================================================
   Vendor Dashboard Mobile Field
   ========================================================================== */
.spotmart-vendor-mobile-field {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.spotmart-vendor-mobile-field .verified-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    background: #d4edda;
    border-radius: 3px;
    font-size: 12px;
}

/* ==========================================================================
   Seller Registration OTP Fields
   ========================================================================== */
.spotmart-seller-mobile-otp {
    margin-bottom: 20px;
}

.spotmart-seller-mobile-otp .mobile-input-wrapper,
.spotmart-seller-mobile-otp .otp-input-wrapper {
    display: flex;
    gap: 10px;
}

.spotmart-seller-mobile-otp .mobile-input-wrapper input,
.spotmart-seller-mobile-otp .otp-input-wrapper input {
    flex: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .spotmart-mobile-login-form,
    .spotmart-mobile-register-form,
    .spotmart-registration-form {
        padding: 20px;
        margin: 10px;
        max-width: none;
    }

    .spotmart-mobile-group {
        flex-direction: column;
    }

    .spotmart-mobile-group .button,
    .spotmart-mobile-group button {
        width: 100%;
    }

    .spotmart-otp-section .otp-input-wrapper {
        flex-direction: column;
    }

    .step-indicator .step-text {
        display: none;
    }

    .step-indicator:not(:last-child)::after {
        width: 20px;
        margin: 0 8px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spotmart-otp-section.fade-in,
.spotmart-details-section.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.spotmart-submit-btn.pulse {
    animation: pulse 1s infinite;
}

/* ==========================================================================
   Hide Email Fields Globally (Mobile-First)
   ========================================================================== */

/* Hide email input fields across all forms */
input[name="reg_email"],
input[name="email"][type="email"],
input[type="email"]#reg_email,
input[type="email"]#email,
.woocommerce-form-register input[type="email"],
.dokan-form-group input[type="email"],
.dokan-registration-form input[type="email"],
#customer_email,
#billing_email.woocommerce-Input--email,
.form-row input[type="email"] {
    display: none !important;
}

/* Hide email labels */
label[for="reg_email"],
label[for="email"],
label[for="customer_email"],
label[for="billing_email"],
.woocommerce-form-register label[for="email"],
.dokan-form-group label[for="email"],
.form-row label:has(+ input[type="email"]) {
    display: none !important;
}

/* Hide email form rows/groups */
.form-row.form-group-email,
.woocommerce-form-row--email,
.dokan-form-group.email-field,
p.woocommerce-form-row:has(input[type="email"]),
.dokan-w8:has(input[type="email"]) {
    display: none !important;
}

/* Mobile fields - normal styling */
input[name="reg_mobile"],
input[name="mobile"],
input[name="billing_phone"],
input[type="tel"],
#login_mobile,
#seller_mobile,
#reg_phone {
    border: 1px solid var(--spotmart-border) !important;
    background-color: #fff !important;
}

/* Mobile field labels - normal weight */
label[for="reg_mobile"],
label[for="mobile"],
label[for="billing_phone"],
label[for="login_mobile"],
label[for="seller_mobile"],
label[for="reg_phone"] {
    font-weight: 500 !important;
    color: var(--spotmart-gray-dark) !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .spotmart-mobile-login-form,
    .spotmart-mobile-register-form {
        display: none;
    }
}
