/* ZAROX CORE — dark cyber theme */
:root {
  --bg: #050508;
  --bg2: #0c0c12;
  --text: #e8e8ec;
  --muted: #6b6b78;
  --accent: #e31b23;
  --accent-glow: rgba(227, 27, 35, 0.45);
  --border: #1e1e28;
  --input-bg: #111118;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body.splash-page {
  overflow: hidden;
  background: #050508;
}

/* ── Splash ─────────────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.85s ease, visibility 0.85s;
}

.splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-phase {
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  z-index: 2;
}

.splash-phase.visible {
  opacity: 1;
  transform: translateY(0);
}

.splash-welcome {
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.splash-brand {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}

.splash-brand span {
  color: var(--accent);
}

.splash-core {
  font-size: 0.85rem;
  letter-spacing: 0.4em;
  color: var(--accent);
  margin-top: 0.25rem;
}

.splash-status {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  margin-top: 1.5rem;
}

/* Один флаг: статичный кадр + живая волна (фон города не двигается) */
.splash-flag-stage {
  position: relative;
  width: min(420px, 78vw);
  height: min(280px, 42vw);
  margin: 1.5rem 0 0.75rem;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.9s ease, transform 0.9s ease;
  z-index: 2;
  filter: drop-shadow(0 12px 32px rgba(227, 27, 35, 0.35));
}

.splash-flag-stage.visible {
  opacity: 1;
  transform: scale(1);
}

.splash-flag-pole {
  position: absolute;
  left: 6%;
  top: 4%;
  bottom: 8%;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, #3a3a44, #121218);
  box-shadow: 1px 0 0 rgba(255,255,255,0.08);
  z-index: 3;
}

.splash-flag-pole::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #2a2a32;
}

.splash-flag-cloth {
  position: absolute;
  left: 8%;
  right: 2%;
  top: 8%;
  bottom: 12%;
  transform-origin: left center;
  will-change: transform;
}

.splash-flag-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  display: block;
  /* лёгкий «тканевый» warp без смены кадров */
  transform-origin: left center;
}

.splash-flag-stage.waving .splash-flag-cloth {
  animation: flag-wave 2.8s ease-in-out infinite;
}

.splash-flag-stage.waving .splash-flag-img {
  animation: flag-ripple 2.8s ease-in-out infinite;
}

@keyframes flag-wave {
  0%   { transform: perspective(600px) rotateY(0deg) skewY(0deg); }
  25%  { transform: perspective(600px) rotateY(-4deg) skewY(1.2deg); }
  50%  { transform: perspective(600px) rotateY(0deg) skewY(-0.6deg); }
  75%  { transform: perspective(600px) rotateY(3deg) skewY(0.8deg); }
  100% { transform: perspective(600px) rotateY(0deg) skewY(0deg); }
}

@keyframes flag-ripple {
  0%, 100% {
    filter: brightness(1) contrast(1.02);
    transform: scaleX(1) scaleY(1);
  }
  30% {
    filter: brightness(1.05) contrast(1.05);
    transform: scaleX(1.015) scaleY(0.985);
  }
  60% {
    filter: brightness(0.98) contrast(1.02);
    transform: scaleX(0.99) scaleY(1.01);
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-flag-stage.waving .splash-flag-cloth,
  .splash-flag-stage.waving .splash-flag-img {
    animation: none;
  }
}

.splash-city {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(5,5,8,0.35) 0%, rgba(5,5,8,0.55) 45%, #050508 100%),
    url("/static/assets/bg/city_flags.jpg") center center / cover no-repeat;
  transition: opacity 1.5s ease;
}

.splash-city.visible { opacity: 1; }

.splash-progress {
  width: min(280px, 70vw);
  height: 2px;
  background: var(--border);
  margin-top: 2rem;
  border-radius: 1px;
  overflow: hidden;
  z-index: 2;
}

.splash-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff4444);
  transition: width 0.3s linear;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── App shell ──────────────────────────────────────────────── */
body.app-page {
  position: relative;
  background: var(--bg);
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(5, 5, 8, 0.35) 0%,
      rgba(5, 5, 8, 0.92) 18%,
      rgba(5, 5, 8, 0.97) 50%,
      rgba(5, 5, 8, 0.92) 82%,
      rgba(5, 5, 8, 0.35) 100%
    ),
    linear-gradient(180deg, rgba(5, 5, 8, 0.55) 0%, rgba(5, 5, 8, 0.85) 100%),
    url("/static/assets/bg/city_flags_dim.jpg") center / cover no-repeat;
  opacity: 0.85;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(8px);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-lockup .zarox {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.brand-lockup .core {
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

/* ── Calculator ─────────────────────────────────────────────── */
.calc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 3rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.calc-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.calc-hero h1 {
  font-size: clamp(1.25rem, 3.5vw, 1.65rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.55rem;
  line-height: 1.35;
}

.calc-hero p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.calc-input-wrap {
  width: 100%;
  position: relative;
  background: rgba(17, 17, 24, 0.92);
  border-radius: 14px;
}

.support-block {
  margin-top: 2.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 420px;
}

.support-block a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(227, 27, 35, 0.45);
  transition: color 0.2s, border-color 0.2s;
}

.support-block a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.support-bot {
  margin-top: 0.55rem;
  opacity: 0.9;
}

.calc-footer a {
  color: var(--muted);
  text-decoration: none;
}

.calc-footer a:hover { color: var(--text); }

@media (max-width: 720px) {
  .app-bg {
    opacity: 0.45;
    background:
      linear-gradient(180deg, rgba(5,5,8,0.75) 0%, rgba(5,5,8,0.95) 100%),
      url("/static/assets/bg/city_flags_dim.jpg") center / cover no-repeat;
  }
}

.calc-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 3.5rem 1rem 1.25rem;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font);
  resize: none;
  min-height: 52px;
  max-height: 160px;
}

.calc-input:focus {
  border-color: rgba(227, 27, 35, 0.5);
  box-shadow: 0 0 0 3px rgba(227, 27, 35, 0.12);
}

.calc-input::placeholder { color: var(--muted); }

.calc-send {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
}

.calc-send:hover { opacity: 0.9; transform: scale(1.04); }
.calc-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.calc-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.calc-hint {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.calc-hint:hover {
  border-color: rgba(227, 27, 35, 0.4);
  color: var(--text);
}

.calc-result {
  width: 100%;
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
  display: none;
}

.calc-result.visible { display: block; }

.calc-result .total {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0.5rem 0;
}

.calc-result .margin {
  font-size: 0.85rem;
  color: var(--muted);
}

.calc-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ── Manager login stub ─────────────────────────────────────── */
.login-card {
  max-width: 380px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.login-card h2 {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 2.75rem;
}

.pass-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.35rem;
}

.pass-toggle:hover { color: var(--text); }

.caps-hint {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #e8a317;
}

.login-msg {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.login-msg.ok { color: #6dcc8a; }
.login-msg.err { color: #e35a5a; }

.forgot-hint {
  margin-top: 1.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.forgot-hint a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(227, 27, 35, 0.4);
}

.btn-primary {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  margin-top: 0.75rem;
  padding: 0.45rem 0.9rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-secondary:hover {
  color: var(--text);
  border-color: rgba(227, 27, 35, 0.4);
}

.user-chip {
  display: none;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip.visible { display: block; }

.cabinet-main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.cabinet-hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.cabinet-hero h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.cabinet-hero p {
  color: var(--muted);
  font-size: 0.9rem;
}

.leads-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.leads-section h2 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.leads-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.leads-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 360px;
  overflow-y: auto;
}

.lead-row {
  padding: 0.75rem 0.9rem;
  background: rgba(17, 17, 24, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lead-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.lead-text {
  font-size: 0.85rem;
  line-height: 1.4;
}

.leads-empty {
  font-size: 0.85rem;
  color: var(--muted);
}

.otido-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.otido-badge.visible { display: flex; }
