@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');

:root {
  /* Paleta wg motywu łemkowskiej rozety (niebieskie płatki, beż/kremowe tło) —
     bez czerwieni jako koloru interfejsu; czerwień zostaje wyłącznie w logo/marce. */
  --color-blue: #356fa3;       /* kolor nagłówka na watrazdynia.pl / płatków rozety */
  --color-blue-deep: #0065b3;  /* kolor tytułów na watrazdynia.pl, głębszy akcent */
  --color-tan: #dccbb0;        /* kolor ramek ("ramka_do_programu") na watrazdynia.pl — neutralna dekoracja */
  --color-tan-line: #c9b48f;
  --color-cream: #faf5ea;      /* kolor tła na watrazdynia.pl */
  --color-dark: #2d2d2d;
  --radius: 14px;
  --font-body: 'Lato', arial, Helvetica, "Arial Narrow", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  /* dyskretny wzór rozety (8-ramienna gwiazda, jak w motywie łemkowskim) jako tekstura tła, bardzo blada, bez czerwieni */
  --pattern-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M32,12 L35.1,24.6 L46.1,17.9 L39.4,28.9 L52,32 L39.4,35.1 L46.1,46.1 L35.1,39.4 L32,52 L28.9,39.4 L17.9,46.1 L24.6,35.1 L12,32 L24.6,28.9 L17.9,17.9 L28.9,24.6 Z' fill='none' stroke='%23356fa3' stroke-width='1' opacity='0.22'/%3E%3C/svg%3E");
  /* wąski fryz (ząbki) inspirowany haftem na dole ekranu */
  --pattern-frieze: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='14'%3E%3Cpolygon points='0,14 6,2 12,14' fill='%23dccbb0'/%3E%3Cpolygon points='12,14 18,2 24,14' fill='%23dccbb0'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-cream);
  color: var(--color-dark);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: calc(64px + var(--safe-bottom));
  min-height: 100vh;
  background-image: var(--pattern-bg);
  background-repeat: repeat;
  background-attachment: fixed;
}

h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 900; color: var(--color-blue-deep); }
h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 900; color: var(--color-blue-deep); }
p { line-height: 1.45; }
.hint { color: #6b6459; font-size: 0.9rem; margin-top: 0; }

/* Header */
.app-header {
  background: var(--color-blue);
  color: #fff;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  border-bottom: 4px solid var(--color-tan);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}
.app-header__title { display: block; font-size: 1.3rem; font-weight: 900; letter-spacing: 0.02em; }
.app-header__subtitle { display: block; font-size: 0.8rem; opacity: 0.9; margin-top: 2px; }

/* Language switch */
.lang-switch { display: flex; border: 1px solid rgba(255,255,255,0.6); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.lang-switch button {
  background: none;
  border: none;
  color: #fff;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.75;
}
.lang-switch button.is-active { background: #fff; color: var(--color-blue); opacity: 1; }

/* Install banner */
.install-banner {
  background: var(--color-tan);
  color: var(--color-dark);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
  max-width: 640px;
  margin: 0 auto;
}
.install-banner[hidden] { display: none; }
.install-banner button {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}

.offline-badge {
  background: var(--color-dark);
  color: var(--color-tan);
  font-size: 0.75rem;
  text-align: center;
  padding: 5px;
  max-width: 640px;
  margin: 0 auto;
}

main#views { padding: 12px 14px 24px; max-width: 640px; margin: 0 auto; }
.view { animation: fadein 0.15s ease-in; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Day tabs */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 10px; }
.day-tabs button {
  flex: 1 0 auto;
  border: 1px solid var(--color-blue);
  background: transparent;
  color: var(--color-blue-deep);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.day-tabs button.is-active { background: var(--color-blue); color: #fff; border-color: var(--color-blue); }

.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-row select {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--color-tan);
  background: #fff;
  font-size: 0.85rem;
}

/* Event list/cards */
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.event-card {
  background: #fff;
  border: 1px solid var(--color-tan);
  border-left: 4px solid var(--color-tan-line);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
}
.event-card__time { font-weight: 700; color: var(--color-blue-deep); font-size: 0.85rem; }
.event-card__title { font-size: 1.02rem; font-weight: 700; margin: 2px 0; }
.event-card__meta { font-size: 0.8rem; color: #6b6459; }
.event-card__fav {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--color-tan-line);
  cursor: pointer;
  line-height: 1;
}
.event-card__fav.is-active { color: var(--color-blue-deep); }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  background: var(--color-tan);
  color: #5a4a30;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 6px;
  font-weight: 700;
}

.empty-hint { color: #6b6459; font-size: 0.9rem; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

/* Buttons */
.btn {
  border: 1px solid var(--color-blue);
  background: #fff;
  color: var(--color-blue-deep);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.btn--primary { background: var(--color-blue); color: #fff; border-color: var(--color-blue); }
.btn--small { padding: 6px 12px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; }

/* Map */
.map-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-tan);
  background: #fff;
  touch-action: pan-x pan-y;
}
.map-container svg { width: 100%; height: auto; display: block; }
.map-pin { cursor: pointer; }
.map-pin circle { fill: var(--color-blue); stroke: var(--color-cream); stroke-width: 2; }
.map-pin text { font-size: 5px; fill: var(--color-dark); font-weight: 700; }
.map-legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 0.82rem; }
.map-legend li { display: flex; align-items: center; gap: 6px; }
.map-legend .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-blue); display: inline-block; }

/* Photo editor */
.photo-editor { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.photo-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--color-tan);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#photo-canvas { width: 100%; height: 100%; }
.photo-placeholder { position: absolute; color: #a0917c; font-size: 0.9rem; text-align: center; padding: 0 20px; }
.photo-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Info */
.info-block { background: #fff; border: 1px solid var(--color-tan); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list--notes { font-size: 0.82rem; color: #6b6459; margin-top: 6px; }
.artists-list { display: flex; flex-direction: column; gap: 8px; }
.artist-item summary { font-weight: 700; cursor: pointer; }
.artist-item p { font-size: 0.88rem; color: #4a4438; margin: 6px 0 0; }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--color-blue-deep);
  padding-bottom: var(--safe-bottom);
  z-index: 20;
}
.bottom-nav::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  height: 14px;
  background-image: var(--pattern-frieze);
  background-repeat: repeat-x;
  background-size: 24px 14px;
  opacity: 0.9;
}
.bottom-nav__item {
  flex: 1;
  background: none;
  border: none;
  color: #a9c3dc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 6px;
  font-size: 0.68rem;
  cursor: pointer;
}
.bottom-nav__icon { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.bottom-nav__icon svg { width: 100%; height: 100%; color: currentColor; }
.bottom-nav__item.is-active { color: #fff; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(45,45,45,0.55); }
.modal__panel {
  position: relative;
  background: #fff;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  border-top: 4px solid var(--color-blue);
}
.modal__close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 1.2rem; cursor: pointer; }
.modal h3 { margin-top: 4px; }
.modal .btn { margin-top: 12px; }

@media (min-width: 640px) {
  .bottom-nav { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
  .modal__panel { max-width: 500px; margin: 0 auto; border-radius: 18px; }
  .modal { align-items: center; }
}
