/* Fotogalerie ZŠ Olešská – barvy podle www.zs-olesska.cz */
:root {
  --green: #509601;
  --green-dark: #3f7701;
  --green-soft: #eef6e4;
  --orange: #f90;
  --orange-dark: #f07800;
  --dark: #343a40;
  --text: #333;
  --muted: #777;
  --line: #ddd;
  --bg: #f4f5f2;
  --card: #fff;
  --red: #c33;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(60, 60, 60, .12), 0 4px 14px rgba(60, 60, 60, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: "Open Sans", "Segoe UI", Tahoma, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
}
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1 { font-size: 1.7rem; font-weight: 600; margin: 0 0 .4rem; line-height: 1.25; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 1rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .2rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* Horní lišta */
.topbar { background: var(--dark); color: #fff; border-bottom: 4px solid var(--green); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 10px 0; }
.brand:hover { color: #fff; }
.brand img { background: #fff; border-radius: 50%; padding: 3px; }
.brand strong { display: block; font-size: 1.35rem; font-weight: 600; letter-spacing: .2px; line-height: 1.15; }
.brand small { display: block; color: var(--orange); font-size: .95rem; text-transform: uppercase; letter-spacing: 1.5px; }
.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; padding-bottom: 6px; }
.nav a, .nav .linkbtn { color: #ddd; text-decoration: none; font-size: .95rem; }
.nav a:hover, .nav .linkbtn:hover { color: #fff; }
.nav-info { color: var(--orange); font-weight: 600; }

/* Patička */
.footer { background: var(--dark); color: #aaa; font-size: .85rem; padding: 18px 0; }
.footer-in { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.footer a { color: #ccc; }

/* Tlačítka a formuláře */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 1px solid #ccc; border-radius: 6px; background: #fff; color: var(--text);
  font: inherit; font-size: .95rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #999; color: var(--text); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-danger { color: var(--red); border-color: #e5b5b5; }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--green); cursor: pointer; text-decoration: underline; }
.linkbtn.danger { color: var(--red); }
form.inline { display: inline; margin: 0; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
.form-row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid #eee; }
.form-row label { flex: 1 1 160px; }
input, select, textarea {
  font: inherit; font-weight: 400; font-size: 1rem; padding: 9px 11px; border: 1px solid #ccc; border-radius: 6px;
  background: #fff; color: var(--text); width: 100%;
}
input.sm { width: 150px; padding: 5px 8px; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green); }
.form label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.form label.check input { width: auto; margin-top: 4px; accent-color: var(--green); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.login { padding-top: 4vh; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border-left: 4px solid; }
.alert-ok { background: var(--green-soft); border-color: var(--green); }
.alert-error { background: #fbeaea; border-color: var(--red); }
.alert-warn { background: #fff4e0; border-color: var(--orange); }

.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; background: #eee; font-size: .8rem; font-weight: 600; color: #555; }
.chip-green { background: var(--green-soft); color: var(--green-dark); }
.chip-orange { background: #fff0d6; color: #b35a00; }

/* Hlavička stránky */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.desc { margin-top: 8px !important; max-width: 70ch; }
.crumbs { margin-bottom: 10px; font-size: .9rem; }
.crumbs a { text-decoration: none; }
h2.section { margin-top: 40px; padding-bottom: 8px; border-bottom: 2px solid var(--green); display: inline-block; }
.empty { color: var(--muted); padding: 32px 0; }

/* Třídy učitele */
.class-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.class-pill {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border-radius: 8px;
  padding: 10px 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); font-size: .92rem;
}
.class-pill strong { font-size: 1.1rem; }
.dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot-ok { color: var(--muted); }
.dot-ok::before { background: var(--green); }
.dot-warn { color: #b35a00; }
.dot-warn::before { background: var(--orange); }

/* Přehled alb */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.album-card {
  display: block; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.album-card:hover { transform: translateY(-3px); box-shadow: 0 6px 22px rgba(60, 60, 60, .16); color: var(--text); }
.album-cover { position: relative; aspect-ratio: 4 / 3; background: #e6e8e3; display: flex; align-items: center; justify-content: center; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-empty { color: #999; font-size: .9rem; }
.album-body { padding: 12px 16px 14px; border-top: 3px solid var(--green); }
.album-body p { margin: 0; }
.album-body .chip { margin-right: 4px; }
.badge { position: absolute; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 4px; }
.badge-shared { top: 10px; left: 10px; background: var(--orange); color: #fff; }

/* Dropzone */
.dropzone {
  border: 2px dashed #b9c9a5; border-radius: var(--radius); background: #fafcf7; padding: 26px 16px; text-align: center;
  margin-bottom: 22px; transition: background .15s, border-color .15s;
}
.dropzone.over { background: var(--green-soft); border-color: var(--green); }
.dz-text { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.dz-text svg { color: var(--green); }
.dz-text strong { color: var(--text); font-size: 1.1rem; }
.dz-progress { max-width: 520px; margin: 14px auto 0; }
.bar { height: 8px; background: #e2e8da; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.dz-status { font-size: .9rem; margin-top: 6px; color: var(--muted); }
.dz-status .err { color: var(--red); display: block; }

/* Mřížka fotek */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ph { position: relative; margin: 0; aspect-ratio: 1; background: #e6e8e3; border-radius: 6px; overflow: hidden; }
.ph a { display: block; width: 100%; height: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.ph a:hover img { transform: scale(1.04); }
.ph.new { animation: pop .35s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
.ph-check { position: absolute; top: 6px; right: 6px; cursor: pointer; }
.ph-check input { position: absolute; opacity: 0; }
.ph-check span {
  display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.ph-check input:checked + span { background: var(--green); }
.ph-check input:checked + span::after { content: "✓"; display: block; color: #fff; text-align: center; font-weight: 700; line-height: 22px; }
.ph-check input:focus-visible + span { outline: 2px solid var(--orange); }
.ph:has(input:checked) { outline: 3px solid var(--green); outline-offset: -3px; }
.cover-badge { bottom: 6px; left: 6px; background: var(--green); color: #fff; }
.selbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.selbar span { font-weight: 600; margin-right: auto; }

/* Tabulky správy */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 8px 10px 8px 0; border-bottom: 1px solid #eee; vertical-align: middle; }
.table select { width: auto; padding: 4px 6px; font-size: .9rem; }
.table tr.inactive td { color: #aaa; }

/* Prohlížeč fotek */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(15, 17, 14, .96); display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-btn {
  position: absolute; background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 48px; height: 48px; border-radius: 50%;
  font-size: 26px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.lb-btn:hover { background: rgba(255, 255, 255, .25); color: #fff; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-close { top: 14px; right: 14px; }
.lb-dl { top: 14px; right: 74px; font-size: 20px; }
.lb-count { position: absolute; top: 26px; left: 20px; color: #bbb; font-size: .9rem; }

@media (max-width: 600px) {
  h1 { font-size: 1.4rem; }
  .brand strong { font-size: 1.15rem; }
  .brand img { width: 42px; height: 42px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .albums { grid-template-columns: 1fr 1fr; gap: 12px; }
  .album-body { padding: 8px 10px 10px; }
  .card { padding: 18px; }
  .lb-prev, .lb-next { display: none; }
}
@media (max-width: 380px) { .albums { grid-template-columns: 1fr; } }
