/* Papier-Konfigurator Styling */
:root {
  --primary-color: #67b547;
  --primary-light: #67b547;
  --primary-dark: #526b2e;
  --primary-bg: #f3f7ed;
  --primary-bg-light: #fafcf7;
  --secondary-color: #444;
  --border-radius: 6px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Grundlayout */
body .papiere-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  font-family: var(--font-main);
  color: var(--secondary-color);
}

.headline {
  text-align: center;
  margin-bottom: 45px;
  color: var(--primary-color);  
  font-weight: 700;
}

/* Tabs */
.papier-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.papier-tab {
  background: var(--primary-bg);
  border: none;
  border-radius: var(--border-radius);
  padding: 12px 24px;
  font-size: 1em;
  color: var(--secondary-color);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.papier-tab:hover {
  background: rgba(143, 197, 60, 0.15);
  transform: translateY(-2px);
}

.papier-tab[aria-selected="true"] {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 10px rgba(106, 140, 60, 0.2);
}

/* Filter */
.papier-filter-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
}

#filter-toggle-btn {
  background: #f0f0f0;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9em;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

#filter-toggle-btn:hover {
  background: #e5e5e5;
}

#filter-toggle-btn.active {
  background: var(--primary-bg);
}

#filter-container {
  margin-top: 15px;
  background: #f9f9f9;
  border-radius: var(--border-radius);
  padding: 15px;
  width: 100%;
  max-width: 800px;
}

.papier-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.papier-filter-label {
  position: relative;
  cursor: pointer;
  padding-left: 30px;
  padding-right: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 4px;
  transition: var(--transition);
}

.papier-filter-label:hover {
  background: var(--primary-bg-light);
}

.papier-filter-checkbox {
  position: absolute;
  opacity: 0;
}

.checkmark {
  position: absolute;
  left: 8px;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
}

.papier-filter-checkbox:checked ~ .checkmark {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.papier-filter-checkbox:checked ~ .checkmark:after {
  display: block;
  left: 5px;
  top: 2px;
  width: 3px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Hauptcontainer */
.papier-container {
  position: relative;
  margin: 0 auto;
}

/* Kategorie-Panel */
.papier-kategorie-panel {
  animation: fadeEffect 0.3s;
}

@keyframes fadeEffect {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Grammatur-Auswahl */
.grammatur-selector {
  margin-bottom: 25px;
}

.grammatur-label {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--primary-light);
}

.grammatur-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.grammatur-button {
  background: var(--primary-bg);
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.9em;
  cursor: pointer;
  transition: var(--transition);
}

.grammatur-button:hover {
  background: rgba(143, 197, 60, 0.15);
  transform: translateY(-2px);
}

.grammatur-button.active {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

/* Detail-Panel */
.papier-detail-panel {
  display: none;
}

.papier-detail-panel.active {
  display: block;
  animation: fadeEffect 0.3s;
}

.papier-detail-panel.filtered {
  display: none;
}

/* Papier-Viewer */
.papier-viewer {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

/* Slider-Container */
.papier-slider-container {
  width: 100%;
  max-width: 700px;
  aspect-ratio: 1.414 / 1;
  background: #f5f5f5;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  flex-shrink: 0;
  margin: 0 auto 24px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.papier-slider-container img, .papier-slider .slider-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Slider-Design */
.papier-slider {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}

.papier-slider.dragging {
  cursor: grabbing;
}

.papier-slider .slider-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.papier-slider .slider-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.8);
  z-index: 5;
}

.papier-slider .slider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.papier-slider.dragging .slider-handle {
  transform: translate(-50%, -50%) scale(1.1);
}

.papier-slider .slider-handle::before,
.papier-slider .slider-handle::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--primary-color);
  border-right: 2px solid var(--primary-color);
}

.papier-slider .slider-handle::before {
  left: 10px;
  transform: rotate(-135deg);
}

.papier-slider .slider-handle::after {
  right: 10px;
  transform: rotate(45deg);
}

.papier-slider .slider-labels {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
  padding: 0 50px;
  box-sizing: border-box;
}

.slider-label-left, .slider-label-right {
  font-size: 1.1em;
  font-weight: 700;
  color: #444;
  background: rgba(255,255,255,0.85);
  border-radius: 16px;
  padding: 6px 18px;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.papier-slider.hover .slider-labels {
  opacity: 1;
  transform: translateY(0);
}

.slider-label-right {
  position: absolute !important;
  right: 50px !important;
}

.modal-slider-area .slider-label-right {
  position: absolute !important;
  right: 50px !important;
}

.slider-label-left, .slider-label-right {
  font-size: 0.8em !important;        /* Kleiner */
  font-weight: 600 !important;      /* Weniger fett */
}

.modal-slider-area .slider-label-left, .modal-slider-area .slider-label-right {
  font-size: 1.2em !important;        /* Fetter da Modal Popup */
  font-weight: 600 !important;      /* Fetter da Modal Popup */
}

/* Info-Grid */
.papier-info-grid {
  flex-grow: 1;
  background: white;
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--shadow-sm);
}

.papier-info-grid h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  font-size: 125%;
}

.info-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.info-item {
  flex: 1;
}

.info-label {
  font-size: 0.9em;
  color: #777;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-label i {
  color: var(--primary-color);
}

.info-value {
  font-weight: 500;
}

/* Nachhaltigkeitsinfo */
.nachhaltigkeits-info {
  margin-top: 20px;
  margin-bottom: 25px;
}

.eco-bar {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}

.eco-label {
  width: 60px;
  font-size: 0.9em;
  color: #666;
}

.eco-track {
  flex: 1;
  height: 12px;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.eco-fill {
  position: absolute;
  height: 100%;
  left: 0;
  top: 0;
  border-radius: 6px;
}

.eco-fill.gras {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.eco-fill.silphie {
  background: linear-gradient(90deg, #c39b3c, #e5ca7b);
}

.eco-value {
  min-width: 40px;
  text-align: right;
  font-weight: 600;
  font-size: 0.9em;
  color: #555;
}

/* Aktionsbuttons */
.papier-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.full-view-btn, .add-to-cart-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.full-view-btn {
  background: #f0f0f0;
  color: #444;
}

.add-to-cart-btn {
  background: var(--primary-color);
  color: white;
}

.full-view-btn:hover, .add-to-cart-btn:hover {
  transform: translateY(-3px);
}

.full-view-btn:hover {
  background: #e5e5e5;
}

.add-to-cart-btn:hover {
  background: var(--primary-light);
}

/* Modal - Vollständig überarbeitete responsive Lösung */
#papier-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 25px; /* 25px Rand zu allen Seiten */
  box-sizing: border-box;
}

#papier-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  /* Responsive Größenberechnung für A4 Querformat (1.414:1) */
  width: min(
    calc(100vw - 50px), /* Viewport-Breite minus 50px (25px links + 25px rechts) */
    calc((100vh - 50px) * 1.414) /* Viewport-Höhe minus 50px, multipliziert mit A4-Verhältnis */
  );
  
  height: min(
    calc((100vw - 50px) / 1.414), /* Berechnete Höhe basierend auf Breite */
    calc(100vh - 50px) /* Viewport-Höhe minus 50px (25px oben + 25px unten) */
  );
  
  /* Fallback für ältere Browser */
  max-width: calc(100vw - 50px);
  max-height: calc(100vh - 50px);
  
  background: white;
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.9);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
  font-size: 1.2em;
  color: #333;
}

.modal-close-btn:hover {
  background: white;
  transform: rotate(90deg);
}

.modal-slider-area {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px; /* Innerer Abstand */
  box-sizing: border-box;
}

.modal-slider-area .papier-slider-container {
  width: 100%;
  height: 100%;
  aspect-ratio: 1.414 / 1;
  background: #f5f5f5;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-slider-area .papier-slider {
  position: static !important;
  width: 100%;
  height: 100%;
}

.modal-labels {
  display: flex;
  justify-content: space-between;
  padding: 15px 20px;
  background: white;
}

.modal-label-unbedruckt, .modal-label-bedruckt {
  font-weight: 600;
}

.modal-label-bedruckt {
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .papier-slider-container {
    width: 600px;
    height: 600px;
  }
}

@media (max-width: 992px) {
  .papier-viewer {
    flex-direction: column;
  }
  
  .papier-slider-container {
    width: 100%;
    height: 500px;
    margin-bottom: 20px;
  }
}

@media (max-width: 768px) {
  .info-row {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
  }
  .info-item {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
  }
  .info-label {
    margin-bottom: 0;
    min-width: 90px;
    flex-shrink: 0;
  }
  .info-value {
    font-weight: 500;
    margin-left: 0;
  }
  
  .papier-slider-container {
    height: 400px;
  }
  
  .papier-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .papiere-main h1 {
    font-size: 1.8em;
  }
  
  .papier-slider-container {
    height: 300px;
  }
  
  /* Modal responsive Anpassungen für kleine Screens */
  #papier-modal {
    padding: 15px; /* Kleinerer Rand auf mobilen Geräten */
  }
  
  .modal-content {
    width: min(
      calc(100vw - 30px),
      calc((100vh - 30px) * 1.414)
    );
    
    height: min(
      calc((100vw - 30px) / 1.414),
      calc(100vh - 30px)
    );
    
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 30px);
  }
  
  .modal-slider-area {
    padding: 15px;
  }
  
  .modal-close-btn {
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    font-size: 1.1em;
  }
}

@media (max-width: 320px) {
  #papier-modal {
    padding: 10px; /* Noch kleinerer Rand für sehr kleine Screens */
  }
  
  .modal-content {
    width: min(
      calc(100vw - 20px),
      calc((100vh - 20px) * 1.414)
    );
    
    height: min(
      calc((100vw - 20px) / 1.414),
      calc(100vh - 20px)
    );
    
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
  
  .modal-slider-area {
    padding: 10px;
  }
}

/* Optimierung für sehr breite Bildschirme */
@media (min-width: 1920px) {
  .modal-content {
    /* Begrenze maximale Größe auf vernünftige Werte */
    max-width: 1400px;
    max-height: calc(1400px / 1.414);
  }
}

/* Optimierung für sehr hohe Bildschirme */
@media (min-height: 1200px) {
  .modal-content {
    max-height: 800px;
    max-width: calc(800px * 1.414);
  }
}

/* Papierinfo-Bereich optimiert */
.papier-info-bereich {
  margin: 48px auto 0 auto;
  padding: 40px 32px 32px 32px;
  background: var(--primary-bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  max-width: 1200px;
}

.papier-info-panel {
  margin-bottom: 0;
}

.papier-info-panel h2 {
  color: var(--primary-color);
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 18px;
  letter-spacing: 0.01em;
}

.papier-info-panel p {
  line-height: 1.7;
  margin-bottom: 18px;
  color: var(--secondary-color);
}

.papier-info-panel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-light);
}

.papier-info-panel ul {
  list-style: none;
  padding-left: 0;
  margin: 0 0 0 0;
}

.papier-info-panel ul li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 8px;
  color: var(--primary-color);
  font-weight: 600;
}

.papier-info-panel ul li::before {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--primary-color);
  position: absolute;
  left: 0;
  top: 2px;
}

@media (max-width: 700px) {
  .papier-info-bereich {
    padding: 24px 8px 16px 8px;
    max-width: 100%;
  }
  .papier-info-panel h2 {
    font-size: 1.3em;
  }
  .papier-info-panel p {
    font-size: 1em;
  }
  .papier-info-panel ul li {
    font-size: 1em;
  }
}

/* Shop-Empfehlungen Grid */
.papier-shop-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin: 28px 0 0 0;
  justify-content: flex-start;
}

.papier-shop-card {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}

.papier-shop-card a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
  padding: 0;
}

.papier-shop-card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: var(--primary-bg-light);
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 0;
}

.papier-shop-title {
  font-size: 1.08em;
  font-weight: 700;
  color: var(--primary-color);
  margin: 18px 0 8px 0;
  text-align: center;
}

.papier-shop-btn {
  background: var(--primary-color);
  color: #fff;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 0.98em;
  font-weight: 600;
  margin-bottom: 18px;
  margin-top: 8px;
  transition: background 0.2s, color 0.2s;
  box-shadow: 0 2px 8px rgba(106,140,60,0.08);
  display: inline-block;
}

.papier-shop-card:hover {
  box-shadow: 0 8px 24px rgba(106,140,60,0.18);
  transform: translateY(-4px) scale(1.03);
}

.papier-shop-card:hover .papier-shop-btn {
  background: var(--primary-light);
  color: #fff;
}

.papier-shop-card-placeholder {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg-light);
  color: #aaa;
  font-size: 1.1em;
  font-weight: 600;
  box-shadow: none;
}

.papier-shop-grid-placeholder {
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .papier-shop-grid {
    gap: 18px;
  }
  .papier-shop-card {
    width: 45vw;
    min-width: 160px;
    max-width: 260px;
  }
  .papier-info-grid {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    padding-left: 0;
    padding-right: 0;
  }
  .papier-info-bereich {
    padding-left: 8px;
    padding-right: 8px;
  }
  .papier-slider-container {
    max-width: 100vw;
  }
}

@media (max-width: 600px) {
  .papier-shop-grid {
    flex-direction: column;
    gap: 18px;
    align-items: center;
  }
  .papier-shop-card {
    width: 100%;
    max-width: 340px;
  }
  .papier-info-grid {
    padding: 16px 8px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Musterset bestellen */
.order-samples {
  background: #f6f9f4;
  border: 1px solid #e0e7db;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  margin: 2.5rem auto 2rem auto;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  font-size: 1.18rem;
  color: #3a4a2b;
  box-shadow: 0 2px 8px rgba(60,80,40,0.04);
}

.order-samples-text {
  flex: 1 1 0;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-samples a {
  display: inline-flex;
  align-items: center;
  background: #8dc63f;
  color: #fff;
  font-weight: 700;
  padding: 0.8em 2.2em;
  border-radius: 24px;
  text-decoration: none;
  font-size: 1.13rem;
  box-shadow: 0 1px 4px rgba(60,80,40,0.07);
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  margin-left: 0;
  border: none;
  outline: none;
  cursor: pointer;
}

.order-samples a:hover {
  background: #6fa32b;
  box-shadow: 0 2px 8px rgba(60,80,40,0.13);
  transform: translateY(-2px) scale(1.04);
}

.order-samples a::after {
  content: "→";
  display: inline-block;
  margin-left: 0.7em;
  font-size: 1.2em;
  font-weight: 400;
  opacity: 0.7;
}

@media (max-width: 700px) {
  .order-samples {
    flex-direction: column;
    gap: 1.2rem;
    padding: 1.2rem 0.7rem;
    font-size: 1rem;
  }
  .order-samples-text {
    text-align: center;
  }
}