/* =========================================================================
   Cestovatel — DESIGN SYSTEM (jeden zdroj pravdy pro celý web)
   Všechny stránky používají tyto tokeny a komponenty, ať je to konzistentní.
   ========================================================================= */

:root {
  /* Barvy / značka */
  --grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary: #667eea;
  --primary-dark: #764ba2;

  /* Text */
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-soft: #495057;

  /* Plochy */
  --surface: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  --shadow-hover: 0 16px 42px rgba(0, 0, 0, 0.28);
  --gap: 20px;

  /* Varianty dlaždic (pozadí / text) */
  --points-bg: #4ade80;  --points-fg: #064e3b;
  --current-bg: #fee2e2; --current-fg: #7f1d1d;
  --next-bg: #dcfce7;    --next-fg: #713f12;
  --login-bg: #fff9c4;   --login-fg: #713f12;

  /* Tlačítka */
  --btn-gray: #888888;
  --btn-danger: #e53e3e;
  --btn-danger-dark: #c53030;

  --safe-top: env(safe-area-inset-top, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--grad);
  min-height: 100vh;
  padding: calc(20px + var(--safe-top)) 20px 40px;
  color: var(--text);
}

.container { max-width: 1040px; margin: 0 auto; }

/* ---- Hlavička ---------------------------------------------------------- */
.header { text-align: center; color: #fff; margin-bottom: 36px; }
.header h1 { font-size: 2.8em; margin-bottom: 8px; text-shadow: 2px 2px 4px rgba(0,0,0,0.2); }
.header p { font-size: 1.15em; opacity: 0.9; }
.header h1 { display: inline-flex; align-items: center; gap: 10px; justify-content: center; }
.brand-icon { width: 54px; height: 54px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

/* ---- Mřížka dlaždic ----------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

/* ---- Dlaždice (karta) --------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card:not(.card--login):active { transform: scale(0.985); box-shadow: var(--shadow); }

.card--points  { background: var(--points-bg);  color: var(--points-fg); }
.card--current { background: var(--current-bg); color: var(--current-fg); }
.card--next    { background: var(--next-bg);    color: var(--next-fg); }
.card--login   { background: var(--login-bg);   color: var(--login-fg); cursor: default; }
.card--login:hover { transform: none; box-shadow: var(--shadow); }
.card--empty { cursor: default; }
.card--empty:hover { transform: none; box-shadow: var(--shadow); }
.card.card--empty:active { transform: none; box-shadow: var(--shadow); }

.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.6em;
  font-weight: 700;
  color: var(--primary);
  text-transform: capitalize;
  white-space: nowrap;
  min-width: 0;
}
/* barevné varianty mají nadpis v barvě varianty, ne fialový */
.card--points  .card__title,
.card--current .card__title,
.card--next    .card__title,
.card--login   .card__title { color: inherit; }
.version { font-size: 0.85em; font-weight: 600; opacity: 0.7; }
.card__title--plain { text-transform: none; }
.title-icon { width: 30px; height: 30px; border-radius: 7px; flex: 0 0 auto; }

.card__title-meta { margin-left: auto; font-size: 0.5em; font-weight: 600; opacity: 0.9; white-space: nowrap; }

/* ---- Statistiky v dlaždici (čipy) -------------------------------------- */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 0.92em;
  color: var(--text-muted);
}
.card--points .stats, .card--current .stats, .card--next .stats { color: inherit; }
.stat strong { font-weight: 800; }
/* datum příští cesty: na desktopu v nadpisu, na mobilu jako čip ve statistikách */
.next-date { display: none; }

/* ---- Vlajky ------------------------------------------------------------- */
.flag {
  width: 28px; height: 20px; object-fit: cover; border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); vertical-align: middle;
}
.flag--sm { width: 22px; height: 16px; border: 1px solid #dbe4ef; box-shadow: 0 1px 3px rgba(0,0,0,0.18); }
.flags { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Tlačítka (JEDEN styl pro celý web) -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border: none; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600;
  color: #fff; text-decoration: none; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { transform: scale(1.03); }
.btn--primary { background: var(--grad); }
.btn--primary:hover { box-shadow: 0 6px 16px rgba(102,126,234,0.45); }
.btn--gray { background: var(--btn-gray); }
.btn--gray:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.2); }
.btn--danger { background: var(--btn-danger); }
.btn--danger:hover { background: var(--btn-danger-dark); transform: none; box-shadow: 0 4px 12px rgba(197,48,48,0.3); }
.btn--block { width: 100%; }

.actions { display: flex; gap: 10px; align-items: stretch; }
.actions .btn { flex: 1 1 auto; }

/* ---- Dialog / modal (JEDEN styl pro celý web) -------------------------- */
.modal {
  position: fixed; inset: 0; display: none;
  background: rgba(0,0,0,0.45);
  align-items: center; justify-content: center;
  padding: 16px; z-index: 1000;
}
.modal.is-open { display: flex; }
.modal__box {
  background: #fff; border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow-hover);
  display: flex; flex-direction: column; gap: 14px;
}
.modal__title { font-size: 1.3em; font-weight: 700; color: var(--primary); }
.modal__error { color: var(--btn-danger); font-size: 0.9em; display: none; }
.modal__error.is-visible { display: block; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.85em; color: var(--text-muted); font-weight: 600; }
.field input {
  padding: 10px 12px; border: 1px solid #c6c6c8; border-radius: 8px;
  font: inherit; color: var(--text);
}
.field--check { flex-direction: row; align-items: center; gap: 8px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ---- Responsivní úpravy ------------------------------------------------- */
@media (max-width: 768px) {
  body { padding: 12px; }
  .header { margin-bottom: 22px; }
  .header h1 { font-size: 2em; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 18px; }
  .card__title { font-size: 1.3em; }
  .stats {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px; font-size: 0.82em;
  }
  .stat {
    text-align: center; background: rgba(255,255,255,0.5);
    border-radius: 8px; padding: 6px 5px; white-space: nowrap;
  }
  .card--year .stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .card--year .stat { background: #f3f4f6; }
  .stat--wide { grid-column: 1 / -1; }
  /* na mobilu datum příští cesty z nadpisu skrýt a ukázat jako čip */
  .card__title-meta { display: none; }
  .next-date { display: block; grid-column: 1 / -1; text-align: center;
    background: rgba(255,255,255,0.5); border-radius: 8px; padding: 6px 5px; }
}
