/* ═══════════════════════════════════════════════════════════
   PIVIRI – RETRO TÁBOROVÝ DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Rye&family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  /* Barvy */
  --bark:       #0D0802;
  --bark-lt:    #1E1208;
  --bark-mid:   #2C1A0A;
  --paper:      #EDE0C0;
  --paper-dk:   #D4C49A;
  --paper-lt:   #F7F0DC;
  --forest:     #243D12;
  --forest-lt:  #3D6220;
  --forest-glow:#5C8F35;
  --fire:       #C4700A;
  --fire-lt:    #E8921A;
  --ember:      #8B2E12;
  --pine:       #1A3008;
  --ink:        #1C0F04;
  --ink-lt:     #4A3520;
  --mist:       #7A6A50;

  /* Sidebar šířka */
  --sidebar-w: 260px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bark);
  color: var(--paper);
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  /* Noise texture overlay */
  position: relative;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: .4;
}

/* ═══ SIDEBAR ═══════════════════════════════════════════════ */

#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bark-lt);
  border-right: 3px solid var(--forest);
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Dřevěná textura na sidebaru */
#sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,.012) 2px,
      rgba(255,255,255,.012) 4px
    ),
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 40px,
      rgba(0,0,0,.08) 40px,
      rgba(0,0,0,.08) 41px
    );
  pointer-events: none;
}

/* Logo */
.sidebar-logo {
  padding: 1.75rem 1.25rem 1.25rem;
  border-bottom: 2px solid var(--forest);
  position: relative;
}

.sidebar-logo-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 46px;
  height: 46px;
  background: var(--forest);
  border: 2px solid var(--forest-lt);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: 'Rye', cursive;
  font-size: 1.15rem;
  color: var(--paper);
  line-height: 1.2;
  letter-spacing: .03em;
}

.sidebar-logo-text small {
  display: block;
  font-family: 'Courier Prime', monospace;
  font-size: .65rem;
  color: var(--mist);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 400;
}

/* Nav sekce */
.nav-section {
  padding: 1rem 0 .5rem;
  position: relative;
}

.nav-section-label {
  font-family: 'Courier Prime', monospace;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--mist);
  padding: 0 1.25rem .5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 1.25rem;
  text-decoration: none;
  color: var(--paper-dk);
  font-family: 'Courier Prime', monospace;
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .04em;
  position: relative;
  transition: color .2s, background .2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: var(--paper);
  background: rgba(255,255,255,.04);
  border-left-color: var(--forest-lt);
}

.nav-item.active {
  color: var(--fire-lt);
  background: rgba(196,112,10,.1);
  border-left-color: var(--fire);
}

.nav-item-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Auth sekce dole v sidebaru */
.sidebar-auth {
  margin-top: auto;
  padding: 1.25rem;
  border-top: 2px solid var(--forest);
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  background: var(--forest);
  border: 1px solid var(--forest-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rye', cursive;
  font-size: .75rem;
  color: var(--paper);
  flex-shrink: 0;
}

.sidebar-username {
  font-family: 'Courier Prime', monospace;
  font-size: .8rem;
  color: var(--paper-dk);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-username small {
  display: block;
  color: var(--mist);
  font-size: .7rem;
}

.btn-sidebar {
  display: block;
  width: 100%;
  padding: .5rem;
  text-align: center;
  border-radius: 3px;
  font-family: 'Courier Prime', monospace;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .2s, color .2s;
  margin-bottom: .4rem;
}

.btn-sidebar-fire {
  background: var(--fire);
  color: var(--paper-lt);
}
.btn-sidebar-fire:hover { background: var(--fire-lt); }

.btn-sidebar-ghost {
  background: transparent;
  color: var(--mist);
  border: 1px solid var(--bark-mid);
}
.btn-sidebar-ghost:hover { color: var(--paper); border-color: var(--mist); }

/* ═══ HLAVNÍ OBSAH ═════════════════════════════════════════ */

#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══ PAGE HERO ════════════════════════════════════════════ */

.page-hero {
  background: var(--pine);
  padding: 3rem 2.5rem 2.5rem;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--forest);
}

.page-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--fire) 0, var(--fire) 8px, transparent 8px, transparent 14px);
}

.page-hero-trees {
  position: absolute;
  bottom: 0; right: 2rem;
  opacity: .08;
  pointer-events: none;
}

.hero-label {
  font-family: 'Courier Prime', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--forest-glow);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.hero-label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--forest-glow);
}

.page-hero h1 {
  font-family: 'Rye', cursive;
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--paper);
  line-height: 1.15;
  letter-spacing: .02em;
  margin-bottom: .75rem;
}

.page-hero p {
  font-size: 1rem;
  color: var(--mist);
  max-width: 560px;
  line-height: 1.6;
}

/* ═══ OBSAH STRÁNKY ════════════════════════════════════════ */

.page-content {
  padding: 2.5rem;
  flex: 1;
}

/* ═══ KARTY ════════════════════════════════════════════════ */

.card {
  background: var(--bark-mid);
  border: 1px solid var(--forest);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

/* Rohové dekorace */
.card::before, .card::after {
  content: '✦';
  position: absolute;
  font-size: .5rem;
  color: var(--forest-lt);
  line-height: 1;
}
.card::before { top: 5px; left: 7px; }
.card::after  { bottom: 5px; right: 7px; }

.card-thumb {
  height: 190px;
  background: var(--pine);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(.15) contrast(1.05);
  transition: transform .4s ease, filter .4s;
}

.card:hover .card-thumb img {
  transform: scale(1.04);
  filter: sepia(.05) contrast(1.08);
}

.card-thumb-placeholder {
  opacity: .15;
}

.card-thumb-badge {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: rgba(13,8,2,.75);
  border: 1px solid var(--forest);
  color: var(--paper-dk);
  padding: 2px 8px;
  font-family: 'Courier Prime', monospace;
  font-size: .7rem;
  letter-spacing: .06em;
}

.card-body {
  padding: 1.25rem;
}

.card-stamp {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--fire);
  margin-bottom: .4rem;
}

.card-body h3 {
  font-family: 'Rye', cursive;
  font-size: 1.1rem;
  color: var(--paper);
  line-height: 1.3;
  margin-bottom: .5rem;
}

.card-body p {
  font-size: .875rem;
  color: var(--mist);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--forest);
  padding-top: .75rem;
  margin-top: .25rem;
}

.card-meta {
  font-family: 'Courier Prime', monospace;
  font-size: .75rem;
  color: var(--mist);
}

.card-link {
  font-family: 'Courier Prime', monospace;
  font-size: .78rem;
  color: var(--fire-lt);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .05em;
}

.card-link:hover { color: var(--paper); }

/* ═══ GRID ══════════════════════════════════════════════════ */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* ═══ TLAČÍTKA ══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border-radius: 2px;
  font-family: 'Courier Prime', monospace;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background .2s, color .2s, transform .1s;
}

.btn:active { transform: scale(.97); }

.btn-fire {
  background: var(--fire);
  color: var(--paper-lt);
  border: 1px solid var(--fire-lt);
}
.btn-fire:hover { background: var(--fire-lt); }

.btn-forest {
  background: var(--forest);
  color: var(--paper);
  border: 1px solid var(--forest-lt);
}
.btn-forest:hover { background: var(--forest-lt); }

.btn-ghost {
  background: transparent;
  color: var(--mist);
  border: 1px solid var(--bark-mid);
}
.btn-ghost:hover { color: var(--paper); border-color: var(--mist); }

.btn-ember {
  background: var(--ember);
  color: var(--paper-lt);
  border: 1px solid #b03c1a;
}
.btn-ember:hover { background: #a83515; }

/* ═══ FORMULÁŘE ═════════════════════════════════════════════ */

.form-group { margin-bottom: 1.25rem; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-family: 'Courier Prime', monospace;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--mist);
  margin-bottom: .45rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: .7rem .9rem;
  background: var(--bark);
  border: 1.5px solid var(--forest);
  border-radius: 2px;
  color: var(--paper);
  font-family: 'Courier Prime', monospace;
  font-size: .95rem;
  line-height: 1.5;
  transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--fire);
  box-shadow: 0 0 0 3px rgba(196,112,10,.15);
}

textarea { resize: vertical; min-height: 140px; }

select option { background: var(--bark-lt); }

/* ═══ SEKCE HEADERS ═════════════════════════════════════════ */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--forest);
  position: relative;
}

.section-head::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 60px;
  height: 2px;
  background: var(--fire);
}

.section-head h2 {
  font-family: 'Rye', cursive;
  font-size: 1.5rem;
  color: var(--paper);
  letter-spacing: .03em;
}

/* ═══ ZPRÁVY ════════════════════════════════════════════════ */

.msg {
  padding: .75rem 1rem;
  border-radius: 2px;
  font-family: 'Courier Prime', monospace;
  font-size: .875rem;
  margin-bottom: 1rem;
  display: none;
  border-left: 3px solid;
}

.msg-error {
  background: rgba(139,46,18,.12);
  border-color: var(--ember);
  color: #e07050;
}

.msg-ok {
  background: rgba(61,98,32,.12);
  border-color: var(--forest-lt);
  color: var(--forest-glow);
}

/* ═══ PRÁZDNÝ STAV ══════════════════════════════════════════ */

.empty {
  text-align: center;
  padding: 4rem 2rem;
  border: 1px dashed var(--forest);
  border-radius: 3px;
  grid-column: 1 / -1;
}

.empty-icon { font-size: 2.5rem; opacity: .3; margin-bottom: 1rem; }

.empty h3 {
  font-family: 'Rye', cursive;
  font-size: 1.2rem;
  color: var(--paper-dk);
  margin-bottom: .5rem;
}

.empty p {
  font-family: 'Courier Prime', monospace;
  font-size: .85rem;
  color: var(--mist);
}

/* ═══ BREADCRUMB ════════════════════════════════════════════ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: 'Courier Prime', monospace;
  font-size: .75rem;
  color: var(--mist);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--forest-glow);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--fire-lt); }
.breadcrumb span { color: var(--forest); }

/* ═══ DEKORATIVNÍ PRVKY ════════════════════════════════════ */

.divider {
  border: none;
  border-top: 1px solid var(--forest);
  margin: 2rem 0;
  position: relative;
}

.divider::before {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bark);
  padding: 0 .75rem;
  color: var(--forest-lt);
  font-size: .7rem;
}

.stamp {
  display: inline-block;
  border: 2px solid currentColor;
  padding: .2rem .6rem;
  font-family: 'Courier Prime', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  border-radius: 2px;
  transform: rotate(-1deg);
}

/* ═══ HAMBURGER (mobil) ═════════════════════════════════════ */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--bark-lt);
  border: 1px solid var(--forest);
  border-radius: 3px;
  padding: .5rem .65rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--paper);
  transition: transform .2s;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ═══ ANIMACE ═══════════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp .45s ease forwards; }

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: .85; }
}

/* ═══ RESPONSIVNÍ ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform .3s ease;
    width: 280px;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle { display: flex; }
  .sidebar-overlay.open { display: block; }

  #main {
    margin-left: 0;
  }

  .page-content { padding: 1.5rem; }
  .page-hero { padding: 2rem 1.5rem; }
}

/* ═══ SCROLLBAR ═════════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bark); }
::-webkit-scrollbar-thumb { background: var(--forest); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--forest-lt); }
