/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS — Light / Dark / Auto
════════════════════════════════════════════════════════════ */
:root {
  --color-bg:          #0b0c10;
  --color-surface:     #13151b;
  --color-surface2:    #1a1d27;
  --color-border:      #252836;
  --color-border2:     #2f3347;
  --color-text:        #e8eaf2;
  --color-text-muted:  #7b8099;
  --color-text-subtle: #4a5068;
  --color-accent:      #00d4ff;
  --color-accent2:     #0099cc;
  --color-accent-dim:  rgba(0, 212, 255, 0.12);
  --color-accent-glow: rgba(0, 212, 255, 0.25);
  --color-error:       #ff5c5c;
  --color-error-bg:    rgba(255, 92, 92, 0.1);
  --color-success:     #00d4a0;

  --font-body:  'Outfit', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 24px 64px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-glow: 0 0 40px var(--color-accent-glow);
  --transition:  0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme */
[data-theme="light"] {
  --color-bg:          #f0f2f8;
  --color-surface:     #ffffff;
  --color-surface2:    #f5f6fa;
  --color-border:      #dde0ec;
  --color-border2:     #c8cce0;
  --color-text:        #0f1022;
  --color-text-muted:  #5c6080;
  --color-text-subtle: #9298b0;
  --color-accent:      #0077ee;
  --color-accent2:     #0055bb;
  --color-accent-dim:  rgba(0, 119, 238, 0.08);
  --color-accent-glow: rgba(0, 119, 238, 0.15);
  --color-error:       #d43333;
  --color-error-bg:    rgba(212, 51, 51, 0.08);
  --color-success:     #00a878;
  --shadow-card: 0 8px 32px rgba(0,0,0,0.1), 0 1px 0 rgba(255,255,255,0.8) inset;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 16px; }

body {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

/* ── Animované pozadí ──────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--color-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent-glow) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
}

/* Plovoucí datové částice */
.particle {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-accent);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  animation: float-up linear infinite;
  white-space: nowrap;
}
.particle.p-power  { color: #ff9f1c; }
.particle.p-temp   { color: #ff5c5c; }
.particle.p-charge { color: #00d4a0; }
.particle.p-cell   { color: #b48eff; }
.particle.p-lg     { font-size: 12px; }
.particle.p-sm     { font-size: 10px; opacity: 0; }

@keyframes float-up {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.35; }
  90%  { opacity: 0.12; }
  100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* ── Přepínač tématu ──────────────────────────────────── */
.theme-switcher {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.theme-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: background var(--transition);
  color: var(--color-text-muted);
}

.theme-btn:hover,
.theme-btn.active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

/* ── Login karta ──────────────────────────────────────── */
.login-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  animation: card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* Top accent linka */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
}

/* ── Logo sekce ──────────────────────────────────────── */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.logo-container {
  padding: 1rem 2rem;
  border-radius: var(--radius-lg);
  background: var(--color-accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.2);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px var(--color-accent-glow);
  animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { box-shadow: 0 0 24px var(--color-accent-glow); }
  50%       { box-shadow: 0 0 40px var(--color-accent-glow), 0 0 0 4px var(--color-accent-dim); }
}

.xpeng-logo {
  width: 148px;
  height: auto;
  display: block;
  fill: var(--color-accent);
}

.brand-sub {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--color-text-subtle);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ── Status bar — skryto na login stránce ────────────── */
.status-bar { display: none; }

/* ── Form prvky ───────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  pointer-events: none;
  transition: color var(--transition);
  font-size: 15px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.875rem 0.75rem 2.6rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-dim);
  background: var(--color-surface);
}

input[type="text"]:focus + .input-icon,
input[type="password"]:focus + .input-icon {
  color: var(--color-accent);
}

.input-wrap:focus-within .input-icon {
  color: var(--color-accent);
}

/* Password toggle */
.pass-toggle {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-subtle);
  font-size: 15px;
  padding: 2px;
  transition: color var(--transition);
}
.pass-toggle:hover { color: var(--color-accent); }

/* ── Chybová hláška ──────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: alert-in 0.3s ease both;
}

@keyframes alert-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-error {
  background: var(--color-error-bg);
  border: 1px solid rgba(255, 92, 92, 0.3);
  color: var(--color-error);
}

.alert-success {
  background: rgba(0, 212, 160, 0.1);
  border: 1px solid rgba(0, 212, 160, 0.3);
  color: var(--color-success);
}

/* ── Tlačítko přihlásit ──────────────────────────────── */
.btn-login {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.85rem 1.5rem;
  background: var(--color-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn-login::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn-login:hover {
  background: var(--color-accent2);
  box-shadow: 0 8px 24px var(--color-accent-glow);
  transform: translateY(-1px);
}

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

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  display: none;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-login.loading .spinner { display: block; }
.btn-login.loading .btn-text { opacity: 0.7; }

/* ── Footer ───────────────────────────────────────────── */
.login-footer {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-version {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-text-subtle);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-stats {
  display: flex;
  gap: 1rem;
}

.stat-item {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-text-subtle);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-val {
  color: var(--color-accent);
  font-weight: 500;
}

/* ── Responsivita ─────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 1rem; }
  .login-card { padding: 1.75rem 1.25rem; }
  .brand-name { font-size: 1.25rem; }
  .footer-stats { display: none; }
  .theme-switcher { top: 0.75rem; right: 0.75rem; }
}
