@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   PenguBOT Admin - Login Page (Split-Screen)
   ============================================================ */

:root {
    --accent:         #6366f1;
    --accent-hover:   #4f46e5;
    --accent-fade:    rgba(99, 102, 241, 0.12);
    --bg-card:        #ffffff;
    --bg-input:       #ffffff;
    --bg-app:         #f1f5f9;
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --border:         #e2e8f0;
    --danger:         #ef4444;
    --danger-fade:    rgba(239, 68, 68, 0.12);
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow:    0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.14);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-card:        #111827;
    --bg-input:       #1e293b;
    --bg-app:         #0b1120;
    --text-primary:   #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted:     #64748b;
    --border:         #1f2937;
    --accent:         #818cf8;
    --accent-hover:   #a5b4fc;
    --accent-fade:    rgba(129, 140, 248, 0.12);
    --danger:         #f87171;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.login-page {
    background-color: var(--bg-app) !important;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    min-height: 100vh;
    padding: 0 !important;
    background-image: none !important;
    overflow: hidden;
    transition: background-color var(--transition);
}

/* ── Split layout ──────────────────────────────────────────── */
.login-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Left: brand panel */
.login-brand {
    flex: 0 0 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #7c3aed 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.login-brand::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    top: -120px;
    right: -120px;
    pointer-events: none;
}
.login-brand::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    bottom: -80px;
    left: -80px;
    pointer-events: none;
}

.brand-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 340px;
}

.brand-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.brand-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0 0 12px;
    color: #fff;
}

.brand-tagline {
    font-size: 15px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
    margin: 0 0 36px;
    line-height: 1.6;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    padding: 11px 16px;
    text-align: left;
    transition: background var(--transition);
}

.brand-feature:hover {
    background: rgba(255, 255, 255, 0.15);
}

.brand-feature-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.brand-feature-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Right: form panel */
.login-form-panel {
    flex: 0 0 50%;
    background-color: var(--bg-app);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow-y: auto;
    transition: background-color var(--transition);
}

/* Theme toggle */
.login-theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    padding: 0;
}
.login-theme-toggle:hover {
    background: var(--accent-fade);
    border-color: var(--accent);
    color: var(--accent);
}
.login-theme-toggle svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    position: absolute;
    transition: opacity var(--transition);
}
html[data-theme-pref="light"]  .login-theme-toggle .icon-sun    { opacity: 1; }
html[data-theme-pref="light"]  .login-theme-toggle .icon-moon   { opacity: 0; }
html[data-theme-pref="light"]  .login-theme-toggle .icon-system { opacity: 0; }
html[data-theme-pref="dark"]   .login-theme-toggle .icon-sun    { opacity: 0; }
html[data-theme-pref="dark"]   .login-theme-toggle .icon-moon   { opacity: 1; }
html[data-theme-pref="dark"]   .login-theme-toggle .icon-system { opacity: 0; }
html[data-theme-pref="system"] .login-theme-toggle .icon-sun    { opacity: 0; }
html[data-theme-pref="system"] .login-theme-toggle .icon-moon   { opacity: 0; }
html[data-theme-pref="system"] .login-theme-toggle .icon-system { opacity: 1; }
.login-theme-toggle .icon-sun    { opacity: 0; }
.login-theme-toggle .icon-moon   { opacity: 0; }
.login-theme-toggle .icon-system { opacity: 1; }

/* Form card */
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 36px;
    width: 100%;
    max-width: 400px;
    transition: background-color var(--transition), border-color var(--transition);
}

.login-card-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.login-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Form elements */
.login-form-group {
    margin-bottom: 16px;
}

.login-label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

.login-input {
    width: 100%;
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
    height: 42px !important;
    padding: 0 12px 0 38px !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition) !important;
    font-family: inherit !important;
}

.login-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-fade) !important;
}
.login-input::placeholder { color: var(--text-muted) !important; }

.login-input.has-error-field { border-color: var(--danger) !important; }
.login-input.has-error-field:focus { box-shadow: 0 0 0 3px var(--danger-fade) !important; }

.login-error-msg {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Remember me row */
.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}
.login-remember input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Submit button */
.login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    height: 44px;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
    box-shadow: 0 4px 12px var(--accent-fade);
    font-family: inherit;
}
.login-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 20px var(--accent-fade);
    transform: translateY(-1px);
}
.login-btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

/* Footer */
.login-attr {
    margin-top: 24px;
    text-align: center;
    font-size: 11.5px;
    color: var(--text-muted);
}
.login-attr a { color: var(--accent); text-decoration: none; }
.login-attr a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    body.login-page { overflow-y: auto; }
    .login-split { flex-direction: column; min-height: 100vh; }
    .login-brand {
        flex: 0 0 auto;
        padding: 40px 24px 32px;
        min-height: 240px;
    }
    .brand-features { display: none; }
    .brand-title { font-size: 26px; }
    .brand-tagline { font-size: 14px; margin-bottom: 0; }
    .login-form-panel {
        flex: 1;
        padding: 32px 20px;
        justify-content: flex-start;
    }
    .login-card {
        padding: 28px 20px;
        box-shadow: none;
        border: none;
        background: transparent;
    }
    .login-theme-toggle { top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .login-btn:hover { transform: none !important; }
}
