:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --danger: #ef4444;
    --success: #10b981;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --input-bg: #f1f5f9;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
    --shadow-hover: 0 15px 40px rgba(0,0,0,0.1);
    --brand-bg-1: #4f46e5;
    --brand-bg-2: #7c3aed;
    --brand-bg-3: #0ea5e9;
}

body.dark {
    --primary: #6366f1;
    --primary-dark: #818cf8;
    --primary-light: #312e81;
    --danger: #f87171;
    --success: #34d399;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --border: #334155;
    --input-bg: #0f172a;
    --shadow: 0 10px 30px rgba(0,0,0,0.3);
    --shadow-hover: 0 15px 40px rgba(0,0,0,0.5);
    --brand-bg-1: #312e81;
    --brand-bg-2: #4c1d95;
    --brand-bg-3: #0c4a6e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.4s ease, color 0.4s ease;
}

.auth-wrapper {
    width: 100%;
    max-width: 1100px;
    min-height: 600px;
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* Left Brand Panel */
.brand-panel {
    background: linear-gradient(135deg, var(--brand-bg-1) 0%, var(--brand-bg-2) 50%, var(--brand-bg-3) 100%);
    color: #fff;
    padding: 50px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.orbs { position: absolute; inset: 0; z-index: 0; }
.orb {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    animation: float 8s infinite ease-in-out;
}
.orb-1 { width: 250px; height: 250px; top: -50px; left: -50px; animation-delay: 0s; }
.orb-2 { width: 150px; height: 150px; bottom: 50px; right: -30px; animation-delay: 2s; }
.orb-3 { width: 100px; height: 100px; top: 40%; left: 20%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.brand-content { position: relative; z-index: 1; }
.brand-logo {
    width: 70px; height: 70px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 30px;
    font-size: 32px;
    color: #fff;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 20px; }

.brand-panel h1 { 
    font-size: 32px; 
    font-weight: 700; 
    margin-bottom: 10px;
    animation: fadeInLeft 0.8s ease-out;
}
.brand-slogan { 
    font-size: 15px; 
    opacity: 0.9; 
    margin-bottom: 40px;
    animation: fadeInLeft 0.8s ease-out 0.1s backwards;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    animation: fadeInLeft 0.8s ease-out 0.2s backwards;
}
.feature-item i {
    width: 32px; height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Right Form Panel */
.form-panel {
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 30px; right: 30px;
    width: 44px; height: 44px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
    transition: all 0.3s;
}
.theme-toggle:hover { color: var(--primary); transform: rotate(15deg); }

.form-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.form-view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}
.form-view.active {
    display: block;
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

.form-view h2 { 
    font-size: 28px; 
    font-weight: 700; 
    margin-bottom: 8px;
    color: var(--text);
}
.view-sub { 
    font-size: 14px; 
    color: var(--text-muted); 
    margin-bottom: 30px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: 500;
    transition: color 0.3s;
}
.back-link:hover { color: var(--primary); }

.auth-form .form-group { margin-bottom: 20px; }
.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}
.auth-form label i { color: var(--text-muted); margin-right: 4px; }

.input-wrap { position: relative; }
.input-wrap input {
    width: 100%;
    padding: 14px 16px;
    padding-right: 45px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
}
.input-wrap input::placeholder { color: var(--text-muted); }
.input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.toggle-pass {
    position: absolute;
    top: 50%; right: 12px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.toggle-pass:hover { color: var(--text); }

.form-actions {
    text-align: right;
    margin-bottom: 24px;
    margin-top: -10px;
}
.link-text {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s;
}
.link-text:hover { text-decoration: underline; }

.btn-auth {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
}
.btn-auth::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}
.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}
.btn-auth:hover::before { left: 100%; }
.btn-auth i { transition: transform 0.3s; }
.btn-auth:hover i { transform: translateX(4px); }

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: shake 0.4s ease-in-out;
}
.alert i { font-size: 16px; margin-top: 1px; }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Auth Footer */
.auth-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}
.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 900px) {
    .auth-wrapper {
        max-width: 450px;
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .brand-panel {
        display: none;
    }
    .form-panel {
        padding: 40px 30px;
        min-height: 100vh;
    }
}