/**
 * Custom Authentication Page Styling
 * Modern split-screen login/register experience
 * 
 * @package Logato_Theme
 */

/* ========================================
   CRITICAL RESETS FOR FULL-PAGE AUTH
======================================== */

/* Reset everything for the auth page */
body.myaccount-login-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Force hide theme header/footer/sidebar */
body.myaccount-login-page header,
body.myaccount-login-page footer,
body.myaccount-login-page .top-header,
body.myaccount-login-page .site-header,
body.myaccount-login-page .site-footer,
body.myaccount-login-page .site-info,
body.myaccount-login-page #colophon,
body.myaccount-login-page #masthead,
body.myaccount-login-page .page-container,
body.myaccount-login-page .entry-title {
    display: none !important;
}

/* Remove all container constraints */
body.myaccount-login-page #page,
body.myaccount-login-page .site,
body.myaccount-login-page .site-main,
body.myaccount-login-page #primary,
body.myaccount-login-page .woocommerce,
body.myaccount-login-page .woocommerce-MyAccount-content,
body.myaccount-login-page article {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ========================================
   AUTH WRAPPER - TRUE FULL VIEWPORT
======================================== */

.logato-auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    background: #fff;
    z-index: 9999;
}

/* ========================================
   AUTH CONTAINER - 50/50 SPLIT
======================================== */

.woocommerce .woocommerce-form-login .woocommerce-form-login__rememberme
{
    display: flex;
    align-items: center;
}

.logato-auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* TRUE 50/50 SPLIT */
    width: 100%;
    height: 100vh;
}

/* Back to Home Link - Positioned below the form */
.back-to-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding: 12px 24px;
    background: #f5f5f7;
    border-radius: 50px;
    margin-top: 30px;
}

.back-to-home:hover {
    background: var(--primary-color);
    color: #fff;
}

.back-to-home svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* ========================================
   LEFT SIDE: BRAND & WELCOME (PURPLE)
======================================== */

.logato-auth-brand {
    background: linear-gradient(145deg, var(--primary-color) 0%, #2d1f5c 100%);
    color: #fff;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    height: 100vh;
}

.logato-auth-brand-content {
    position: relative;
    z-index: 2;
    max-width: 480px;
    text-align: center;
}

/* Illustration Styling */
.auth-illustration {
    margin: 40px auto;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.15));
}

.auth-illustration img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.auth-logo {
    margin-bottom: 30px;
}

.auth-logo img {
    max-width: 150px;
    height: auto;
    filter: brightness(0) invert(1);
}

.auth-welcome-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.3;
    color: #fff;
}

.auth-welcome-subtitle {
    font-size: 1.1rem;
    margin-bottom: 40px;
    opacity: 0.85;
    line-height: 1.6;
}

/* Features List */
.auth-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    opacity: 0.9;
}

.auth-feature svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    stroke-width: 3;
    color: #FFEE58; /* Highlight checkmarks */
}

/* ========================================
   RIGHT SIDE: FORMS (WHITE)
======================================== */

.logato-auth-forms {
    padding: 60px 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    height: 100vh;
    overflow-y: auto;
}

.logato-auth-forms-content {
    width: 100%;
    max-width: 480px;
}

/* Single Form Title (when registration is disabled) */
.auth-single-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 40px;
    color: #1a1a1a;
    text-align: center;
}

/* ========================================
   TAB SWITCHER
======================================== */

.logato-auth-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    background: #f5f5f7;
    padding: 8px;
    border-radius: 16px;
}

.logato-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.logato-tab-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.logato-tab-btn:hover {
    color: var(--primary-color);
}

.logato-tab-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.logato-tab-btn.active svg {
    transform: scale(1.1);
}

/* ========================================
   TAB CONTENT
======================================== */

.logato-tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.logato-tab-content.active,
.logato-tab-content.single-form {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   FORM STYLING
======================================== */

.logato-auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.95rem;
}

.form-group label svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.form-group label .required {
    color: #ff3b30;
    margin-right: 5px;
}

body.rtl .form-group label .required {
    margin-right: 0;
    margin-left: 5px;
}

/* Input Fields */
.logato-auth-form input[type="text"],
.logato-auth-form input[type="password"],
.logato-auth-form input[type="email"] {
    width: 100% !important;
    padding: 16px 20px !important;
    border: 2px solid #eaebf0 !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    transition: all 0.2s ease !important;
    background: #fcfcfd !important;
    box-shadow: none !important;
    color: #101828 !important;
}

.logato-auth-form input:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(80, 58, 168, 0.1) !important;
}

/* Fix browser autofill colors and overflow */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
    border: 2px solid var(--primary-color) !important;
    -webkit-text-fill-color: #101828 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Remember Me Checkbox */
.form-remember {
    margin-bottom: 30px;
}

.form-remember label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #666;
}

.form-remember input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Auto Password Notice */
.auto-password-notice {
    padding: 15px 20px;
    background: #f0f7ff;
    border-radius: 12px;
    color: #1a56db;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* Main Primary Button */
.woocommerce-form-login .woocommerce-button, 
.woocommerce-form-register .woocommerce-button, 
.woocommerce-account .woocommerce-form-login button[type="submit"], 
.woocommerce-account .woocommerce-form-register button[type="submit"], 
.woocommerce-account .woocommerce button.woocommerce-button[name="login"], 
.woocommerce-account .woocommerce button.woocommerce-button[name="register"] {
    width: 100% !important;
    height: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 18px 32px !important;
    background: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-family: inherit !important;
    text-transform: none !important;
    margin-bottom: 25px !important;
}

.logato-btn-primary svg {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
    transition: transform 0.3s ease !important;
    flex-shrink: 0 !important;
}

.logato-btn-primary:hover {
    background: var(--primary-color-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 28px rgba(80, 58, 168, 0.3) !important;
}

.logato-btn-primary:hover svg {
    transform: translateX(5px) !important;
}

body.rtl .logato-btn-primary:hover svg {
    transform: translateX(-5px) !important;
}

/* Form Footer */
.form-footer {
    margin-top: 25px;
    text-align: center;
}

.forgot-password,
.back-to-login {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.forgot-password:hover,
.back-to-login:hover {
    color: var(--primary-color-hover);
    text-decoration: underline;
}

/* Auth Description (for Lost Password page) */
.auth-description {
    color: #666;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 30px;
    text-align: center;
}

/* ========================================
   WOOCOMMERCE NOTICES
======================================== */

.woocommerce-notices-wrapper {
    margin-bottom: 30px;
}

.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    list-style: none;
}

.woocommerce-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.woocommerce-message {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.woocommerce-info {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    color: #1a56db;
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

@media (max-width: 1200px) {
    .logato-auth-forms {
        padding: 60px 80px;
    }
    
    .logato-auth-brand {
        padding: 60px 50px;
    }
}

@media (max-width: 992px) {
    /* Hide brand section on mobile - show only forms */
    .logato-auth-brand {
        display: none !important;
    }
    
    .logato-auth-container {
        grid-template-columns: 1fr;
        min-height: 100vh;
    }
    
    .logato-auth-forms {
        padding: 60px 40px;
        height: auto;
        min-height: 100vh;
    }
    
    .logato-auth-wrapper {
        position: relative;
        height: auto;
        min-height: 100vh;
    }
}

@media (max-width: 768px) {
    .logato-auth-forms {
        padding: 50px 30px;
    }
    
    .logato-tab-btn {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    .logato-tab-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .auth-single-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logato-auth-forms {
        padding: 40px 20px;
    }
    
    .logato-auth-tabs {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 40px;
    }
    
    .logato-tab-btn {
        width: 100%;
    }
    
    .form-group input {
        padding: 14px 18px;
    }
    
    .logato-btn-primary {
        padding: 16px 28px;
        font-size: 1rem;
    }
    
    .auth-single-title {
        font-size: 1.3rem;
    }
    
    .auth-description {
        font-size: 0.9rem;
    }
}

/* ========================================
   RTL SUPPORT & FIXES
======================================== */

body.rtl .logato-auth-tabs {
    direction: rtl;
}

body.rtl .logato-tab-btn {
    flex-direction: row; /* Keep content order consistent */
}

body.rtl .form-group label {
    flex-direction: row; /* Icons on right of text in RTL */
}

body.rtl .logato-btn-primary {
    flex-direction: row;
}

body.rtl .auth-feature {
    flex-direction: row;
}

body.rtl .form-remember label {
    flex-direction: row;
}

/* Ensure icons stay on the natural start side in RTL */
body.rtl .form-group label svg {
    margin-right: 0;
    margin-left: 10px;
}

/* Global Fixes */
.logato-auth-wrapper * {
    box-sizing: border-box !important;
}

@media (max-width: 992px) {
    .logato-auth-brand {
        order: 1; /* Brand on top in mobile */
    }
    .logato-auth-forms {
        order: 2; /* Forms below brand */
    }
}
