/* ============================================================
   Haita Lupilor - Lead-uri
   Brand palette mirrored from paele.ro (dark, red, flame).
   Mobile-first (~390px), clean at desktop 1280+.
   ============================================================ */
:root {
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Titillium Web', var(--font);

  --bg: #070707;
  --surface: rgba(22, 12, 12, 0.6);
  --surface-2: rgba(20, 10, 10, 0.88);
  --surface-card: rgba(16, 10, 10, 0.72);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.72);
  --text-dim: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.28);
  --accent: #ff1a1a;
  --accent-2: #ff7a18;
  --accent-soft: rgba(255, 26, 26, 0.55);
  --green: #35c46a;
  --green-soft: rgba(53, 196, 106, 0.16);
  --whatsapp: #25d366;

  --radius: 16px;
  --radius-sm: 12px;
  --tap: 46px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Fiery fixed background wash */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -8%, rgba(255, 60, 0, 0.22) 0%, rgba(0, 0, 0, 0) 46%),
    radial-gradient(ellipse at 82% 4%, rgba(255, 26, 26, 0.12) 0%, rgba(0, 0, 0, 0) 44%),
    linear-gradient(180deg, #060606 0%, #0a0505 52%, #050505 100%);
}

button { font-family: inherit; }

a { color: var(--accent); }

/* Focus visibility for keyboard users */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.view { min-height: 100vh; }
[hidden] { display: none !important; }

/* ============================================================
   Brand lockup
   ============================================================ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__wolf {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(255, 26, 26, 0.4));
}

.brand__title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, #ffd9c0 60%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__title--sm { font-size: 1.1rem; letter-spacing: 1.5px; }

.brand__sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 3px;
}

/* ============================================================
   Login view
   ============================================================ */
.view-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 26px 26px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(255, 26, 26, 0.14);
}

.brand--login {
  flex-direction: column;
  text-align: center;
  gap: 10px;
  margin-bottom: 28px;
}

.brand--login .brand__wolf { font-size: 3rem; }
.brand--login .brand__title { font-size: 1.85rem; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.field__input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field__input::placeholder { color: var(--text-dim); }

.field__input:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(255, 26, 26, 0.16);
}

.form-error {
  font-size: 0.88rem;
  color: #ff6b6b;
  background: rgba(255, 26, 26, 0.1);
  border: 1px solid rgba(255, 26, 26, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.login-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 20px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn--block { width: 100%; }

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: 0 10px 26px rgba(255, 26, 26, 0.32);
}
.btn--primary:hover { filter: brightness(1.06); }

.btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--border-strong); }

.btn--danger {
  background: rgba(255, 26, 26, 0.12);
  border-color: rgba(255, 26, 26, 0.35);
  color: #ff8a8a;
}
.btn--danger:hover { background: rgba(255, 26, 26, 0.2); }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* Icon buttons in headers */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--border-strong); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn--ghost { background: transparent; border-color: transparent; pointer-events: none; }
.icon-btn.is-spinning svg { animation: spin 0.7s linear infinite; }

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

/* ============================================================
   App header (sticky)
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: linear-gradient(to bottom, rgba(7, 5, 5, 0.96) 0%, rgba(7, 5, 5, 0.88) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.app-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header__actions { display: flex; gap: 8px; }

.app-header--sub .app-header__top { justify-content: space-between; }

.app-header__title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Counter chips */
.chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  min-height: 58px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--border-strong); }
.chip:active { transform: translateY(1px); }
.chip.is-active {
  border-color: var(--accent-soft);
  background: rgba(255, 26, 26, 0.1);
}

.chip__num {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}
.chip.is-active .chip__num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chip__label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.15;
}

/* Filter pills */
.pills {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pills::-webkit-scrollbar { display: none; }

.pill {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(255, 26, 26, 0.3);
}

/* Search */
.search {
  position: relative;
  margin-top: 12px;
}
.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.search__input {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px 11px 42px;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search__input::placeholder { color: var(--text-dim); }
.search__input:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(255, 26, 26, 0.14);
}

/* ============================================================
   Lead list + cards
   ============================================================ */
.lead-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px calc(28px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: opacity 0.28s ease, transform 0.28s ease, border-color 0.2s ease;
}
.card.is-leaving {
  opacity: 0;
  transform: translateX(40px) scale(0.98);
}
.card[data-status="in_progress"] { border-color: rgba(255, 122, 24, 0.4); }
.card[data-status="done"] { border-color: rgba(53, 196, 106, 0.3); }

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card__name {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.15;
}

.card__time {
  flex: 0 0 auto;
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  padding-top: 4px;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
}

.card__ig, .card__phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}
.card__ig {
  color: #fff;
  font-weight: 600;
}
.card__ig .card__at { color: var(--accent-2); }
.card__phone { color: var(--text-muted); }

.card__status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 999px;
}
.badge--in_progress { background: rgba(255, 122, 24, 0.16); color: var(--accent-2); }
.badge--done { background: var(--green-soft); color: var(--green); }

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Compact action buttons on cards */
.act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 1 auto;
  min-height: 44px;
  min-width: 96px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, filter 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.act:active { transform: translateY(1px); }
.act svg { flex: 0 0 auto; }

.act--ig {
  background: linear-gradient(135deg, rgba(220, 39, 103, 0.28), rgba(255, 122, 24, 0.24));
  border-color: rgba(220, 39, 103, 0.4);
}
.act--ig:hover { filter: brightness(1.08); }

.act--call {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}
.act--call:hover { background: rgba(255, 255, 255, 0.12); }

.act--wa {
  background: rgba(37, 211, 102, 0.16);
  border-color: rgba(37, 211, 102, 0.4);
  color: #7ff0ac;
}
.act--wa:hover { background: rgba(37, 211, 102, 0.24); }

.act--done {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 26, 26, 0.28);
  flex-basis: 100%;
}
.act--done:hover { filter: brightness(1.06); }

.act--undo {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
  color: var(--text);
  flex-basis: 100%;
}
.act--undo:hover { background: rgba(255, 255, 255, 0.12); }

/* Empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 60px 30px;
  max-width: 420px;
  margin: 0 auto;
}
.empty__wolf { font-size: 3.4rem; opacity: 0.85; filter: grayscale(0.2); }
.empty__text {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   Settings view
   ============================================================ */
.settings {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(40px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 16px;
  display: flex;
  flex-direction: column;
}
.settings-group > .btn { margin: 12px 0; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}
.setting-row + .setting-row { border-top: 1px solid var(--border); }

.setting-row__text { display: flex; flex-direction: column; gap: 4px; }
.setting-row__title { font-size: 1rem; font-weight: 600; }
.setting-row__hint { font-size: 0.82rem; color: var(--text-dim); line-height: 1.4; }

/* Toggle switch */
.toggle {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
  width: 52px;
  height: 30px;
}
.toggle input { position: absolute; z-index: 2; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle__track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  transition: background 0.2s ease;
}
.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.toggle input:checked + .toggle__track {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(22px); }
.toggle input:focus-visible + .toggle__track {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.settings-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0 12px;
  line-height: 1.5;
  white-space: pre-line;
}
.settings-note.is-ok { color: var(--green); }
.settings-note.is-err { color: #ff8a8a; }

.ios-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  background: rgba(255, 122, 24, 0.08);
  border: 1px solid rgba(255, 122, 24, 0.28);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.ios-hint strong { color: #fff; }
.ios-hint em { color: var(--accent-2); font-style: normal; font-weight: 600; }

.app-version {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 60;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-ok { border-color: rgba(53, 196, 106, 0.5); }
.toast.is-err { border-color: rgba(255, 26, 26, 0.5); }

/* ============================================================
   Desktop refinement (1024px+)
   ============================================================ */
@media (min-width: 1024px) {
  .app-header {
    padding-left: 32px;
    padding-right: 32px;
  }
  .app-header__top, .chips, .pills, .search {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
  .chips { margin-top: 16px; }
  .chip { min-height: 66px; }
  .chip__num { font-size: 1.7rem; }
  .chip__label { font-size: 0.7rem; }
  .card:hover { border-color: var(--border-strong); }
  .card__actions .act { flex: 0 1 auto; min-width: 120px; }
  .act--done, .act--undo { flex-basis: auto; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
