/* Vyřazená zařízení – veřejná stránka + lightbox */

.hidden {
  display: none !important;
}

:root {
  --bg-page: #0f1419;
  --bg-card: #1a2332;
  --bg-card-hover: #243044;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --border: #30363d;
  --overlay: rgba(0, 0, 0, 0.88);
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header */
.page-header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.page-header .header-contact {
  color: var(--accent);
  text-decoration: none;
}

.page-header .header-contact:hover {
  text-decoration: underline;
}

/* Patička – odkaz na správu mimo hlavní zorné pole */
.page-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.page-footer .footer-admin-link {
  color: var(--accent);
  text-decoration: none;
}

.page-footer .footer-admin-link:hover {
  text-decoration: underline;
}

.page-footer .footer-admin-note {
  color: var(--text-secondary);
  opacity: 0.9;
}

/* Search */
.search-wrap {
  margin: 1.5rem 0;
}

.search-wrap input {
  width: 100%;
  max-width: 360px;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input::placeholder {
  color: var(--text-secondary);
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Grid karet */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem 0 3rem;
}

.item-card {
  max-width: 420px;
  justify-self: center;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.item-card:hover {
  background: var(--bg-card-hover);
  border-color: #3d4a5c;
  box-shadow: var(--shadow);
}

.item-card .card-photos {
  position: relative;
  aspect-ratio: 4/3;
  background: #0d1117;
}

.item-card .card-photos a {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.item-card .card-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: middle;
}

.item-card .card-photos .card-thumbs {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  flex-wrap: wrap;
}

.item-card .card-photos .card-thumb {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
}

.item-card .card-photos .card-thumb:hover {
  border-color: var(--accent);
  opacity: 1;
}

.item-card .card-photos .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card .card-body {
  padding: 1.25rem;
}

.item-card h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.item-card .description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-card .description.is-expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
  display: block;
}

.item-card .description-wrap {
  margin-bottom: 0.25rem;
}

.item-card .description-toggle {
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  appearance: none;
}

.item-card .description-toggle:hover {
  color: var(--accent-hover, #5ba3e8);
}

.item-card .photo-count {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Prázdný stav */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-state p {
  margin: 0;
  font-size: 1.05rem;
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox .lightbox-inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox .lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.lightbox .lightbox-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.lightbox .lightbox-close svg {
  width: 24px;
  height: 24px;
}

.lightbox .lightbox-prev,
.lightbox .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox .lightbox-prev:hover,
.lightbox .lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox .lightbox-prev {
  left: 1rem;
}

.lightbox .lightbox-next {
  right: 1rem;
}

.lightbox .lightbox-prev svg,
.lightbox .lightbox-next svg {
  width: 28px;
  height: 28px;
}

.lightbox .lightbox-prev[hidden],
.lightbox .lightbox-next[hidden] {
  display: none;
}

.lightbox .lightbox-counter {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

.lightbox .lightbox-error {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.lightbox .lightbox-error.hidden {
  display: none;
}

/* —— Admin —— */
.admin-login {
  max-width: 360px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-login h1 {
  margin: 0 0 1.5rem 0;
  font-size: 1.35rem;
}

.admin-login label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.admin-login input {
  width: 100%;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-login button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.admin-login button[type="submit"]:hover {
  background: rgba(88, 166, 255, 0.15);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-toolbar a {
  color: var(--accent);
  text-decoration: none;
}

.admin-toolbar a:hover {
  text-decoration: underline;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  margin: 0;
}

button.btn {
  box-sizing: border-box;
}

.btn-primary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: rgba(88, 166, 255, 0.15);
}

.btn-danger {
  background: transparent;
  color: #f85149;
  border: 1px solid #f85149;
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.15);
}

.admin-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.admin-form h2 {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
}

.admin-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.admin-form input[type="text"],
.admin-form textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

.admin-form textarea {
  min-height: 100px;
  resize: vertical;
}

.description-hint {
  margin: 0.35rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.admin-form .file-upload {
  margin-bottom: 1rem;
  position: relative;
}

.admin-form .file-upload .btn-file {
  display: inline-flex;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  margin-bottom: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
}

.admin-form .file-upload .btn-file:hover {
  background: rgba(88, 166, 255, 0.15);
}

.admin-form .file-upload .file-input-hidden {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
}

.admin-form .file-list {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.admin-list .item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.admin-list .item-row .thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.admin-list .item-row .no-thumb {
  width: 80px;
  height: 60px;
  background: var(--border);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.admin-list .item-row .body {
  flex: 1;
  min-width: 0;
}

.admin-list .item-row .body strong {
  display: block;
  margin-bottom: 0.25rem;
}

.admin-list .item-row .body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-list .item-row .actions {
  flex-shrink: 0;
}

.item-row-edit {
  width: 100%;
  flex: 1 1 100%;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.item-row-edit .edit-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.item-row-edit .edit-form input[type="text"],
.item-row-edit .edit-form textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

.item-row-edit .edit-form textarea {
  min-height: 80px;
  resize: vertical;
}

.edit-photos-label {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.edit-photos-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.edit-photo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.edit-photo-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.item-row-edit .file-upload {
  margin-bottom: 1rem;
  position: relative;
}

.item-row-edit .file-upload .btn-file {
  display: inline-flex;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  margin-bottom: 0.5rem;
}

.item-row-edit .file-upload .file-input-hidden {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
}

.item-row-edit .file-list {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.edit-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  min-height: auto;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.admin-error {
  color: #f85149;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
