:root {
    --font-main: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Base Layouts */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Variant 1: Split Form Left, KPI Right */
.layout-1 { flex-direction: row; }
.layout-1 .login-section { width: 40%; background: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: center; }
.layout-1 .kpi-section { width: 60%; background: var(--app-accent); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; }

/* Variant 2: Split KPI Left, Form Right */
.layout-2 { flex-direction: row-reverse; }
.layout-2 .login-section { width: 45%; background: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.layout-2 .kpi-section { width: 55%; background: #0f172a; color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; border-right: 8px solid var(--app-accent); }
.layout-2 .kpi-card { background: rgba(255,255,255,0.05); }

/* Variant 3: Centered Card with KPI Bottom */
.layout-3 { flex-direction: column; align-items: center; justify-content: center; background: #f1f5f9; padding: 40px 20px; }
.layout-3 .login-section { width: 100%; max-width: 480px; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(12px); padding: 40px; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); margin-bottom: 30px; border-top: 4px solid var(--app-accent); }
.layout-3 .kpi-section { width: 100%; max-width: 1000px; }
.layout-3 .kpi-grid { grid-template-columns: repeat(4, 1fr); }
.layout-3 .kpi-card { background: #fff; border: 1px solid #e2e8f0; border-left: 3px solid var(--app-accent); color: #0f172a; }

/* Variant 4: Sidebar Branding Left, Content Right */
.layout-4 { flex-direction: row; }
.layout-4 .kpi-section { width: 300px; background: var(--app-accent); color: #fff; padding: 30px 20px; display: flex; flex-direction: column; }
.layout-4 .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
.layout-4 .login-section { flex: 1; background: #f8fafc; display: flex; align-items: center; justify-content: center; }
.layout-4 .login-card { background: #fff; padding: 50px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); max-width: 450px; width: 100%; }

/* Variant 5: Dashboard Bg with Floating Form Right */
.layout-5 { position: relative; background: #e2e8f0; }
.layout-5 .kpi-section { position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 40px; background: linear-gradient(135deg, var(--app-accent) 0%, #1e293b 100%); color: #fff; z-index: 1; display: flex; align-items: flex-start; }
.layout-5 .kpi-grid { grid-template-columns: repeat(2, 1fr); max-width: 600px; }
.layout-5 .login-section { position: relative; z-index: 2; margin-left: auto; width: 450px; background: #fff; min-height: 100vh; padding: 60px 40px; display: flex; flex-direction: column; justify-content: center; box-shadow: -10px 0 30px rgba(0,0,0,0.1); }

/* Variant 6: Floating Form Left, Dashboard Right */
.layout-6 { position: relative; background: #f8fafc; }
.layout-6 .kpi-section { position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 60px 40px 40px 500px; background: #0f172a; color: #fff; z-index: 1; }
.layout-6 .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
.layout-6 .kpi-card { border-top: 2px solid var(--app-accent); background: rgba(255,255,255,0.03); }
.layout-6 .login-section { position: relative; z-index: 2; width: 450px; background: #fff; min-height: 100vh; padding: 60px 40px; display: flex; flex-direction: column; justify-content: center; box-shadow: 10px 0 30px rgba(0,0,0,0.1); }

/* Variant 7: Minimalist SaaS */
.layout-7 { flex-direction: column; background: #ffffff; }
.layout-7 .header-nav { width: 100%; padding: 20px 40px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); position: relative; z-index: 10; }
.layout-7 .main-content { display: flex; flex: 1; position: relative; z-index: 2; }
.layout-7 .login-section { width: 50%; padding: 60px; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e2e8f0; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(12px); }
.layout-7 .kpi-section { width: 50%; padding: 60px; display: flex; flex-direction: column; justify-content: center; background: rgba(248, 250, 252, 0.7); backdrop-filter: blur(12px); }
.layout-7 .kpi-card { background: #fff; border: 1px solid #e2e8f0; color: #0f172a; }
.layout-7 .kpi-card .k-value { color: var(--app-accent); }

/* Variant 8: Premium Dark Style */
.layout-8 { flex-direction: row; background: #0f172a; color: #f8fafc; }
.layout-8 .login-section { width: 400px; background: #fff; padding: 50px 40px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid #e2e8f0; }
.layout-8 .kpi-section { flex: 1; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.layout-8 .kpi-card { background: #1e293b; border: 1px solid #334155; }
.layout-8 .kpi-card .k-label { color: #94a3b8; }
.layout-8 .btn-primary { background: var(--app-accent); color: #fff; }

/* Responsive Overrides */
@media (max-width: 900px) {
    .layout-wrapper { flex-direction: column !important; }
    .login-section, .kpi-section { width: 100% !important; min-height: auto !important; padding: 30px 20px !important; }
    .layout-5 .kpi-section, .layout-6 .kpi-section { position: relative; padding: 30px !important; }
    .layout-7 .main-content { flex-direction: column; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Shared UI Elements */
.brand { margin-bottom: 30px; }
.brand h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.5px; }
.brand p { color: #64748b; font-size: 0.95rem; }

.login-form { display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 380px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.9rem; font-weight: 600; color: #334155; letter-spacing: -0.2px; }
.input-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.input-wrapper input { width: 100%; padding: 14px 16px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 1rem; color: #0f172a; transition: all 0.2s ease; background: #f8fafc; box-shadow: inset 0 1px 2px rgba(0,0,0,0.02); }
.input-wrapper input::placeholder { color: #94a3b8; opacity: 1; }
.input-wrapper input:focus { outline: none; border-color: #2563eb; background: #ffffff; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), inset 0 1px 2px rgba(0,0,0,0.02); }

.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 10px; cursor: pointer; color: #64748b; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.2s; display: flex; align-items: center; justify-content: center; height: 28px; }
.toggle-password:hover { background: #e2e8f0; color: #334155; }
.input-wrapper input[type="password"] { padding-right: 70px; }

.form-actions { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; margin-top: -4px; }
.form-actions label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #64748b; user-select: none; }
.form-actions input[type="checkbox"] { width: 16px; height: 16px; border-radius: 4px; border: 1px solid #cbd5e1; cursor: pointer; accent-color: #2563eb; }
.form-actions a { color: #2563eb; text-decoration: none; font-weight: 600; transition: opacity 0.2s; }
.form-actions a:hover { opacity: 0.8; }

.btn-primary { padding: 14px 20px; border: none; border-radius: 10px; background: #2563eb; color: #ffffff; font-weight: 600; font-size: 1.05rem; cursor: pointer; transition: all 0.2s ease; width: 100%; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3); opacity: 0.95; }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2); }

.error-message { display: none; padding: 14px 16px; background: #fef2f2; border: 1px solid #fecaca; border-left: 4px solid #ef4444; color: #b91c1c; font-size: 0.9rem; border-radius: 8px; margin-bottom: 24px; font-weight: 500; }

.kpi-brand { margin-bottom: 40px; }
.kpi-brand h2 { font-size: 2.5rem; font-weight: 800; margin-bottom: 12px; letter-spacing: -1px; }
.kpi-brand p { font-size: 1.1rem; opacity: 0.9; max-width: 400px; }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; width: 100%; }
.kpi-card { background: rgba(0,0,0,0.1); padding: 20px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.k-label { font-size: 0.875rem; opacity: 0.8; font-weight: 500; }
.k-value { font-size: 1.75rem; font-weight: 700; }

.back-link { position: absolute; top: 20px; left: 20px; color: inherit; text-decoration: none; font-size: 0.875rem; font-weight: 500; opacity: 0.7; z-index: 10; display: flex; align-items: center; gap: 6px; }
.back-link:hover { opacity: 1; }
.layout-7 .back-link { position: static; color: #64748b; }

/* Background Implementation */
.kpi-section {
    position: relative;
    overflow: hidden;
}
.app-background {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.app-background .bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.8;
}
.app-background .bg-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.1) 100%);
}
.bg-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
}

/* Variant Specific Overlays and Colors */
.layout-1 .app-background .bg-image, .layout-4 .app-background .bg-image { 
    opacity: 0.2; 
    mix-blend-mode: luminosity;
}
.layout-1 .bg-overlay, .layout-4 .bg-overlay {
    background: linear-gradient(135deg, var(--app-accent) 0%, rgba(0,0,0,0.4) 100%);
    mix-blend-mode: multiply;
}

.layout-2 .app-background .bg-image, .layout-6 .app-background .bg-image { 
    opacity: 0.3;
}
.layout-2 .bg-overlay, .layout-6 .bg-overlay {
    background: linear-gradient(to bottom right, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.layout-5 .app-background .bg-image {
    opacity: 0.4;
}
.layout-5 .bg-overlay {
    background: linear-gradient(135deg, var(--app-accent) 0%, rgba(30, 41, 59, 0.9) 100%);
    mix-blend-mode: multiply;
}

.layout-8 .app-background .bg-image {
    opacity: 0.25;
    filter: grayscale(50%);
}
.layout-8 .bg-overlay {
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.6) 0%, rgba(15, 23, 42, 0.95) 100%);
}

/* Full Screen Backgrounds for Layouts 3 & 7 */
.app-background.full-bg {
    position: fixed;
    z-index: 0;
}
.layout-3 .app-background.full-bg .bg-image {
    opacity: 0.15;
}
.layout-3 .bg-overlay {
    background: linear-gradient(to bottom, rgba(241, 245, 249, 0.85) 0%, rgba(241, 245, 249, 0.98) 100%);
}
.layout-7 .app-background.full-bg .bg-image {
    opacity: 0.2;
}
.layout-7 .bg-overlay {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
}

/* Glass Panel for Login Card */
.glass-panel {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
}
