

@media (max-width: 600px) {
  .category-menu {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.7em;
  }
  .category-menu .cat-btn {
    width: 100%;
    box-sizing: border-box;
    font-size: 1em;
    margin-bottom: 0;
    padding: 0.7em 1em;
  }
}
@media (max-width: 600px) {
  .category-menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.7em;
  }
  .category-menu .cat-btn {
    width: 100%;
    box-sizing: border-box;
    font-size: 1em;
    margin-bottom: 0;
    padding: 0.7em 1em;
  }
}
.wine-name-bold {
  font-weight: bold;
}
.wine-year-normal {
  font-weight: normal;
}
@media (max-width: 600px) {
  .header h1 {
    white-space: pre-line;
    text-align: center;
    font-size: calc(1.2em - 1pt) !important;
  }
}
.price-row {
  width: 40%;
  display: flex;
  justify-content: flex-end;
  margin-top: 0.2rem;
}
@media (max-width: 600px) {
  .item .price {
    font-size: calc(1em - 1pt) !important;
  }
}
@media (max-width: 600px) {
  body,
  .header h1,
  .section-title,
  h1.category-header,
  #topWinesTitle,
  .item .title,
  .item .color-country,
  .item .meta,
  .item .description,
  .btn,
  .btn.small,
  .btn-show-filters,
  .btn-reset,
  .subcategory-header,
  .group-title,
  .country-header,
  .filters-panel select,
  .filters-panel input[type="number"],
  .search-bar input,
  .grape-filter summary,
  .year-filter summary,
  .price-filter summary,
  .grape-checkboxes label,
  .year-inputs input[type="number"],
  .year-display,
  .price-inputs input[type="number"],
  .price-display,
  .modal-header h2,
  .form-group label,
  .form-group input,
  .form-group textarea,
  .form-checkboxes label,
  #editForm button,
  .back-to-top {
    font-size: calc(1em - 1pt) !important;
  }
  h1,
  .section-title,
  h1.category-header,
  #topWinesTitle,
  .group-title,
  .subcategory-header,
  .country-header {
    font-size: calc(1.2em - 1pt) !important;
  }
}
* {
    box-sizing: border-box
}

body {
    font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: #f6f6f6;
    color: #666
}

.header {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.2rem;
    background: #fff;
    border-bottom: 1px solid #e5e5e5
}

.header h1 {
    font-size: 1.2rem;
    margin: 0 auto;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 1rem
}

.narrow {
    max-width: 560px
}

body > .container {
    margin-top: 1rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem
}

@media(min-width:720px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr
    }
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04)
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08)
}

.card-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    margin: 0 auto 1rem;
    display: block;
    object-fit: contain;
}

.card h2 {
      display: block;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1rem;
    border-radius: 999px;
    border: 1px solid #d1d1d1;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    color: #666
}

.btn.small {
    padding: .35rem .7rem;
    font-size: .9rem
}

.btn.danger {
    border-color: #f2b0b0;
    color: #a20000;
    background: #fff2f2
}

.filters {
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background: #f6f6f6;
    padding: 0.5rem 1rem;
    z-index: 100;
    width: 100%;
    left: 0;
    right: 0;
}

/* Search Bar (always visible) */
.search-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: space-between;
    justify-content: space-around;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.search-bar input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.btn-show-filters {
    padding: 0.7rem 1.2rem;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-show-filters:hover {
    background: #f5f5f5;
    border-color: #999;
}

.btn-show-filters.active {
    background: #e3e3e3;
    border-color: #666;
    font-weight: 600;
}

/* Filters Panel */
.filters-panel {
    margin: 1rem 0;
    padding: 1.2rem;
    animation: slideDown 0.3s ease;
  background: none;
  border-radius: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.filters-panel.hidden {
    display: none !important;
}

.filters-content {
    display: flex;
    flex-direction: column;
}

.filters-row {
  display: block;
  background: none;
}

.filters-row > * {
  width: 100%;
  margin-bottom: 0.5rem;
}

.filters-row-compact {
    border-top: 1px solid #d0d0d0;
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.filters-row-compact > * {
    flex: 0 0 calc(25% - 0.6rem);
    min-width: auto;
}

.filters-footer {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.filters input,
.filters select {
    padding: .5rem .7rem;
    border-radius: 8px;
    border: 1px solid #d8d8d8;
    background: #fff
}

.filters-panel select,
.filters-panel input[type="number"] {
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
  font-size: 0.9rem;
  color: #666;
  background: none;
}

.btn-reset {
    padding: 0.6rem 1.2rem;
  background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  color: #666;
    transition: all 0.2s;
}
 
.btn-reset:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Details-Elemente (Traube, Jahrgang, Preis) - NICHT width: 100%! */
.filters-row > details {
  flex: 1;
  min-width: 150px;
}

.filters #reset {
  padding: 0.5rem 1rem;
}

@media (max-width: 700px) {
  .filters-content {
    flex-direction: column;
    align-items: stretch;
  }
  .filters-content > * {
    width: 100%;
  }
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #666;
    margin: 2rem 0 1rem 0;
    padding: 0;
}

h1.category-header {
  margin-top: 3rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

#topWinesTitle {
    font-size: 32px;
    margin-top: 1.5rem;
}

.list {
    display: grid;
    gap: .6rem
}

.item {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: .7rem 1rem;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    background: #fff;
    position: relative;
}

.item .title {
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
}

.item .title-with-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.item .color-country {
    font-weight: normal;
        color: #666;
    font-size: 0.92rem;
}

.country-icon {
  height: 1.8em;
  width: auto;
  vertical-align: middle;
  margin-left: 0.3em;
}


h2.country-header {
  margin: 1.5rem 0 0 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
}

h2.country-header .region-normal {
    font-weight: normal;
}

.country-header strong,
.country-header .region-normal {
  flex: 0 1 auto;
}
.country-header .country-icon {
  margin-left: auto;
  flex: 0 0 auto;
}

.item .meta {
    color: #666;
    font-size: .92rem;
    text-align: left;
}

.item .price {
    text-align: right;
    font-weight: 700;
}

.item .list-header {
display: flex;
justify-content: space-between;
align-items: baseline}

.item .description {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.92rem;
    color: #666;
    font-style: italic;
}

.actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.alert {
    padding: .7rem 1rem;
    border-radius: 10px
}

.alert.error {
    background: #fff2f2;
    border: 1px solid #f2b0b0;
    color: #a20000
}

.empty {
    padding: 1rem;
    text-align: center;
    color: #666;
    border: 1px dashed #ddd;
    background: #fff;
    border-radius: 10px
}

form label {
    display: block;
    margin-top: .5rem;
    color: #666
}

form input,
form select,
form textarea {
    width: 100%;
    padding: .5rem .7rem;
    border-radius: 8px;
    border: 1px solid #d8d8d8;
    background: #fff;
    margin: .2rem 0 .6rem;
    font-family: inherit;
}

#adminSearch {
    width: 50%;
}

#createForm label {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 0.5rem; 
  margin-right: 1rem;
}

#importForm label input {
    width: auto;
  display: inline-flex;
  align-items: center;
  margin: 1rem;
}

/* Gruppentitel in der Weinkarte */
.group-title {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  padding-top: 0.8rem;
  padding-bottom: 0.4rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: #333;
  flex: 1 1 70%;
  min-width: 0;
  border-top: 2px solid #ccc;
}

/* Unterkategorie-Titel (z.B. Weisswein, Rotwein bei OFFENAUSSCHANK) */
.subcategory-header {
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
  padding-top: 0.6rem;
  padding-bottom: 0.3rem;
  font-weight: 700;
  font-size: 1rem;
  color: #555;
  border-top: 1px solid #ddd;
}

/* kleiner Abstand vor der ersten Gruppe */
.list > .group-title:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

/* Kategorie-Menü */
.category-menu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.category-menu .cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
    justify-content: center;
    color: #666666;
  padding: 0.7em 1em;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  gap: 0.3em;
}

.category-menu .cat-btn:hover {
  background: none;
}

.category-menu .cat-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.category-hint {
  margin: 0.5rem 0 1rem;
  color: #666;
  opacity: 0.8;
}

/* Grape Filter Styles */
.grape-filter {
  flex: 0 1 auto;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  padding: 0;
}

.grape-filter summary {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  font-size: 0.95rem;
}

.grape-filter summary:hover {
  background: #f2f2f2;
}

/* Details elements - prevent size changes when opening */
details {
  flex: 1;
  min-width: 200px;
}

details summary {
  cursor: pointer;
}

.grape-filter {
  flex: 0 0 auto;
  min-width: 280px;
}

.year-filter {
  flex: 0 0 auto;
  min-width: 280px;
}

.price-filter {
  flex: 0 0 auto;
  min-width: 280px;
}

.grape-filter-content {
  padding: 0.5rem 0.7rem;
    background: none;
  border-top: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0;
}

#grapeSearch {
  padding: 0.5rem 0.7rem;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.grape-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.grape-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
}

.grape-checkboxes input[type="checkbox"] {
  cursor: pointer;
}

.grape-checkboxes label.hidden {
  display: none;
}

/* Year Filter Styles */
.year-filter {
  flex: 0 1 auto;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  padding: 0;
}

.year-filter summary {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  font-size: 0.95rem;
}

.year-filter summary:hover {
  background: #f2f2f2;
}

.year-filter-content {
  padding: 0.8rem 0.7rem;
    background: none;
  border-top: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.year-range-container {
  position: relative;
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
}

.year-range-container::before {
  content: '';
  position: absolute;
  height: 6px;
  background: linear-gradient(90deg, #ddd 0%, #ddd 0%, #ddd 100%, #ddd 100%);
  border-radius: 3px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
  left: 0;
  right: 0;
  width: 100%;
}

.year-range-container input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 5;
}

.year-range-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #666;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.year-range-container input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #666;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.year-range-container input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: transparent;
  border-radius: 3px;
  border: none;
}

.year-range-container input[type="range"]::-moz-range-track {
  background: transparent;
  border: none;
}

.year-range-container input[type="range"]::-moz-range-progress {
  background: transparent;
  height: 6px;
  border-radius: 3px;
  border: none;
}

.year-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.year-inputs input[type="number"] {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.year-inputs span {
  color: #666;
  font-weight: 500;
}

.year-display {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  padding: 0.4rem 0;
}

/* Price Filter Styles */
.price-filter {
  flex: 0 1 auto;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  padding: 0;
}

.price-filter summary {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  font-size: 0.95rem;
}

.price-filter summary:hover {
  background: #f2f2f2;
}

.price-filter-content {
  padding: 0.8rem 0.7rem;
    background: none;
  border-top: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.price-range-container {
  position: relative;
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
}

.price-range-container::before {
  content: '';
  position: absolute;
  height: 6px;
  background: linear-gradient(90deg, #ddd 0%, #ddd 0%, #ddd 100%, #ddd 100%);
  border-radius: 3px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
  left: 0;
  right: 0;
  width: 100%;
}

.price-range-container input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 5;
}

.price-range-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #666;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.price-range-container input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #666;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.price-range-container input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: transparent;
  border-radius: 3px;
  border: none;
}

.price-range-container input[type="range"]::-moz-range-track {
  background: transparent;
  border: none;
}

.price-range-container input[type="range"]::-moz-range-progress {
  background: transparent;
  height: 6px;
  border-radius: 3px;
  border: none;
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.price-inputs input[type="number"] {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.price-inputs span {
  color: #666;
  font-weight: 500;
}

.price-display {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  padding: 0.4rem 0;
}


/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  margin: 0 auto;
  padding: 1rem;
  display: block;
  border-bottom: 1px solid #e5e5e5;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #222;
}

#editForm {
  padding: 1.5rem;
  display: grid;
  gap: 0.8rem;
}
#editForm input,
#editForm textarea,
#editForm select {
  max-width: 340px;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  margin: 0;
}

.form-group input {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #d8d8d8;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
}

.form-group input:focus {
  outline: none;
  border-color: #666;
}

.form-group textarea {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #d8d8d8;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  resize: vertical;
  min-height: 80px;
}

.form-group textarea:focus {
  outline: none;
  border-color: #666;
}

.form-checkboxes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

.form-checkboxes label {
  font-size: 0.85rem;
  font-weight: normal;
  color: #666;
  margin: 0;
  align-items: center;
  border-radius: 6px;
  flex: initial;
  max-width: none;
  border: none;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
}

.cat-btn.active {
  background: #f7f7f7;
  color: #b22222;
  box-shadow: 0 4px 16px rgba(178,34,34,0.12);
}

.cat-btn .cat-icon {
  height: 2.6em;
  width: auto;
  margin-right: 0;
  margin-bottom: 0.2em;
  flex-shrink: 0;
}
h1.category-header .cat-icon {
/* Icon für Weinempfehlung in .description */
.description .cat-icon {
  height: 1em;
  width: auto;
  vertical-align: middle;
  margin-bottom: 0;
  margin-right: 0.4em;
}
  height: 1em;
  width: auto;
  vertical-align: middle;
  margin-bottom: 0;
  margin-right: 0.4em;
}
.cat-btn .cat-name {
  font-weight: normal;
  font-size: 1.1em;
}
#editForm button:hover {
  background: #f2f2f2;
}

#editForm button.btn {
  border-color: #d1d1d1;
}

/* Footer */
.footer {
  margin-top: 3rem;
  padding: 2rem 0;
  background: transparent;
  border-top: 1px solid #e5e5e5;
}

.footer-content {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: center;
}

.back-to-top {
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: #666;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-to-top:hover {
  background: #f2f2f2;
  color: #333;
  border-color: #999;
}

.back-to-top:active {
  transform: scale(0.98);
}
