/* Lunarcat v2 Authentication Styles */

/* Force Elementor containers to use theme background */
.elementor-element.e-con[data-settings*="background_background"],
.elementor-widget-container {
    background: var(--color-bg-main);
}

[data-theme="dark"] .elementor-element.e-con[data-settings*="background_background"],
[data-theme="dark"] .elementor-widget-container {
    background: #1A1A1A;
}

/* Import Order Form Container Variables */
:root {
    /* Light Mode Gradients */
    --silver-gradient: linear-gradient(135deg, #e8e8e8 0%, #f0f0f0 50%, #f8f8f8 100%);
    --silver-gradient-hover: linear-gradient(135deg, #e0e0e0 0%, #f0f0f0 50%, #ffffff 100%);
    
    /* Dark Mode Gradients */
    --dark-gradient: linear-gradient(135deg, #1A1A1A 0%, #2D2D2D 100%);
    --dark-gradient-hover: linear-gradient(135deg, #2D2D2D 0%, #404040 100%);
    
    /* Container Backgrounds */
    --bg-gradient: var(--silver-gradient);
    --bg-gradient-hover: var(--silver-gradient-hover);
    
    /* Shadows */
    --shadow-card: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-hover: 0 8px 25px rgba(37, 99, 235, 0.1);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-gradient: var(--dark-gradient);
    --bg-gradient-hover: var(--dark-gradient-hover);
    --shadow-card: 0 4px 12px rgba(0,0,0,0.2);
    --shadow-hover: 0 8px 25px rgba(255, 205, 57, 0.2);
}

/* Remove old auth-card styles - now using Order Type container pattern */

.auth-form-content {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .auth-form-content {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
}

.auth-form {
    display: contents; /* Remove form container styling */
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057; /* Default light mode */
}

/* Dark mode labels */
[data-theme="dark"] .form-field label {
    color: #ccc;
}

.required-indicator {
    color: #dc3545;
}

[data-theme="dark"] .required-indicator {
    color: #ff6b6b;
}

/* Light mode inputs, textareas, and selects - explicit styling */
.form-field input,
.form-field textarea,
.form-field select,
[data-theme="light"] .form-field input,
[data-theme="light"] .form-field textarea,
[data-theme="light"] .form-field select {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid #ced4da;
    background: var(--color-background) !important;
    color: var(--color-text-primary) !important;
    font-family: inherit;
    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
[data-theme="light"] .form-field input:focus,
[data-theme="light"] .form-field textarea:focus,
[data-theme="light"] .form-field select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(var(--color-accent-rgb), 0.2);
    background: var(--color-background) !important;
}

/* Override browser autocomplete styling in light mode */
.form-field input:-webkit-autofill,
[data-theme="light"] .form-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    -webkit-text-fill-color: #495057 !important;
}

/* Dark mode inputs, textareas, and selects */
[data-theme="dark"] .form-field input,
[data-theme="dark"] .form-field textarea,
[data-theme="dark"] .form-field select {
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

[data-theme="dark"] .form-field input:hover,
[data-theme="dark"] .form-field textarea:hover,
[data-theme="dark"] .form-field select:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] .form-field input:focus,
[data-theme="dark"] .form-field textarea:focus,
[data-theme="dark"] .form-field select:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: #ffcd39;
    box-shadow: 0 0 0 2px rgba(255, 205, 57, 0.2);
}

[data-theme="dark"] .form-field select option {
    background: #1a1a1a !important;
    color: #fff !important;
}

/* Dark mode autocomplete styling */
[data-theme="dark"] .form-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.1) inset !important;
    -webkit-text-fill-color: #fff !important;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: #888;
}

/* Auth Button Styling (Not Full Width) */
.auth-btn {
    width: auto !important;
    min-width: 120px;
    padding: 0.75rem 1.5rem !important;
    display: inline-block;
    margin: 0 auto;
}

/* Center auth buttons */
.auth-form button,
.social-login-container {
    display: flex;
    justify-content: center;
}


.message-container {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
}

.success-message {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #51cf66;
}


/* Divider between login button and Google login */
.divider-container {
    display: flex;
    align-items: center;
    margin: 0.9rem 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

/* Dark mode divider */
[data-theme="dark"] .divider-line {
    background: rgba(255, 255, 255, 0.1);
}

.divider-text {
    padding: 0 1rem;
    font-size: 0.9rem;
    color: #6c757d;
    text-align: center;
}

/* Dark mode divider text */
[data-theme="dark"] .divider-text {
    color: #adb5bd;
}

.social-login-container {
    width: 100%;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    border: none !important;
}

.social-btn:hover {
    border: none !important;
}

.social-icon {
    flex-shrink: 0;
}

.auth-links {
    text-align: center;
    margin-top: 0.25rem;
}

/* Override spacing-standard for auth links to create tight grouping with Google button */
.auth-links.spacing-standard {
    margin-bottom: 0.25rem;
    margin-top: 0.25rem;
}

/* Client-side validation error styling */
.form-field.has-error input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.field-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    display: flex;
    align-items: center;
}

.field-error:before {
    content: "⚠️";
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

[data-theme="dark"] .field-error {
    color: #ff6b6b;
}

[data-theme="dark"] .form-field.has-error input {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 107, 0.25) !important;
}

/* Real-time password field highlighting */
.form-field.field-invalid input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-field.field-valid input {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Dark theme real-time highlighting */
[data-theme="dark"] .form-field.field-invalid input {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 107, 0.25) !important;
}

[data-theme="dark"] .form-field.field-valid input {
    border-color: #4ade80 !important;
    box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.25) !important;
}

/* AJAX availability checking messages */
.availability-message {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    display: flex;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.availability-message.checking {
    color: #6c757d;
}

.availability-message.available {
    color: #28a745;
}

.availability-message.unavailable,
.availability-message.error {
    color: #dc3545;
}

[data-theme="dark"] .availability-message.checking {
    color: #adb5bd;
}

[data-theme="dark"] .availability-message.available {
    color: #4ade80;
}

[data-theme="dark"] .availability-message.unavailable,
[data-theme="dark"] .availability-message.error {
    color: #ff6b6b;
}

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

/* Screen reader only - invisible to visual users but accessible to screen readers */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.auth-links a {
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

/* Dark mode links */
[data-theme="dark"] .auth-links a,
body.dark-mode .auth-links a {
    color: #ffcd39;
}

/* Light mode links */
[data-theme="light"] .auth-links a,
body:not(.dark-mode) .auth-links a {
    color: #0073aa;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Dark mode link hover */
[data-theme="dark"] .auth-links a:hover,
body.dark-mode .auth-links a:hover {
    color: #ffd666;
}

/* Light mode link hover */
[data-theme="light"] .auth-links a:hover,
body:not(.dark-mode) .auth-links a:hover {
    color: #005a87;
}

/* Auth and Profile Container Styles - Using Order Type Container Pattern */
.auth-type-container {
    position: relative;
    width: 400px;
    max-width: 400px;
    margin: 2rem auto;
    background: var(--bg-gradient);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.auth-type-container:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Container Header Styling */
.auth-type-container .container-header {
    margin-bottom: 1.5rem;
}

.auth-type-container .container-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
    color: #212529;
}

[data-theme="dark"] .auth-type-container .container-header h2 {
    color: #fff;
}

.profile-type-container {
    max-width: 600px;
    margin: 0 auto;
}

.profile-summary {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.info-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .info-section {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 0.5rem;
}

[data-theme="dark"] .section-title {
    color: #ffcd39;
    border-bottom-color: #ffcd39;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-grid p {
    margin: 0;
    line-height: 1.5;
    color: #374151;
}

[data-theme="dark"] .info-grid p {
    color: #d1d5db;
}

.user-code {
    font-family: 'Courier New', monospace;
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    color: #2563eb;
}

[data-theme="dark"] .user-code {
    background: rgba(255, 205, 57, 0.1);
    color: #ffcd39;
}

.status-message {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #22c55e;
    margin-bottom: 1rem;
}

[data-theme="dark"] .status-message {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border-left-color: #22c55e;
}

/* Responsive design */
@media (max-width: 768px) {
    .profile-summary {
        gap: 1.5rem;
    }
    
    .info-section {
        padding: 1rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .auth-type-container {
        width: 100%;
        max-width: none;
        margin: 0.5rem;
    }
}

@media (max-width: 480px) {
    .auth-type-container,
    .profile-type-container {
        max-width: 100%;
        width: calc(100% - 1rem);
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .info-grid {
        gap: 0.5rem;
    }
}

/* Password Field Wrapper and Toggle Styles */
.password-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field-wrapper input {
    flex: 1;
    padding-right: 2.5rem !important;
}

/* Disable browser's native password reveal button to prevent duplicate icons */
input[type="password"]::-ms-reveal {
    display: none;
}

input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-password-reveal-button {
    display: none !important;
}

/* For Firefox */
input[type="password"]::-moz-reveal {
    display: none;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    z-index: 2;
}

.password-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .password-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.password-toggle-icon {
    width: 18px;
    height: 18px;
    color: #6c757d;
    transition: color 0.2s ease;
}

.password-toggle:hover .password-toggle-icon {
    color: #495057;
}

[data-theme="dark"] .password-toggle-icon {
    color: #adb5bd;
}

[data-theme="dark"] .password-toggle:hover .password-toggle-icon {
    color: #ffffff;
}

/* Password Requirements Tooltip */
.password-requirements-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.requirements-info-icon {
    color: #6c757d;
    cursor: help;
    transition: color 0.2s ease;
}

.requirements-info-icon:hover {
    color: #495057;
}

[data-theme="dark"] .requirements-info-icon {
    color: #adb5bd;
}

[data-theme="dark"] .requirements-info-icon:hover {
    color: #ffffff;
}

.requirements-tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 250px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .requirements-tooltip-content {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.password-requirements-tooltip:hover .requirements-tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* Tooltip arrow */
.requirements-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: white;
}

[data-theme="dark"] .requirements-tooltip-content::after {
    border-top-color: #2d2d2d;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.requirement:last-child {
    margin-bottom: 0;
}

.requirement-icon {
    width: 1rem;
    text-align: center;
    font-weight: bold;
}

.requirement.unmet {
    color: #dc3545;
}

.requirement.met {
    color: #28a745;
}

[data-theme="dark"] .requirement.unmet {
    color: #ff6b6b;
}

[data-theme="dark"] .requirement.met {
    color: #51cf66;
}

/* Loading States for Buttons */
.btn-spinner {
    display: inline-block;
    margin-left: 0.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

button[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Email Validation Styles */
.validation-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

[data-theme="dark"] .validation-error {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2) !important;
}

.validation-message {
    font-size: 0.85rem;
    margin-top: 0.25rem;
    padding: 0.25rem 0;
}

.validation-message.error {
    color: #dc3545;
}

[data-theme="dark"] .validation-message.error {
    color: #ff6b6b;
}

/* Mobile Touch Target Optimizations */
@media (max-width: 768px) {
    .password-toggle {
        padding: 0.5rem;
        right: 0.25rem;
    }
    
    .password-toggle-icon {
        font-size: 1.1rem;
    }
    
    .auth-btn {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .form-field input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Focus Management and Accessibility */
.password-toggle:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

[data-theme="dark"] .password-toggle:focus {
    outline-color: #ffcd39;
}

/* Keyboard shortcut hint styles */
.keyboard-hint {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.keyboard-hint.show {
    opacity: 1;
}

/* Password Reset Styles */

/* Reset form specific styling */
.reset-form-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 0 0.5rem;
}

[data-theme="dark"] .reset-form-description {
    color: #9ca3af;
}

/* Reset confirmation form styling */
.reset-confirm-form .form-field {
    margin-bottom: 1rem;
}

.reset-confirm-form .password-requirements {
    margin-bottom: 1.5rem;
}

/* Field description for password reset */
.field-description {
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    line-height: 1.3;
}

[data-theme="dark"] .field-description {
    color: #9ca3af;
}

/* Reset success message styling */
.reset-success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
}

[data-theme="dark"] .reset-success-message {
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.3);
    color: #4ade80;
}

/* Reset error message styling */
.reset-error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
}

[data-theme="dark"] .reset-error-message {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

/* Password reset link styling */
.forgot-password-link {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.forgot-password-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

[data-theme="dark"] .forgot-password-link {
    color: #ffcd39;
}

[data-theme="dark"] .forgot-password-link:hover {
    color: #fbbf24;
}

/* Back to login link styling */
.back-to-login-link {
    display: inline-block;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.back-to-login-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

[data-theme="dark"] .back-to-login-link {
    color: #9ca3af;
}

[data-theme="dark"] .back-to-login-link:hover {
    color: #ffcd39;
}

/* Password reset form submit button overrides */
.reset-form .auth-btn,
.reset-confirm-form .auth-btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* Token input field styling for reset confirmation */
.reset-confirm-form input[name="reset_token"],
.reset-confirm-form .token-field {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.05em;
    text-align: center;
    background-color: #f8f9fa;
    color: #495057;
}

[data-theme="dark"] .reset-confirm-form input[name="reset_token"],
[data-theme="dark"] .reset-confirm-form .token-field {
    background-color: #2d3748;
    color: #cbd5e0;
}

/* Rate limit message styling */
.rate-limit-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
}

[data-theme="dark"] .rate-limit-message {
    background: rgba(255, 205, 57, 0.1);
    border-color: rgba(255, 205, 57, 0.3);
    color: #ffcd39;
}

/* Password reset specific animation */
.reset-form-fade-in {
    animation: fadeInUp 0.4s ease-out;
}

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

/* Mobile responsiveness for password reset */
@media (max-width: 768px) {
    .reset-form-description {
        font-size: 0.85rem;
        margin-bottom: 1.25rem;
        padding: 0 0.25rem;
    }
    
    .field-description {
        font-size: 0.8rem;
    }
    
    .reset-success-message,
    .reset-error-message,
    .rate-limit-message {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    .forgot-password-link,
    .back-to-login-link {
        font-size: 0.85rem;
    }
}