/*
 * Login Theme — split layout styles.
 * Loaded via web_include_css (render-blocking, in <head>).
 * Selectors are scoped to .login-split-* classes created by login_theme.js,
 * so this CSS has zero effect on non-login pages.
 */

/* CSS Variables for theming (overridden dynamically by login_theme.js) */
:root {
    --login-primary: #2563eb;
    --login-primary-hover: #1d4ed8;
    --login-text: #0f172a;
    --login-text-muted: #64748b;
    --login-border: #d1d5db;
    --login-bg: #fff;
    --login-input-bg: #fff;
}

/* Fullscreen Overlay Wrapper */
.login-split-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* Left side - Image column */
.login-split-left {
    flex: 0 0 50%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
}

.login-split-left img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
}

/* Right side - Form column */
.login-split-right {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--login-bg);
    position: relative;
    overflow-y: auto;
}

/* Form container */
.login-split-right .login-form-container {
    max-width: 420px;
    width: 100%;
    animation: slideUp 0.6s ease-out forwards;
}

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

/* Header area */
.login-custom-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-custom-header .login-logo {
    max-width: 200px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
}

.login-custom-header .login-subtitle {
    font-size: 15px;
    color: var(--login-text-muted);
    margin-bottom: 8px;
}

.login-custom-header .login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--login-text);
    margin: 0;
    line-height: 1.2;
}

/* Form styling overrides */
.login-split-right .form-group { margin-bottom: 20px; }
.login-split-right label { display: block; font-size: 14px; font-weight: 500; color: var(--login-text); margin-bottom: 8px; }
.login-split-right .form-control {
    width: 100%; height: 48px; padding: 0 16px; font-size: 15px;
    color: var(--login-text); background: var(--login-input-bg);
    border: 1px solid var(--login-border); border-radius: 8px;
    transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.login-split-right .form-control:focus {
    outline: none; border-color: var(--login-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Fix: Select dropdown - text alignment and arrow centering */
.login-split-right select.form-control {
    text-align: left;
    text-align-last: left;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
}

/* Buttons */
.login-split-right .btn-primary, .login-split-right .btn-login {
    width: 100%; height: 48px; font-size: 16px; font-weight: 600;
    background: var(--login-primary) !important; border: none !important;
    border-radius: 8px; box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    color: #fff !important;
}
.login-split-right .btn-primary:hover, .login-split-right .btn-login:hover {
    background: var(--login-primary-hover) !important;
    transform: translateY(-1px);
}

/* Social login buttons — preserve them (covers all Frappe selectors) */
.login-split-right .social-logins,
.login-split-right .oauth-providers,
.login-split-right #social_logins,
.login-split-right .btn-default[data-provider],
.login-split-right .btn-ldap {
    display: block !important;
}

.login-split-right .social-logins .btn,
.login-split-right .oauth-providers .btn,
.login-split-right #social_logins .btn {
    margin-bottom: 8px;
    width: 100%;
    height: 44px;
    border-radius: 8px;
    font-size: 15px;
}

/* "Or" section divider */
.login-split-right .or-section {
    text-align: center;
    margin: 20px 0;
    color: var(--login-text-muted);
    font-size: 14px;
    position: relative;
}
.login-split-right .or-section::before,
.login-split-right .or-section::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--login-border);
}
.login-split-right .or-section::before { left: 0; }
.login-split-right .or-section::after { right: 0; }

/* Login with Email Link button */
.login-split-right .btn-login-with-email-link {
    width: 100%;
    height: 44px;
    border-radius: 8px;
    font-size: 15px;
    margin-top: 8px;
}

/* Hide signup-disabled message */
.login-split-right .sign-up-message { display: none !important; }

/* Helper links */
.login-split-right .forgot-password-link { text-align: right; margin-top: 14px; }
.login-split-right .forgot-password-link a { color: var(--login-text-muted); font-size: 14px; text-decoration: none; }
.login-split-right .forgot-password-link a:hover { color: var(--login-primary); }

/* Footer */
.login-custom-footer { margin-top: 32px; text-align: center; font-size: 13px; color: var(--login-text-muted); opacity: 0.8; }
.login-custom-footer.hidden { display: none; }

/* Input icons via background-image (no Font Awesome dependency) */
.login-split-right .with-icon-email {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='M22 7l-8.97 5.7a1.94 1.94 0 01-2.06 0L2 7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 18px;
    padding-left: 44px !important;
}
.login-split-right .with-icon-lock {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0110 0v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 18px;
    padding-left: 44px !important;
}

/* Hide misplaced icon elements from Frappe/website themes */
.login-split-right .form-group i,
.login-split-right .form-group .icon,
.login-split-right .form-group svg.icon,
.login-split-right .es-lock,
.login-split-right svg use[href*="es-line-"],
.login-split-right svg use[class*="es-"] {
    display: none !important;
}
.login-split-right .form-group svg:not(.toggle-password-icon) {
    display: none !important;
}

/* Password toggle */
.login-split-right .toggle-password {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    font-size: 13px; color: var(--login-text-muted); background: none; border: none;
    cursor: pointer; z-index: 2; padding: 4px 8px;
}
.login-split-right .toggle-password:hover { color: var(--login-primary); }
.login-split-right .password-field { position: relative; }

/* Login error message */
.login-split-right .login-error-message {
    padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
    background: #fef2f2; color: #991b1b; display: none; text-align: center;
}
.login-split-right .login-error-message.visible { display: block; animation: shakeX 0.4s ease; }
@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Forgot password view (inline toggle, no page navigation) */
.login-split-right .forgot-view { display: none; }
.login-split-right .forgot-heading {
    font-size: 24px; font-weight: 700; color: var(--login-text); margin-bottom: 8px;
}
.login-split-right .forgot-subtext {
    color: var(--login-text-muted); font-size: 15px; margin-bottom: 24px;
}
.login-split-right .forgot-message {
    padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; display: none;
}
.login-split-right .forgot-message.success { background: #ecfdf5; color: #065f46; display: block; }
.login-split-right .forgot-message.error { background: #fef2f2; color: #991b1b; display: block; }
.login-split-right .btn-reset-password {
    width: 100%; height: 48px; font-size: 16px; font-weight: 600;
    background: var(--login-primary) !important; border: none !important;
    border-radius: 8px; color: #fff !important; cursor: pointer;
}
.login-split-right .btn-reset-password:hover { background: var(--login-primary-hover) !important; }
.login-split-right .btn-reset-password:disabled { opacity: 0.6; cursor: not-allowed; }
.login-split-right .back-to-login {
    color: var(--login-text-muted); text-decoration: none; font-size: 14px;
}
.login-split-right .back-to-login:hover { color: var(--login-primary); }

/* Email link login view */
.login-split-right .email-link-view { display: none; }
.login-split-right .email-link-view .page-card-body { padding: 0; border: none; box-shadow: none; }
.login-split-right .email-link-view .btn-primary {
    width: 100%; height: 48px; font-size: 16px; font-weight: 600;
    background: var(--login-primary) !important; border: none !important;
    border-radius: 8px; color: #fff !important;
}
.login-split-right .email-link-view .btn-primary:hover { background: var(--login-primary-hover) !important; }

/* Mobile responsive */
@media (max-width: 900px) {
    .login-split-left { display: none; }
    .login-split-right { padding: 24px; }
}
