/*
 * CampgroundViews v3 — Shared Components
 * Nav, footer, buttons, cards, modals, forms, badges
 */

/* ══════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-lg);
  box-shadow: var(--shadow-sm);
}
.nav-logo img {
  height: 58px;
  width: auto;
  vertical-align: middle;
  display: inline-block;
}
.nav-logo .logo-mobile { display: none; }
@media (max-width: 768px) {
  .nav-logo .logo-desktop { display: none; }
  .nav-logo .logo-mobile { display: block; height: 42px; }
}
.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-sm);
}
.nav-center a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}
.nav-center a:hover,
.nav-center a.active {
  background: var(--brand-green-pale);
  color: var(--brand-green);
}
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* User dropdown */
.user-menu {
  position: relative;
}
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-green-pale), var(--brand-green-mist));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-green-dark);
  cursor: pointer;
}
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: var(--sp-sm) 0;
  z-index: 1001;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: block;
  padding: var(--sp-sm) var(--sp-md);
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.15s;
}
.user-dropdown a:hover {
  background: var(--brand-green-pale);
}

/* Hamburger */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 1.3rem;
  color: var(--text);
  transition: background 0.2s;
}
.hamburger-btn:hover { background: var(--brand-green-pale); }

/* Mobile nav */
@media (max-width: 900px) {
  .nav-center {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--card, #fff);
    border-bottom: 2px solid var(--border);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    padding: 8px 0;
    z-index: 999;
    transform: none;
  }
  .nav-center.nav-open { display: flex; }
  .nav-center a {
    padding: 14px 24px;
    min-height: 48px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text, #2c3e2d);
    border-bottom: 1px solid var(--border, #e0ddd4);
    width: 100%;
  }
  .nav-center a:last-child { border-bottom: none; }
  .nav-center a:hover, .nav-center a:active {
    background: var(--brand-green-pale, #eef5e6);
    color: var(--brand-green, #3a7d44);
  }
  .hamburger-btn { display: flex; }
  .btn-gold-nav { display: none; }
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand-green);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--brand-green-dark);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--brand-green);
  color: var(--brand-green);
  background: var(--brand-green-pale);
}

.btn-gold {
  background: var(--gold);
  color: #ffffff;
  font-weight: 700;
}
.btn-gold:hover {
  background: var(--gold-dark);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--brand-green-pale);
  border-color: var(--brand-green-light);
}

.btn-danger {
  background: var(--red);
  color: #ffffff;
}
.btn-danger:hover { background: #a93226; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  min-height: 36px;
}
.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  min-height: 52px;
}

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-green-mist);
}
.card-body {
  padding: var(--sp-md) var(--sp-lg);
}
.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--brand-green-mist), var(--surface));
  position: relative;
}

/* ══════════════════════════════════════════
   BADGES & TAGS
   ══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-green  { background: var(--brand-green-pale); color: var(--brand-green-dark); }
.badge-gold   { background: var(--gold-pale); color: var(--gold-dark); }
.badge-sky    { background: var(--sky-pale); color: var(--sky); }
.badge-red    { background: var(--red-pale); color: var(--red); }
.badge-yellow { background: var(--yellow-pale); color: var(--yellow); }
.badge-blue   { background: var(--sky-pale); color: var(--sky); }
.badge-muted  { background: var(--surface); color: var(--text-muted); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ══════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════ */
.form-group {
  margin-bottom: var(--sp-md);
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: var(--sp-xs);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
}
.form-control::placeholder {
  color: var(--text-light);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--brand-green);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}
.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--brand-green);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(44,62,45,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--sp-xl);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: background 0.15s;
}
.modal-close:hover { background: var(--surface); }

@media (max-width: 600px) {
  .modal {
    max-width: 95vw;
    padding: var(--sp-lg);
  }
}

/* ══════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════ */
.footer {
  background: var(--text);
  color: #c8ddc8;
  padding: var(--sp-3xl) var(--sp-xl) var(--sp-xl);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--sp-xl);
  max-width: 1200px;
  margin: 0 auto;
}
.footer h4 {
  color: #e8f5e9;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-md);
}
.footer a {
  display: block;
  padding: 4px 0;
  color: #9abf9a;
  font-size: 0.88rem;
  transition: color 0.15s;
}
.footer a:hover { color: #e8f5e9; }
.footer-brand p {
  font-size: 0.85rem;
  color: #9abf9a;
  margin-top: var(--sp-sm);
  line-height: 1.6;
}
.footer-bottom {
  max-width: 1200px;
  margin: var(--sp-xl) auto 0;
  padding-top: var(--sp-lg);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #7aaa7a;
}
.footer-bottom-links {
  display: flex;
  gap: var(--sp-lg);
}
.footer-bottom-links a { color: #9abf9a; }
.footer-bottom-links a:hover { color: #e8f5e9; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom {
    flex-direction: column;
    gap: var(--sp-sm);
    text-align: center;
  }
}

/* ══════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  vertical-align: middle;
}
.data-table tr:hover td {
  background: var(--brand-green-pale);
}

/* ══════════════════════════════════════════
   BREADCRUMB
   ══════════════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: var(--sp-md) 0;
}
.breadcrumb a {
  color: var(--brand-green);
  transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--brand-green-dark); }
.breadcrumb-sep { color: var(--text-light); }

/* ══════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-xl) 0;
}
.pagination a,
.pagination button {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  background: var(--card);
  transition: background 0.15s, border-color 0.15s;
}
.pagination a:hover,
.pagination button:hover {
  background: var(--brand-green-pale);
  border-color: var(--brand-green-mist);
}
.pagination .active {
  background: var(--brand-green);
  color: #fff;
  border-color: var(--brand-green);
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ══════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: var(--sp-lg);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: #fff;
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: calc(100vw - var(--sp-xl));
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════ */
.progress-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand-green);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ══════════════════════════════════════════
   NEWSLETTER BANNER
   ══════════════════════════════════════════ */
.newsletter-banner {
  background: linear-gradient(135deg, var(--brand-green-pale), var(--surface));
  border: 1px solid var(--brand-green-mist);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
  text-align: center;
}
.newsletter-form {
  display: flex;
  gap: var(--sp-sm);
  max-width: 440px;
  margin: var(--sp-md) auto 0;
}
.newsletter-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  min-height: 44px;
}
@media (max-width: 600px) {
  .newsletter-form { flex-direction: column; }
}

/* ══════════════════════════════════════════
   ADMIN PAGES
   ══════════════════════════════════════════ */

/* Admin layout with persistent sidebar */
.admin-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-height, 72px));
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #2c3e2d;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--nav-height, 72px);
  height: calc(100vh - var(--nav-height, 72px));
  overflow-y: auto;
}

.admin-sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-sidebar-nav {
  flex: 1;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.admin-nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.admin-nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--brand-green, #3a7d44);
  padding-left: 13px;
}

.admin-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.admin-main-content {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 0;
  }
  .admin-sidebar-header { display: none; }
  .admin-sidebar-footer { display: none; }
  .admin-sidebar-nav {
    flex-direction: row;
    padding: 0;
  }
  .admin-nav-item {
    padding: 10px 14px;
    white-space: nowrap;
    font-size: 0.82rem;
    border-left: none !important;
    padding-left: 14px !important;
  }
  .admin-nav-item.active {
    border-bottom: 2px solid var(--brand-green, #3a7d44);
  }
}

.admin-page {
  padding: 32px var(--sp-lg);
  max-width: 1200px;
  margin: 0 auto;
}
.admin-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-dim, var(--text-muted));
  margin-bottom: var(--sp-md);
}
.admin-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.admin-breadcrumb a:hover {
  color: var(--brand-green);
  text-decoration: underline;
}
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
  gap: 12px;
}
.admin-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.admin-page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Admin filter bar */
.admin-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: var(--sp-md);
  flex-wrap: wrap;
  align-items: center;
}

/* Admin table wrapper */
.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.admin-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table-wrap thead th {
  background: var(--surface);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.admin-table-wrap tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.admin-table-wrap tbody tr:last-child {
  border-bottom: none;
}
.admin-table-wrap tbody tr:hover {
  background: var(--brand-green-pale);
}
.admin-table-wrap tbody td {
  padding: 10px 14px;
  font-size: 0.88rem;
  vertical-align: middle;
}
.listing-name {
  font-weight: 600;
  color: var(--text);
}

/* Admin pagination footer */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

/* Moderation queue items */
.mod-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.mod-queue-item:last-child {
  border-bottom: none;
}
.mod-queue-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.mod-queue-badge {
  flex-shrink: 0;
  padding-top: 2px;
}
.mod-queue-info {
  flex: 1;
  min-width: 0;
}
.mod-queue-preview {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 500px;
}
.mod-queue-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-dim, var(--text-muted));
}
.mod-queue-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .admin-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .mod-queue-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .mod-queue-actions {
    width: 100%;
  }
}
