/* ============================================================
   Jagdclub – Stylesheet
   Farbpalette: Waldgrün, Warmbraun, Pergament
   ============================================================ */

:root {
  --color-bg:           #f5f0e8;
  --color-surface:      #ffffff;
  --color-primary:      #3a5a2b;
  --color-primary-dark: #2a4220;
  --color-primary-light:#4d7a39;
  --color-accent:       #8b5e3c;
  --color-accent-light: #a6724d;
  --color-text:         #2c2c2c;
  --color-text-muted:   #6b6b6b;
  --color-border:       #d4c9b0;
  --color-danger:       #b83232;
  --color-danger-dark:  #922828;
  --color-success:      #27ae60;
  --radius:             8px;
  --radius-lg:          12px;
  --shadow:             0 2px 10px rgba(0,0,0,0.12);
  --shadow-lg:          0 4px 24px rgba(0,0,0,0.18);
  --transition:         0.2s ease;
  --navbar-height:      60px;
  --font-family:        'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Utilities ─────────────────────────────────────────────── */
.hidden   { display: none !important; }
.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); font-size: 0.9rem; }
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition);
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-dark);
  border-color: var(--color-danger-dark);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
  padding: 0.4rem 0.6rem;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--color-danger);
  text-decoration: none;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Form Elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--color-text);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;          /* ≥16px verhindert Auto-Zoom auf iOS Safari */
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(58,90,43,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-checkbox input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.form-checkbox label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.error-msg {
  color: var(--color-danger);
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  background: rgba(184,50,50,0.08);
  border-left: 3px solid var(--color-danger);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 0.5rem;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.navbar-title {
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.85;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.navbar-user #nav-username {
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.navbar .btn-outline {
  color: #fff;
  border-color: rgba(255,255,255,0.6);
}
.navbar .btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}
.navbar .btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.navbar .btn-primary:hover {
  background: var(--color-accent-light);
  border-color: var(--color-accent-light);
}

.navbar-wappen {
  height: 36px;
  width: auto;
  vertical-align: middle;
  margin-right: 0.4rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, #4d7a39 100%);
}
.login-container { width: 100%; padding: 1rem; }
.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  max-width: 420px;
  margin: 0 auto;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-wappen {
  height: 100px;
  width: auto;
  margin: 0 auto 0.75rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.login-logo h1 {
  font-size: 1.8rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}
.login-logo p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ── Sub-Navigation ────────────────────────────────────────── */
.subnav {
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
}
.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.subnav a:hover {
  color: var(--color-primary);
  text-decoration: none;
}
.subnav a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.subnav a.admin-only { display: none; }
.subnav a.admin-only.visible { display: inline-flex; }

@media (max-width: 768px) {
  .subnav { padding: 0 0.5rem; }
  .subnav a { padding: 0.6rem 0.7rem; font-size: 0.82rem; }
}

/* ── Tag Filter ────────────────────────────────────────────── */
.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.tag-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tag-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.tag-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── Gallery Sections ──────────────────────────────────────── */
.gallery-section { margin-bottom: 2.5rem; }
.gallery-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.gallery-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.tag-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  white-space: nowrap;
}

/* ── Gallery ───────────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
.gallery-item-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  padding: 1.5rem 0.85rem 0.75rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.gallery-item:hover .gallery-item-overlay { opacity: 1; }
.gallery-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-item-meta {
  font-size: 0.78rem;
  opacity: 0.85;
  margin-top: 0.15rem;
}
.gallery-item-skeleton {
  background: linear-gradient(90deg, #e8e0d0 25%, #f0e8d8 50%, #e8e0d0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s infinite;
  height: 220px;
  border-radius: var(--radius);
}
@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Upload Preview */
.upload-preview {
  margin-top: 0.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--color-border);
}
.upload-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 99px;
  transition: width 0.2s ease;
}
#upload-progress-text {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ── Image Detail ───────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.back-link:hover { text-decoration: underline; }

.image-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 900px;
}
.image-detail-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #000;
  max-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-detail-hero img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
}
.image-detail-meta h2 {
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  margin-bottom: 0.5rem;
}
.image-detail-meta p { margin-bottom: 0.75rem; }
.detail-info {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

/* ── Comments ──────────────────────────────────────────────── */
.comments-section { max-width: 900px; }
.comments-section h3 {
  font-size: 1.1rem;
  color: var(--color-primary-dark);
  margin-bottom: 1.25rem;
}
.comment-item {
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}
.comment-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.comment-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.comment-name { font-weight: 600; font-size: 0.9rem; }
.comment-date { font-size: 0.78rem; color: var(--color-text-muted); }
.comment-text { font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; }

.comment-form { margin-top: 1.5rem; }
.comment-form textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.comment-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(58,90,43,0.15);
}
.comment-form button { margin-top: 0.6rem; }

.comments-empty {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box h2 {
  font-size: 1.25rem;
  color: var(--color-primary-dark);
  margin-bottom: 1.25rem;
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Admin Page ────────────────────────────────────────────── */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.admin-toolbar h2 {
  font-size: 1.3rem;
  color: var(--color-primary-dark);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.admin-table thead {
  background: var(--color-primary);
  color: #fff;
}
.admin-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.admin-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:nth-child(even) td { background: #faf7f2; }
.admin-table tr:hover td { background: #f0ebe0; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-admin   { background: var(--color-accent); color: #fff; }
.badge-member  { background: #e0e8d8; color: var(--color-primary-dark); }

.action-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ── Responsive ────────────────────────────────────────────── */

/* Tablet (≤ 900px) */
@media (max-width: 900px) {
  .admin-table th:nth-child(4),   /* Registriert */
  .admin-table td:nth-child(4) { display: none; }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {

  /* Navbar: Wappen+Name links, nur Abmelden rechts */
  .navbar { padding: 0 0.75rem; }
  .navbar-brand { font-size: 1rem; gap: 0.35rem; }
  .navbar-wappen { height: 28px; }
  .navbar-user { gap: 0.5rem; }
  .navbar-user #nav-username { display: none; }   /* Platz sparen */

  /* Subnav: gleichmäßig aufteilen, Icons ohne Text bei Platzmangel */
  .subnav { padding: 0; }
  .subnav a {
    flex: 1;
    justify-content: center;
    padding: 0.6rem 0.4rem;
    font-size: 0.8rem;
    gap: 0.25rem;
  }

  /* Container weniger Padding */
  .container { padding: 1rem 0.75rem; }

  /* Login */
  .login-card { padding: 1.5rem 1.1rem; }
  .login-wappen { height: 72px; }
  .login-logo h1 { font-size: 1.5rem; }

  /* Gallery toolbar: Tags oben, Upload-Button darunter volle Breite */
  .gallery-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .gallery-toolbar .btn-primary { width: 100%; justify-content: center; }
  .tag-filter { justify-content: flex-start; }

  /* Galerie: 2 Spalten */
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  .gallery-item img { height: 150px; }
  /* Overlay auf Touch immer sichtbar */
  .gallery-item-overlay { opacity: 1; }
  .gallery-item-title { font-size: 0.8rem; }
  .gallery-item-meta { font-size: 0.7rem; }

  /* Bild-Detail */
  .image-detail-hero { max-height: 280px; border-radius: var(--radius); }
  .image-detail-hero img { max-height: 280px; }
  .image-detail-meta h2 { font-size: 1.2rem; }
  .detail-info { flex-direction: column; gap: 0.2rem; font-size: 0.82rem; }

  /* Kommentare */
  .comment-header { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .comment-form button { width: 100%; justify-content: center; }

  /* Modal: von unten einblenden, volle Breite */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem 1rem 2rem;   /* extra Padding unten für Home-Indicator */
    max-width: 100%;
    max-height: 92vh;
    width: 100%;
  }

  /* Admin-Tabelle: Spalten reduzieren */
  .admin-toolbar { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .admin-toolbar h2 { font-size: 1.1rem; }
  .admin-toolbar .btn { width: 100%; justify-content: center; }
  .admin-table { font-size: 0.8rem; }
  .admin-table th,
  .admin-table td { padding: 0.5rem 0.5rem; }
  /* Spalte "E-Mail" auf kleinen Screens ausblenden */
  .admin-table th:nth-child(2),
  .admin-table td:nth-child(2) { display: none; }
  .action-buttons { flex-direction: column; gap: 0.3rem; }
  .action-buttons .btn { font-size: 0.78rem; padding: 0.3rem 0.5rem; }
}

/* Klein-Mobil (≤ 430px – iPhone SE, iPhone 14) */
@media (max-width: 430px) {
  .navbar-brand span,
  .navbar-brand { font-size: 0.9rem; }
  .subnav a { font-size: 0.75rem; }

  /* 2 Spalten beibehalten, aber noch kleiner */
  .gallery-grid { gap: 0.5rem; }
  .gallery-item img { height: 130px; }

  /* Buttons im Modal volle Breite, untereinander */
  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  .modal-actions .btn { width: 100%; justify-content: center; }
}

/* ── Standort-Picker ─────────────────────────────────────────────────────── */

.location-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(58,90,43,0.08);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.location-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Wide modal variant (for map picker) */
.modal-box--wide {
  max-width: 680px;
}

/* Leaflet container inside modal — needs explicit height */
.leaflet-container {
  font-family: var(--font-family);
}

/* ── Pick-Modus Banner (Karte) ───────────────────────────────────────────── */

.pick-mode-banner {
  position: fixed;
  top: calc(var(--navbar-height) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .pick-mode-banner {
    white-space: normal;
    text-align: center;
    flex-direction: column;
    gap: 0.5rem;
    width: calc(100% - 2rem);
  }
}

