/* ============================================
   My Account & Authentication Styles
   ============================================ */

/* Body Backgrounds */
body.woocommerce-account.logged-out,
body.woocommerce-account:not(.woocommerce-lost-password),
body.woocommerce-lost-password {
    background: #f8f9fa;
}

/* Hide WooCommerce default password strength indicators */
#password_strength,
.woocommerce-password-strength,
.woocommerce-password-hint {
    display: none !important;
}

/* ============================================
   Auth Container - Main Card
   ============================================ */
.trulife-auth-container {
    max-width: 600px;
    margin: 60px auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* ============================================
   Form Layout for Full Registration
   ============================================ */
.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.auth-form-half {
    margin-bottom: 0;
}

.auth-form-notice {
    margin-top: 20px;
    padding: 15px;
    background: #f0f9ff;
    border-left: 4px solid #0ea5e9;
    border-radius: 6px;
}

.auth-form-notice small {
    color: #0369a1;
    line-height: 1.5;
}

.password-requirements {
    margin-top: 8px;
}

.password-requirements small {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

/* ============================================
   Password Strength & Validation
   ============================================ */

/* Password wrapper - ensure proper structure */
.auth-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.auth-password-wrapper .auth-input {
    flex: 1;
    width: 100%;
}

.auth-password-wrapper .password-toggle {
    flex-shrink: 0;
    margin-left: 10px;
    position: relative;
    z-index: 2;
}

/* Password strength container */
.password-strength-container {
    margin-top: 8px;
    width: 100%;
    min-height: 0;
    clear: both;
}

/* Enhanced Password Strength Indicator */
.password-strength {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    margin: 8px 0 12px 0;
    animation: slideIn 0.3s ease;
}

.password-strength.weak {
    border-color: #ef4444;
    background: #fef2f2;
}

.password-strength.medium {
    border-color: #f59e0b;
    background: #fffbeb;
}

.password-strength.strong {
    border-color: #10b981;
    background: #f0fdf4;
}

/* Strength Bar with Gradient */
.strength-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.password-strength.weak .strength-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.password-strength.medium .strength-fill {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.password-strength.strong .strength-fill {
    background: linear-gradient(90deg, #10b981, #34d399);
}

/* Strength Text */
.strength-text {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.2;
}

.password-strength.weak .strength-text {
    color: #dc2626;
}

.password-strength.medium .strength-text {
    color: #d97706;
}

.password-strength.strong .strength-text {
    color: #059669;
}

/* Strength Feedback */
.strength-feedback {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
}

/* Enhanced Error Messages */
.password-confirm-error,
.privacy-policy-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
    padding: 8px 12px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    display: none;
    animation: slideIn 0.3s ease;
    font-weight: 500;
}

/* ============================================
   Enhanced Form Container Styling
   ============================================ */

.woocommerce-form-register {
    background: #ffffff;
    border-radius: 16px;
    margin: 20px 0;
    transition: all 0.3s ease;
    width: 100%;
    min-width: 380px;
    box-sizing: border-box;
}

/* Enhanced Input Fields */
.auth-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    background-color: #f9fafb;
    transition: all 0.3s ease;
    box-sizing: border-box;
    outline: none;
}

.auth-input:focus {
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-input.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

.auth-input.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    animation: shake 0.3s ease;
}

/* Enhanced Password Wrapper */
.auth-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    z-index: 1;
}

/* Enhanced Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.password-toggle:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.05);
}

.password-toggle .eye-icon {
    color: #6b7280;
    transition: color 0.2s ease;
}

.password-toggle:hover .eye-icon {
    color: #3b82f6;
}

/* Enhanced Button Styling */
.woocommerce-Button,
.auth-submit {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    width: 100%;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.woocommerce-Button:hover,
.auth-submit:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.woocommerce-Button:active,
.auth-submit:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

.woocommerce-Button.loading,
.auth-submit.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.woocommerce-Button.loading::after,
.auth-submit.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Enhanced Checkbox Styling */
.auth-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.auth-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0 0;
    accent-color: #3b82f6;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid #d1d5db;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.auth-checkbox input[type="checkbox"]:checked {
    border-color: #3b82f6;
    background-color: #3b82f6;
}

.auth-checkbox label {
    cursor: pointer;
    color: #4b5563;
    user-select: none;
    margin: 0;
    display: flex;
    align-items: flex-start;
}

.auth-checkbox a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-checkbox a:hover {
    color: #2563eb;
}

/* Enhanced Form Group Spacing */
.auth-form-group {
    margin-bottom: 20px;
    position: relative;
    width: 100%;
}

.auth-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.auth-form-group label svg {
    flex-shrink: 0;
}

/* Special spacing for password field group */
.auth-form-group:has(#reg_password) {
    margin-bottom: 0;
}

.auth-form-group:has(#reg_password_confirm) {
    margin-top: 12px;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

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

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Ripple Effect */
.woocommerce-form-register {
    animation: fadeInUp 0.5s ease-out;
}

.ripple {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    pointer-events: none;
}

/* Enhanced Focus Management */
.auth-input:focus {
    outline: none;
    z-index: 10;
}

/* Responsive Behavior */
@media (max-width: 480px) {
    .woocommerce-form-register {
        min-width: auto;
        width: 100%;
        padding: 20px;
        margin: 10px 0;
    }

    .auth-form-group {
        margin-bottom: 16px;
    }

    .auth-input {
        padding: 12px 14px;
        font-size: 14px;
    }

    .woocommerce-Button,
    .auth-submit {
        padding: 12px 20px;
        font-size: 15px;
    }

    .auth-checkbox {
        font-size: 13px;
    }

    .password-strength {
        padding: 10px;
        margin: 6px 0 10px 0;
    }

    .strength-text {
        font-size: 12px;
    }

    .strength-feedback {
        font-size: 11px;
    }
}

@media (max-width: 400px) {
    .woocommerce-form-register {
        padding: 15px;
    }

    .auth-form-group label {
        font-size: 13px;
    }

    .auth-input {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Better text overflow handling */
.auth-form-group {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure consistent line heights */
.strength-text {
    line-height: 1.2;
}

.strength-feedback {
    line-height: 1.3;
}

/* Tab switching animations */
.u-column1, .u-column2 {
    transition: all 0.3s ease;
}

/* Fix for potential conflicts */
.woocommerce-form-register .password-strength {
    position: static !important;
    width: 100% !important;
    left: auto !important;
    right: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.woocommerce-form-register .password-strength-container {
    position: static !important;
    width: 100% !important;
}

/* ============================================
   Tab Navigation (Login/Register)
   ============================================ */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 2px solid #f1f3f5;
    background: #f8f9fa;
}

.auth-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.auth-tab:hover {
    color: var(--tl-primary,#dc4d28);
    background: #fff;
}

.auth-tab.active {
    color: var(--tl-primary,#dc4d28);
    background: white;
}


/* ============================================
   Form Wrapper Display Logic
   ============================================ */

/* Hide by default for tab switching */
body.woocommerce-account .auth-form-wrapper {
    display: none;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
}

/* Show active form */
body.woocommerce-account .auth-form-wrapper.active {
    display: block;
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.3s ease;
}

/* Always show on lost password page */
body.woocommerce-lost-password .auth-form-wrapper {
    display: block;
    padding: 40px;
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Form Sections (Header, Footer)
   ============================================ */

/* Lost Password Header */
.auth-header {
    padding: 40px 40px 0 40px;
    text-align: center;
}

.auth-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.auth-header p {
    color: #6b7280;
    margin: 0 0 32px 0;
    line-height: 1.6;
}

/* Login/Register Header */
.auth-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-form-title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.auth-form-subtitle {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* Footer */
.auth-footer {
    padding: 0 40px 40px 40px;
    text-align: center;
}

.auth-footer p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.auth-footer a {
    color: var(--tl-primary,#dc4d28);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}

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

/* ============================================
   Form Elements
   ============================================ */

/* Lost Password Form Groups */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: #f9fafb;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--tl-primary,#dc4d28);
    background: white;
    box-shadow: 0 0 0 4px color-mix(in srgb,var(--tl-primary,#dc4d28) 10%,transparent);
}

/* Login/Register Form Groups */
.auth-form-group {
    margin-bottom: 24px;
}

.auth-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.auth-form-group label svg {
    flex-shrink: 0;
    color: #9ca3af;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: #f9fafb;
    font-family: inherit;
}

.auth-input:focus {
    outline: none;
    border-color: var(--tl-primary,#dc4d28);
    background: white;
    box-shadow: 0 0 0 4px color-mix(in srgb,var(--tl-primary,#dc4d28) 10%,transparent);
}

.auth-input::placeholder {
    color: #9ca3af;
}

.form-actions {
    margin-top: 32px;
}

/* ============================================
   Additional Login/Register Elements
   ============================================ */

/* Password Wrapper */
.auth-password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--tl-primary,#dc4d28);
}

.password-toggle.active {
    color: var(--tl-primary,#dc4d28);
}

/* Form Options */
.auth-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

/* Custom Checkbox */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    position: relative;
}

.auth-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.auth-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: white;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.auth-checkbox input:checked ~ .checkmark {
    background: var(--tl-primary,#dc4d28);
    border-color: var(--tl-primary,#dc4d28);
}

.auth-checkbox .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.auth-checkbox input:checked ~ .checkmark::after {
    transform: rotate(45deg) scale(1);
}

/* Auth Link */
.auth-link {
    font-size: 14px;
    color: var(--tl-primary,#dc4d28);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: var(--tl-primary-dark,#b83d1f);
    text-decoration: underline;
}

/* Info Text */
.auth-info-text {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    font-size: 14px;
    color: #0c4a6e;
    margin: 0 0 24px 0;
}

.auth-info-text svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #0ea5e9;
}

/* ============================================
   Submit Button
   ============================================ */
.auth-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--tl-primary,#dc4d28) 0%, var(--tl-primary-dark,#b83d1f) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px color-mix(in srgb,var(--tl-primary,#dc4d28) 30%,transparent);
    font-family: inherit;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb,var(--tl-primary,#dc4d28) 40%,transparent);
}

.auth-submit svg {
    transition: transform 0.3s ease;
}

.auth-submit:hover svg {
    transform: translateX(4px);
}

/* ============================================
   Focus & Interaction States
   ============================================ */
.auth-tab:focus,
.auth-tab:focus-visible,
.auth-submit:focus,
.auth-submit:focus-visible {
    outline: none;
    box-shadow: none;
}

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 640px) {
    .trulife-auth-container {
        margin: 30px 20px;
    }

    .auth-form-wrapper {
        padding: 30px 24px;
    }

    .auth-header h2 {
        font-size: 24px;
    }

    .auth-header p {
        font-size: 14px;
    }

    .auth-tab {
        font-size: 14px;
        padding: 16px;
    }

    .auth-tab svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================
   Hide Unused Elements
   ============================================ */
.login-register-visual {
    display: none;
}

/* Hide WooCommerce error messages (we'll use existing toast system instead) */
.woocommerce-error {
    display: none !important;
}

.woocommerce-message {
    display: none !important;
}

.woocommerce-info {
    display: none !important;
}

/* ============================================
   My Account Page Layout (Logged In)
   ============================================ */
.woocommerce-account .woocommerce {
    max-width: 1340px;
    margin: 0 auto;
}

