:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --background: #f3f4f6;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  background-color: #111827;
  color: #f3f4f6;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.header-link,
.header-link:visited,
.header-link:hover,
.header-link:active {
  text-decoration: none !important;
  color: #f3f4f6 !important;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  transition: opacity 0.2s;
}

.header-link:hover {
  opacity: 0.95;
}

.shadow {
  height: 80px;
}

/* Main Content Container */
.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Cards / Boxes */
.box {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  padding: 15px;
  margin: 10px auto;
  width: 100%;
  max-width: 600px;
  text-align: center;
  font-size: 1.125rem;
  border: 1px solid var(--border);
  box-sizing: border-box;
  overflow: hidden;
  /* Prevent overflow */
}

/* Ensure images inside box never break it */
.box img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.boxInfo {
  font-size: 0.85rem;
  text-align: right;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Button Links */
.button-link,
.button-link:visited {
  display: inline-block;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  background-color: var(--background);
  border: 1px solid var(--border);
}

.button-link:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Search Container */
.search-container {
  display: flex;
  gap: 0;
  width: 100%;
  position: relative;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-button {
  padding: 12px 20px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.search-button:hover {
  background-color: var(--primary-hover);
}

/* Forms */
.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #fff;
  font-size: 1rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  box-sizing: border-box;
  margin-bottom: 1.5rem;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: left;
  font-size: 1rem;
}

.form-submit {
  background-color: var(--primary);
  color: white;
  font-weight: 600;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-size: 1.1rem;
  width: 100%;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-submit:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.form-submit:active {
  transform: translateY(0);
}

.btn-outline {
  display: block;
  width: 100%;
  background-color: var(--background);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
  text-align: center;
}

.btn-outline:visited {
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: white !important;
  border-color: var(--primary);
}

/* Links inside content */
a:not(.nav-box-link):not(.button-link):not(.badge):not(.edit-icon-link):not(.add-icon-link):not(.delete-icon-link):not(.btn-outline),
a:not(.nav-box-link):not(.button-link):not(.badge):not(.edit-icon-link):not(.add-icon-link):not(.delete-icon-link):not(.btn-outline):visited {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:not(.nav-box-link):not(.button-link):not(.badge):not(.edit-icon-link):not(.add-icon-link):not(.delete-icon-link):hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* Tables in box */
.box table {
  width: 100%;
  border-collapse: collapse;
}

.box table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.box table tr:last-child td {
  border-bottom: none;
}

/* Game Card Layout */
.game-card {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  text-align: left;
}

.game-info {
  flex: 1;
}

.game-info table {
  width: auto;
}

.game-info td {
  padding: 4px 8px;
  border-bottom: none !important;
}

/* Media/Actions container (Image + Edit) */
/* Media/Actions container (Image + Edit) */
.game-media {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
}

.game-image {
  flex: 0 0 150px;
  display: flex;
  justify-content: center;
  align-items: center;
  order: 1;
  /* Image always first (left on desktop/mobile logic) */
}

.game-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

.game-edit {
  flex: 0 0 auto;
  text-align: center;
  order: 2;
  /* Edit button always second (right) */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edit-icon-link,
.add-icon-link,
.delete-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--background);
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  font-size: 1.2rem;
}

/* Fix visited state color */
.edit-icon-link:visited,
.add-icon-link:visited,
.delete-icon-link:visited {
  color: var(--text-main);
}

.edit-icon-link:hover,
.add-icon-link:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.1);
  text-decoration: none;
}

.delete-icon-link:hover {
  background-color: #ef4444;
  /* Red for delete */
  color: white;
  border-color: #ef4444;
  transform: scale(1.1);
  text-decoration: none;
}

/* Star Ratings */
.star-rating {
  white-space: nowrap;
  color: #f59e0b;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  background-color: #e5e7eb;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-main);
  text-decoration: none;
  margin: 5px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.badge:visited {
  color: var(--text-main);
}

.badge:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge i {
  margin-left: 8px;
  color: inherit;
}


/* Search Box Styles */
.search-container {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 20px;
  align-items: stretch;
}

.search-input {
  flex: 1;
  max-width: 400px;
  padding: 10px 15px;
  border-radius: 8px 0 0 8px;
  border: 1px solid var(--border);
  border-right: none;
  font-size: 1rem;
  margin-bottom: 0px !important;
}

.search-button {
  padding: 10px 24px;
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border);
  border-left: none;
  background-color: var(--background);
  color: var(--text-main);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  width: auto;
  box-shadow: none;
  letter-spacing: normal;
}

.search-button:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.content-desktop {
  display: block;
}

.content-mobile {
  display: none;
}

/* Helper */
.checked {
  color: #f59e0b;
}

/* Navigation Grid Global */
.nav-grid {
  width: 100%;
  display: block;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .content-desktop {
    display: none;
  }

  .content-mobile {
    display: block;
  }

  .header {
    height: 60px;
  }

  .header-link {
    font-size: 1.5rem;
  }

  .shadow {
    height: 70px;
  }

  .main-content {
    padding: 5px;
  }

  .box {
    padding: 8px;
    /* Further reduced from 10px */
    margin: 5px auto;
    font-size: 1rem;
  }

  .button-link {
    font-size: 1.1rem;
  }

  /* Layout */
  .game-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    /* Remove inherited desktop gap */
  }

  .game-info {
    width: 100%;
    margin-bottom: 0;
  }

  .game-info table {
    width: 100%;
    margin-bottom: 0;
  }

  /* ... td styles ... */

  .game-info td {
    display: table-cell;
    text-align: left;
    padding: 2px 0;
    /* Aggressively reduced padding */
    border-bottom: 1px solid #f3f4f6 !important;
    font-size: 0.95rem;
    line-height: 1.3;
    /* Tighter line height */
  }

  .game-info tr:last-child td {
    border-bottom: none !important;
  }

  .game-info td:first-child {
    width: 35%;
    color: var(--text-muted);
    font-weight: 600;
  }

  /* New Mobile Media Layout */
  .game-media {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    /* Reduced from 10px */
    padding-top: 5px;
    /* Reduced from 10px */
    border-top: 1px solid var(--border);
  }

  /* Navigation Grid for Start Page */
  .nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 0 5px;
    /* Match main content padding */
  }

  .nav-grid .box {
    margin: 0 !important;
    /* Let grid gap handle spacing */
    width: 100%;
    height: 100%;
    /* Uniform height */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }

  /* Navigation Box Links */
  .nav-box-link {
    text-decoration: none !important;
    display: block;
    width: 100%;
    color: var(--text-main) !important;
  }

  .nav-box-link:visited {
    color: var(--text-main) !important;
    text-decoration: none !important;
  }

  .nav-box-link .box {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main) !important;
  }

  .nav-box-link:hover {
    text-decoration: none !important;
    color: white !important;
  }

  .nav-box-link:hover .box {
    background-color: var(--primary);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  }

  .game-image {
    order: 1;
    /* Left is default order for us here effectively */
    flex: 1;
    justify-content: flex-start;
    max-width: none;
  }

  /* Center image if no edit button (Logged out) */
  .game-image:only-child {
    justify-content: center;
    order: 0;
  }

  .game-image img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    align-self: flex-start;
  }

  /* Center image in its container if alone */
  .game-image:only-child img {
    align-self: center;
  }

  .game-edit {
    order: 2;
    /* Right */
    flex: 0 0 auto;
    padding-left: 20px;
    text-align: right;
  }

  /* Search */
  .search-container {
    flex-direction: row;
  }

  .search-input {
    max-width: none;
  }
}


/* Total Row Highlighting in Tables */
.box table tr.total-row td {
  border-top: 1px solid #858585 !important;
}

/* Price Tag Style */
.price-tag {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  position: relative;
  letter-spacing: 0.5px;
}

.price-tag::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid #667eea;
}

.price-tag::after {
  content: '';
  position: absolute;
  left: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

/* Range Slider Styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  transition: background 0.3s;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}










input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #ddd;
}

/* Filter Toggle Button - ID selector for specificity */
#filterToggle {
  padding: 12px 16px;
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  /* Removes blue overlay on mobile */
  outline: none;
}

/* Only apply hover effect if the user has a fine pointer (mouse) */
@media (pointer: fine) {
  #filterToggle:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
  }
}

/* Ensure focus/active states stay grey on touch devices */
#filterToggle:focus,
#filterToggle:active {
  background-color: var(--background);
  color: var(--text-main);
  border-color: var(--border);
}

/* Wedding Page Gallery */
.wedding-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 15px;
  padding: 20px 5px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Firefox */
}

.wedding-gallery::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

.gallery-item {
  flex: 0 0 85%;
  /* Mobile: Show 85% of image so user sees next one */
  scroll-snap-align: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  aspect-ratio: 3/4;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (min-width: 768px) {
  .gallery-item {
    flex: 0 0 350px;
    /* Desktop: Fixed width */
  }
}