/* ==========================================================================
   QOffice Premium Enterprise Login Page Redesign
   ========================================================================== */

/* Color scheme hints for the browser rendering engine */
:root, [data-theme="dark"] {
    color-scheme: dark;
}
[data-theme="light"] {
    color-scheme: light;
}

/* 1. Main Layout Structure */
.login-split-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    background-color: var(--bg-app);
    font-family: var(--font-sans), sans-serif;
}

/* Left Branding Side (40%) */
.login-left-branding {
    width: 40vw;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4rem 3.5rem;
    background-color: var(--bg-app);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Grid Overlay & Glowing Radial Backdrop */
.branding-grid-overlay {
    position: absolute;
    inset: 0;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, var(--border-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border-color) 1px, transparent 1px);
    opacity: 0.12;
    z-index: -2;
    pointer-events: none;
}

.branding-grid-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 40% 40%, transparent 20%, var(--bg-sidebar) 85%);
    pointer-events: none;
}

.branding-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.08) 0%, transparent 70%);
    top: 10%;
    left: -10%;
    z-index: -1;
    pointer-events: none;
}

/* Typography on Left Side */
.brand-header {
    z-index: 5;
}

.brand-header-logo img {
    height: 38px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.brand-header-logo .logo-dark {
    display: block !important;
}
.brand-header-logo .logo-light {
    display: none !important;
}
[data-theme="light"] .brand-header-logo .logo-dark {
    display: none !important;
}
[data-theme="light"] .brand-header-logo .logo-light {
    display: block !important;
}

.brand-content {
    margin-top: auto;
    margin-bottom: auto;
    z-index: 5;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-color);
    margin-bottom: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-tagline {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.brand-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 440px;
}

.brand-footer {
    z-index: 5;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-footer-pill {
    background-color: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 650;
    padding: 0.35rem 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Graphics container (subtle candlestick/graph overlay) */
.branding-graphic-container {
    position: absolute;
    bottom: -5%;
    right: -5%;
    width: 110%;
    height: 55%;
    z-index: 2;
    opacity: 0.35;
    pointer-events: none;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

/* Animations for SVGs */
@keyframes chartTrace {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

.trend-line-path {
    stroke: var(--accent-color);
    stroke-width: 2.5;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: chartTrace 4.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    filter: drop-shadow(0 4px 12px rgba(var(--accent-rgb), 0.4));
}

@keyframes pulseNode {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.4); opacity: 1; }
}

.chart-node {
    fill: var(--accent-color);
    transform-origin: center;
    animation: pulseNode 4s infinite ease-in-out;
}

.chart-node-2 {
    fill: var(--success-color);
    transform-origin: center;
    animation: pulseNode 3s infinite ease-in-out 1s;
}

/* Right Authentication Side (60%) */
.login-right-auth {
    width: 60vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 3.5rem;
    background-color: var(--bg-app);
    position: relative;
    overflow-y: auto;
}

/* Theme Toggle Button */
.theme-toggle-wrapper {
    position: absolute;
    top: 2.5rem;
    right: 3.5rem;
    z-index: 10;
}

.theme-toggle-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-color-hover);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-md);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

.theme-toggle-btn svg,
.theme-toggle-btn i {
    font-size: 1.15rem;
    stroke-width: 2px;
}

/* Authentication Card */
.auth-card {
    width: 100%;
    max-width: 600px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 4rem 3.75rem;
    z-index: 3;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Typography on Right Side */
.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 0.925rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Premium Form Elements */
.form-group-premium {
    margin-bottom: 1.5rem;
}

.form-label-premium {
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.input-premium-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-premium-group .input-icon-prefix {
    position: absolute;
    left: 1.15rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.25s ease;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-premium-group .form-control {
    padding-left: 2.75rem;
    padding-right: 1.15rem;
    height: 54px;
    font-size: 0.9rem;
    font-weight: 450;
    background-color: rgba(var(--accent-rgb), 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: none;
}

.input-premium-group .form-control:hover {
    border-color: var(--border-color-hover);
}

.input-premium-group .form-control:focus {
    background-color: var(--bg-surface);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
    color: var(--text-main) !important;
}

/* Ensure inputs always use the correct theme main color */
input.form-control,
input.form-control:focus,
#username,
#username:focus,
#password,
#password:focus {
    color: var(--text-main) !important;
}

/* Chrome autofill overrides specifically for login fields */
.input-premium-group .form-control:-webkit-autofill,
.input-premium-group .form-control:-webkit-autofill:hover,
.input-premium-group .form-control:-webkit-autofill:focus,
.input-premium-group .form-control:-webkit-autofill:active,
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-internal-autofill-selected,
input:-internal-autofill-previewed,
input:autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

.input-premium-group .form-control:focus ~ .input-icon-prefix {
    color: var(--accent-color);
}

/* Password Toggle Suffix */
.input-premium-group .password-toggle-addon {
    position: absolute;
    right: 0.6rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.input-premium-group .password-toggle-addon:hover {
    color: var(--text-main);
}

.input-premium-group .form-control.has-toggle {
    padding-right: 2.85rem;
}

/* Validation/Error alerts */
.validation-error-msg {
    color: var(--danger-color);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.validation-error-msg i,
.validation-error-msg svg {
    font-size: 0.9rem;
}

/* Custom Checkbox & Forgot Link row */
.form-checkbox-custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.form-checkbox-custom .form-check-input {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-surface);
    transition: all 0.2s ease;
    margin: 0;
    cursor: pointer;
    box-shadow: none;
}

.form-checkbox-custom .form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.form-checkbox-custom .form-check-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 600;
    transition: color 0.2s ease;
    text-decoration: none;
}

.forgot-link:hover {
    color: var(--accent-color-hover);
    text-decoration: underline;
}

/* Sign In Button styling */
.btn-premium-action {
    background-color: var(--accent-color);
    border: 1px solid var(--accent-color);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.95rem;
    height: 54px;
    border-radius: var(--radius-md);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(var(--accent-rgb), 0.15), 0 2px 4px -1px rgba(var(--accent-rgb), 0.08);
}

.btn-premium-action:hover {
    background-color: var(--accent-color-hover);
    border-color: var(--accent-color-hover);
    transform: translateY(-1.5px);
    box-shadow: 0 10px 15px -3px rgba(var(--accent-rgb), 0.25), 0 4px 6px -2px rgba(var(--accent-rgb), 0.15);
}

.btn-premium-action:active {
    transform: translateY(0);
}

.btn-premium-action:disabled {
    background-color: var(--border-color) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Security Trust Badges Grid */
.security-indicators-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 2rem;
    width: 100%;
    max-width: 600px;
    z-index: 3;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    background-color: rgba(var(--accent-rgb), 0.025);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.security-badge:hover {
    background-color: rgba(var(--accent-rgb), 0.05);
    border-color: var(--border-color-hover);
}

.security-badge i,
.security-badge svg {
    color: var(--success-color);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.security-badge-text {
    font-size: 0.725rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* Footer Section */
.login-footer {
    margin-top: auto;
    text-align: center;
    font-size: 0.775rem;
    color: var(--text-muted);
    line-height: 1.6;
    z-index: 3;
    width: 100%;
    max-width: 600px;
    padding-top: 2.5rem;
}

.login-footer a {
    color: var(--accent-color);
    font-weight: 550;
    transition: color 0.15s ease;
}

.login-footer a:hover {
    color: var(--accent-color-hover);
    text-decoration: underline;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
    .login-left-branding {
        padding: 3rem 2.5rem;
    }
    .login-right-auth {
        padding: 3rem 2.5rem;
    }
    .brand-tagline {
        font-size: 1.85rem;
    }
}

@media (max-width: 1024px) {
    .login-split-container {
        flex-direction: column;
        overflow-y: auto;
    }
    .login-left-branding {
        width: 100%;
        height: auto;
        min-height: 340px;
        padding: 3.5rem 3rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .login-right-auth {
        width: 100%;
        min-height: calc(100vh - 340px);
        padding: 3.5rem 3rem;
        justify-content: center;
    }
    .branding-graphic-container {
        height: 50%;
        bottom: 0;
        right: 0;
        width: 100%;
    }
    .login-footer {
        padding-top: 2rem;
    }
}

@media (max-width: 768px) {
    .login-left-branding {
        display: none !important;
    }
    .login-right-auth {
        width: 100% !important;
        min-height: 100vh !important;
        padding: 2.5rem 1.5rem !important;
        justify-content: center !important;
    }
    .theme-toggle-wrapper {
        top: 1.5rem;
        right: 1.5rem;
    }
    .auth-card {
        padding: 2rem 0;
        border: none;
        box-shadow: none;
        background-color: transparent;
    }
    .security-indicators-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.35rem;
        margin-top: 1.5rem;
    }
    .security-badge {
        flex-direction: column;
        justify-content: center;
        padding: 0.5rem 0.2rem;
        gap: 0.35rem;
    }
    .security-badge-text {
        font-size: 0.65rem;
        text-align: center;
        line-height: 1.1;
    }
    .login-footer {
        padding-top: 1.5rem;
    }
}
