/**
 * WoodMart Auth Plugin Styles
 * RTL Support for Arabic
 * Version: 2.0.2
 */

/* Main Wrapper */
.woodmart-auth-wrapper {
    direction: rtl;
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Auth Options - Simple Selection Buttons */
.woodmart-auth-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.woodmart-option-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.woodmart-auth-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
    text-align: right;
    width: 100%;
}

.woodmart-auth-option-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.woodmart-auth-option-btn span {
    flex: 1;
}

.woodmart-auth-option-btn:hover {
    background: #f5f5f5;
    border-color: #0073aa;
    transform: translateX(-5px);
}

.woodmart-auth-option-btn.google,
.woodmart-auth-option-btn.social {
    border-color: #ddd;
}

.woodmart-auth-option-btn.google:hover,
.woodmart-auth-option-btn.social:hover {
    border-color: #4285F4;
    background: #f8f9fa;
}

/* Social Login Wrapper */
.woodmart-social-login-wrapper {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    min-height: 150px;
}

.woodmart-social-login-wrapper .nextend-social-login {
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.woodmart-social-login-wrapper .nextend-social-login::before,
.woodmart-social-login-wrapper .nextend-social-login::after {
    content: none;
}

.woodmart-social-login-wrapper .nextend-social-login > * {
    display: block !important;
    margin: 5px auto !important;
}

/* Nextend buttons - ensure they are clickable */
.woodmart-social-login-wrapper .nextend-social-login a,
.nextend-social-login a {
    display: inline-block !important;
    margin: 8px !important;
    padding: 14px 28px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #fff !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

/* Google button styling */
.nextend-social-login a[href*="google"],
.nextend-butt-google {
    background: #4285F4 !important;
    border: 2px solid #4285F4 !important;
}

.nextend-social-login a[href*="google"]:hover {
    background: #357ae8 !important;
    transform: translateY(-2px) !important;
}

/* Facebook button styling */
.nextend-social-login a[href*="facebook"],
.nextend-butt-facebook {
    background: #1877F2 !important;
    border: 2px solid #1877F2 !important;
}

.nextend-social-login a[href*="facebook"]:hover {
    background: #166fe5 !important;
    transform: translateY(-2px) !important;
}

/* Twitter/X button styling */
.nextend-social-login a[href*="twitter"],
.nextend-social-login a[href*="x.com"],
.nextend-butt-twitter {
    background: #1DA1F2 !important;
    border: 2px solid #1DA1F2 !important;
}

/* Apple button styling */
.nextend-social-login a[href*="apple"],
.nextend-butt-apple {
    background: #000 !important;
    border: 2px solid #000 !important;
}

.woodmart-social-login-wrapper .nextend-social-login a:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
}

/* Remove any display:none from Nextend elements */
.nextend-social-login > * {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Prevent Nextend buttons from duplicating inside our wrapper */
.woodmart-social-login-wrapper .nextend-social-login {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

/* Ensure form wrapper shows social login */
.woodmart-auth-form-wrapper#social-form,
.woodmart-auth-form-wrapper#social-login-form {
    display: none;
}

.woodmart-auth-form-wrapper#social-form.active,
.woodmart-auth-form-wrapper#social-login-form.active {
    display: block !important;
}

/* Fix for Nextend duplication - only show first set of buttons */
.woodmart-social-login-wrapper .nextend-social-login::after {
    content: none;
    display: none !important;
}

/* Hide any duplicate nextend-social-login containers inside wrapper */
.woodmart-social-login-wrapper .nextend-social-login .nextend-social-login {
    display: none !important;
}

/* Form Wrapper - Hidden by default */
.woodmart-auth-form-wrapper {
    display: none;
    animation: slideIn 0.3s ease;
}

.woodmart-auth-form-wrapper.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Back Button */
.woodmart-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.woodmart-back-btn:hover {
    background: #f5f5f5;
    color: #333;
    border-color: #0073aa;
}

.woodmart-back-btn svg {
    transform: rotate(180deg);
}

/* Form Styles */
.woodmart-auth-form {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.woodmart-auth-form .form-row {
    margin-bottom: 18px;
}

.woodmart-auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.woodmart-auth-form input[type="text"],
.woodmart-auth-form input[type="email"],
.woodmart-auth-form input[type="tel"],
.woodmart-auth-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    direction: rtl;
    text-align: right;
    background: #fff;
    box-sizing: border-box;
}

.woodmart-auth-form input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

.woodmart-auth-form input::placeholder {
    color: #999;
    direction: ltr;
    text-align: left;
}

.woodmart-auth-form input.error {
    border-color: #dc3545;
    background: #fff8f8;
}

.woodmart-auth-form small {
    display: block;
    margin-top: 6px;
    color: #888;
    font-size: 12px;
}

/* Submit Button */
.woodmart-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 24px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.woodmart-submit-btn svg {
    width: 18px;
    height: 18px;
}

.woodmart-submit-btn:hover {
    background: #005177;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.woodmart-submit-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Google Button */
.woodmart-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 15px 24px;
    background: #fff;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.woodmart-google-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.woodmart-google-btn:hover {
    background: #f5f5f5;
    border-color: #4285F4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Code Input Group */
.woodmart-code-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.woodmart-code-input-group input {
    flex: 1;
}

.woodmart-code-input-group .woodmart-send-code-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    white-space: nowrap;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.woodmart-code-input-group .woodmart-send-code-btn:hover {
    background: #1e7e34;
}

.woodmart-code-input-group .woodmart-send-code-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Timer */
.woodmart-timer {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 5px;
    text-align: center;
    display: none;
}

/* Resend Button */
.woodmart-resend-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: #0073aa;
    border: 1px solid #0073aa;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.woodmart-resend-btn:hover {
    background: #0073aa;
    color: #fff;
}

/* Error and Success Messages */
.woodmart-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 8px;
    padding: 10px 15px;
    background: #f8d7da;
    border-radius: 5px;
    border-right: 4px solid #dc3545;
}

.woodmart-success {
    color: #28a745;
    font-size: 13px;
    margin-top: 8px;
    padding: 10px 15px;
    background: #d4edda;
    border-radius: 5px;
    border-right: 4px solid #28a745;
}

/* Loading Spinner */
.woodmart-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
    vertical-align: middle;
}

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

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

.woodmart-auth-success svg {
    width: 80px;
    height: 80px;
    color: #28a745;
    margin-bottom: 20px;
}

.woodmart-auth-success h3 {
    color: #28a745;
    margin-bottom: 10px;
}

.woodmart-auth-success p {
    color: #666;
}

/* Hide Default WooCommerce Forms */
.woocommerce-form-login,
.woocommerce-form-register {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 520px) {
    .woodmart-auth-container {
        padding: 20px 10px !important;
    }

    .woodmart-auth-form {
        padding: 20px 15px;
    }

    .woodmart-code-input-group {
        flex-direction: column;
    }

    .woodmart-code-input-group .woodmart-send-code-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Focus States for Accessibility */
.woodmart-auth-form input:focus,
.woodmart-submit-btn:focus,
.woodmart-google-btn:focus,
.woodmart-auth-option-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Validation Feedback */
.woodmart-auth-form input.valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2328a745'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 20px;
    padding-left: 40px;
}

/* Checkout Auth */
.woodmart-checkout-auth {
    margin-bottom: 20px;
}

/* Header Auth Buttons */
.woodmart-auth-menu-item {
    list-style: none;
}

.woodmart-auth-menu-item .woodmart-header-auth {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Auth Separator - "أو" between options */
.woodmart-auth-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 15px 0;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to left, #e0e0e0, #f5f5f5);
}

.separator-line:last-child {
    background: linear-gradient(to right, #e0e0e0, #f5f5f5);
}

.separator-text {
    color: #888;
    font-size: 13px;
    font-weight: 600;
    padding: 0 8px;
    white-space: nowrap;
}

/* Header Auth Bar */
.woodmart-auth-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    padding: 8px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.woodmart-auth-bar a {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.woodmart-auth-bar a:hover {
    background: rgba(255,255,255,0.2);
}

.woodmart-auth-bar .auth-separator {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

.woodmart-auth-bar .register-link {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
}

.woodmart-auth-bar .register-link:hover {
    background: rgba(255,255,255,0.3);
}

.woodmart-auth-bar .login-link {
    background: #28a745;
    border: 1px solid #28a745;
}

.woodmart-auth-bar .login-link:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

@media (max-width: 768px) {
    .woodmart-auth-bar {
        padding: 8px 15px;
        gap: 10px;
    }

    .woodmart-auth-bar a {
        font-size: 12px;
        padding: 5px 12px;
    }
}

@media (max-width: 768px) {
    .woodmart-auth-menu-item .woodmart-header-auth {
        flex-direction: column;
        gap: 8px;
    }

    .woodmart-auth-menu-item .woodmart-header-btn {
        width: 100%;
        justify-content: center;
    }
}
