/* ============================================
   TERRABOT CLOUD — LOGIN PAGE
   Light-first enterprise theme matching dashboard
   ============================================ */

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

:root {
    --primary: #3b82f6;
    --primary-soft: rgba(59,130,246,0.1);
    --accent: #06b6d4;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --surface: rgba(255,255,255,0.95);
    --border: #e2e8f0;
    --text: #1e293b;
    --dim: #64748b;
    --muted: #94a3b8;
    --radius: 0.5rem;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: rgba(30,41,59,0.95);
    --border: #334155;
    --text: #e2e8f0;
    --dim: #94a3b8;
    --muted: #64748b;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    margin: 0;
    animation: pageIn 0.35s ease both;
}

@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- LOGIN AMBIENT BLOBS ---- */
.login-blobs {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    overflow: hidden; filter: blur(80px);
}
.login-blob {
    position: absolute; border-radius: 50%; opacity: 0.35;
}
.login-blob-1 {
    width: 500px; height: 500px; top: -10%; right: -5%;
    background: radial-gradient(circle, rgba(59,130,246,0.45) 0%, transparent 70%);
    animation: login-blob-1 18s ease-in-out infinite;
}
.login-blob-2 {
    width: 400px; height: 400px; bottom: -5%; left: 20%;
    background: radial-gradient(circle, rgba(6,182,212,0.35) 0%, transparent 70%);
    animation: login-blob-2 22s ease-in-out infinite;
}
.login-blob-3 {
    width: 350px; height: 350px; top: 40%; left: -5%;
    background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, transparent 70%);
    animation: login-blob-3 20s ease-in-out infinite;
}
@keyframes login-blob-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, 40px) scale(1.1); }
    66% { transform: translate(30px, -50px) scale(0.95); }
}
@keyframes login-blob-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -30px) scale(1.15); }
    66% { transform: translate(-40px, 40px) scale(0.9); }
}
@keyframes login-blob-3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, 50px) scale(1.08); }
    66% { transform: translate(-30px, -40px) scale(0.92); }
}
[data-theme=\"dark\"] .login-blob { opacity: 0.2; }

/* Theme toggle */
.login-theme-toggle {
    position: fixed; top: 20px; right: 20px;
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    cursor: pointer; color: var(--dim);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; z-index: 10;
}
.login-theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Layout */
.login-wrapper { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.login-left {
    flex: 0 0 42%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(59,130,246,0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(6,182,212,0.04) 0%, transparent 55%),
        var(--bg);
    border-right: 1px solid var(--border);
    padding: 60px 50px;
    display: flex; flex-direction: column;
    justify-content: center; gap: 28px;
}
[data-theme="dark"] .login-left {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(59,130,246,0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(6,182,212,0.05) 0%, transparent 55%),
        #0f172a;
}

.login-left-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.login-left-logo img { width: 46px; height: 46px; filter: drop-shadow(0 0 12px rgba(59,130,246,0.3)); }
.login-left-logo h2 {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-left-tagline { font-size: 30px; font-weight: 700; line-height: 1.25; color: var(--text); letter-spacing: -0.5px; }
.login-left-tagline span { color: var(--primary); }
.login-left-desc { font-size: 14px; color: var(--dim); line-height: 1.65; }
.login-left-features { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.login-left-features li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--dim); }
.login-left-features li::before { content: '\2713'; color: var(--primary); font-weight: 700; margin-top: 1px; flex-shrink: 0; }

.login-admin-note {
    margin-top: 20px; padding: 12px 16px;
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: var(--radius); background: var(--primary-soft);
}
.login-admin-note p { font-size: 12px; color: var(--dim); margin: 0; line-height: 1.5; }
.login-admin-note a { color: var(--primary); text-decoration: none; font-weight: 600; }
.login-admin-note a:hover { text-decoration: underline; }

/* Right panel */
.login-right {
    flex: 1; display: flex;
    align-items: center; justify-content: center;
    padding: 40px 20px;
    background-image:
        radial-gradient(ellipse at 70% 30%, rgba(6,182,212,0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 60%, rgba(59,130,246,0.02) 0%, transparent 50%);
}
.login-container { width: 100%; max-width: 420px; }
.login-brand { text-align: center; margin-bottom: 40px; display: none; }
.login-brand img {
    width: 56px; height: 56px; margin-bottom: 16px;
    filter: drop-shadow(0 0 12px rgba(59,130,246,0.3));
}
.login-brand h1 {
    font-size: 28px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-brand p { font-size: 14px; color: var(--dim); margin-top: 8px; }

/* Card */
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 36px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.login-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.login-card .subtitle { font-size: 13px; color: var(--dim); margin-bottom: 28px; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--dim); margin-bottom: 8px; }
.input-wrap { position: relative; }
.input-wrap input {
    width: 100%; padding: 14px 16px 14px 44px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg); color: var(--text);
    font-family: 'Inter', sans-serif; font-size: 15px;
    outline: none; transition: all 0.2s;
}
.input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.input-wrap .icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--dim); font-size: 18px; pointer-events: none;
}
.toggle-pass {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--dim); cursor: pointer;
    font-size: 16px; padding: 4px;
}
.toggle-pass:hover { color: var(--text); }

/* Submit button */
.btn-login {
    width: 100%; padding: 14px; border-radius: var(--radius); font-size: 16px;
    font-weight: 700; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    background-size: 200% 200%; color: #fff;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); margin-top: 8px;
    position: relative; overflow: hidden;
}
.btn-login::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 50%);
    opacity: 0; transition: opacity 0.3s;
}
.btn-login:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 30px rgba(59,130,246,0.35), 0 0 60px rgba(59,130,246,0.15);
    background-position: 100% 100%;
}
.btn-login:hover::before { opacity: 1; }
.btn-login:active { transform: translateY(0) scale(0.99); }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-login.loading { color: transparent !important; position: relative; pointer-events: none; }
.btn-login.loading::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
.forgot-link {
    display: block; text-align: right; font-size: 12px;
    color: var(--dim); text-decoration: none;
    margin-top: 6px; margin-bottom: 14px; transition: color 0.2s;
}
.forgot-link:hover { color: var(--primary); }

/* Messages */
.error-msg {
    background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
    font-size: 13px; color: var(--danger); display: none; text-align: center;
}
.lockout-msg {
    background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
    font-size: 13px; color: #f59e0b; display: none; text-align: center;
}

/* Footer */
.login-footer {
    text-align: center; margin-top: 24px;
    padding: 20px 24px 18px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    position: relative; overflow: hidden;
}
.login-footer::before {
    content: ''; position: absolute; inset: 0; z-index: 0;
    background:
        radial-gradient(circle at 15% 50%, rgba(59,130,246,0.07) 0%, transparent 55%),
        radial-gradient(circle at 85% 50%, rgba(6,182,212,0.05) 0%, transparent 55%);
    pointer-events: none;
}
[data-theme="dark"] .login-footer::before {
    background:
        radial-gradient(circle at 15% 50%, rgba(59,130,246,0.12) 0%, transparent 55%),
        radial-gradient(circle at 85% 50%, rgba(6,182,212,0.08) 0%, transparent 55%);
}
.login-footer-links {
    display: flex; flex-wrap: wrap; justify-content: center;
    align-items: center; gap: 2px; margin-bottom: 12px;
    position: relative; z-index: 1;
}
.login-footer-link {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: 8px;
    font-size: 14px; font-weight: 500;
    color: var(--text-secondary, var(--dim));
    text-decoration: none;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;
}
.login-footer-link:hover {
    background: rgba(59,130,246,0.1);
    color: var(--primary);
    transform: translateY(-1px);
}
.login-footer-link svg { flex-shrink: 0; opacity: 0.8; }
.login-footer-sep {
    display: inline-block; width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--border); margin: 0 2px;
    vertical-align: middle;
}
.login-footer-copy {
    position: relative; z-index: 1;
    font-size: 12px; color: var(--dim);
    margin: 0; line-height: 1.5;
    letter-spacing: 0.01em;
}

/* Loading spinner */
.login-spinner {
    width: 28px; height: 28px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .login-left { display: none; }
    .login-brand { display: block; }
    .login-right { padding: 30px 16px; }
}

@media (max-width: 480px) {
    .login-right { padding: 24px 12px; }
    .login-card { padding: 24px 16px; }
    .login-card h2 { font-size: 20px; }
    .login-card .subtitle { font-size: 13px; }
    .btn-login { font-size: 14px; padding: 13px; }
    .login-footer { padding: 16px 14px 14px; }
    .login-footer-link { font-size: 13px; padding: 4px 8px; }
    .login-footer-copy { font-size: 11px; }
}
