/* ChWeb Content Boxes - Einfache Inhaltsseiten mit Boxen */
/* Verwendbar für: Einfache Seiteninhalte mit 1-6 Boxen */

/* Page Einleitung */
.page-einleitung {
  font-size: 1.2em;
  line-height: 1.6;
  color: #666;
  margin: 20px 0 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-left: 4px solid #434fbf;
  border-radius: 0 8px 8px 0;
}

/* Content Boxes Grid */
.content-boxes {
  margin: 40px 0;
}

.content-boxes-grid {
  display: grid;
  gap: 30px;
  margin-top: 30px;
  position: relative;
}

/* Standard Grid (auto-fit) */
.content-boxes-grid:not([class*="content-boxes-cols-"]) {
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

/* Spezifische Spaltenanzahl - Überschreibt Standard-Grid */
.content-boxes-cols-1 {
  grid-template-columns: 1fr !important;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.content-boxes-cols-2 {
  grid-template-columns: repeat(2, 1fr) !important;
}

.content-boxes-cols-3 {
  grid-template-columns: repeat(3, 1fr) !important;
}

.content-boxes-cols-4 {
  grid-template-columns: repeat(4, 1fr) !important;
}

.content-boxes-cols-6 {
  grid-template-columns: repeat(6, 1fr) !important;
}

/* Responsive Anpassungen - Respektiert spezifische Spalten-Einstellungen */
@media (max-width: 1200px) {
  .content-boxes-cols-6 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (max-width: 992px) {
  .content-boxes-cols-4,
  .content-boxes-cols-6 {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .content-boxes-cols-3,
  .content-boxes-cols-4,
  .content-boxes-cols-6 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* 1 und 2 Spalten bleiben auf Tablet erhalten */
  .content-boxes-cols-1 {
    grid-template-columns: 1fr !important;
  }
  
  .content-boxes-cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Mobile: Alle Boxen untereinander (1 Spalte) */
@media (max-width: 480px) {
  .content-boxes-cols-1,
  .content-boxes-cols-2,
  .content-boxes-cols-3,
  .content-boxes-cols-4,
  .content-boxes-cols-6,
  .content-boxes-grid:not([class*="content-boxes-cols-"]) {
    grid-template-columns: 1fr !important;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Einzelne Content Box - Erweiterte Styling-Optionen */
.content-box {
  border: 1px solid #ddd;
  padding: 0;
  border-radius: 12px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  overflow: visible;
  /* Für Masonry Layout */
  box-sizing: border-box;
  break-inside: avoid;
  /* Verhindert Layout-Sprünge während Masonry-Anwendung */
  min-height: 200px;
  height: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Box Styles */
.content-box-modern {
  border-radius: 20px;
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.content-box-minimal {
  border-radius: 0;
  border: none;
  box-shadow: none;
  border-bottom: 3px solid #434fbf;
}

.content-box-card {
  border-radius: 16px;
  border: 2px solid #f0f0f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Shadow Variations */
.content-box-shadow-none {
  box-shadow: none !important;
}

.content-box-shadow-small {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

.content-box-shadow-medium {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.content-box-shadow-large {
  box-shadow: 0 8px 25px rgba(0,0,0,0.2) !important;
}

/* Animation Styles */
.content-box-animation-fade {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.content-box-animation-slide {
  transform: translateY(30px);
  opacity: 0;
  animation: slideInUp 0.6s ease forwards;
}

.content-box-animation-scale {
  transform: scale(0.9);
  opacity: 0;
  animation: scaleIn 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.content-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Deaktivierte Box (für Admin-Vorschau) */
.content-box.inactive {
  opacity: 0.5;
  border: 2px dashed #ccc;
  background: #f9f9f9;
}

.content-box.inactive:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.content-box.inactive::before {
  content: "DEAKTIVIERT";
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ff6b6b;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: bold;
  z-index: 10;
}

/* Standard Box Header Image */
.box-header-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
}

.box-header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.content-box:hover .box-header-image img {
  transform: scale(1.05);
}

/* Background Image mit Text-Overlay */
.box-background-image {
  width: 100%;
  min-height: 300px;
  height: auto;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 0;
}

.box-overlay-content {
  text-align: center;
  color: white;
  padding: 40px 20px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  max-width: 80%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 15px;
}

.box-overlay-content h3 {
  margin: 0 0 15px 0;
  font-size: 1.8em;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.box-overlay-content p {
  margin: 0;
  font-size: 1.1em;
  line-height: 1.5;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  flex-grow: 1;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Standard Box Content */
.box-content {
  padding: 25px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Flexible Überschriften-Styles für alle Heading-Level */
.box-content .box-title,
.box-overlay-content .box-title {
  margin: 0 0 15px 0;
  color: inherit;
  font-weight: 600;
  line-height: 1.3;
}

/* Spezifische Grössen für verschiedene Heading-Level */
.box-content h1.box-title,
.box-overlay-content h1.box-title {
  font-size: 2.2em;
}

.box-content h2.box-title,
.box-overlay-content h2.box-title {
  font-size: 1.8em;
}

.box-content h3.box-title,
.box-overlay-content h3.box-title {
  font-size: 1.4em;
}

.box-content h4.box-title,
.box-overlay-content h4.box-title {
  font-size: 1.2em;
}

.box-content h5.box-title,
.box-overlay-content h5.box-title {
  font-size: 1.1em;
}

.box-content h6.box-title,
.box-overlay-content h6.box-title {
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Fallback für alte h3-Regel */
.box-content h3:not(.box-title) {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.4em;
}

.box-content p {
  color: #666;
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Buttons - Konsistent mit chweb-filter.css */
.btn {
  display: inline-block;
  padding: 12px 30px;
  background: #434fbf;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.btn:hover {
  background: #5460c7;
  text-decoration: none;
}

.btn-overlay {
  background: rgba(255,255,255,0.9);
  color: #434fbf;
  border: 2px solid rgba(255,255,255,0.9);
  padding: 12px 30px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-overlay:hover {
  background: white;
  color: #434fbf;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Zusätzliche responsive Anpassungen */
@media (max-width: 1200px) {
  .content-boxes-grid {
    gap: 25px;
  }
  
  /* Standard-Grid (ohne spezifische Spalten-Klasse) */
  .content-boxes-grid:not([class*="content-boxes-cols-"]) {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .content-boxes-grid {
    gap: 20px;
  }

  .box-header-image {
    height: 160px;
  }

  .box-background-image {
    min-height: 250px;
    height: auto;
  }

  .box-overlay-content {
    padding: 30px 15px;
    max-width: 90%;
  }

  .box-overlay-content h3 {
    font-size: 1.5em;
  }

  .box-content {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .content-boxes {
    margin: 30px 0;
  }

  .content-boxes-grid {
    gap: 15px;
  }

  .box-background-image {
    min-height: 200px;
    height: auto;
  }

  .box-overlay-content {
    padding: 20px 10px;
  }

  .box-overlay-content h3 {
    font-size: 1.3em;
  }

  .box-content {
    padding: 15px;
  }
}

/* Spezielle Layouts für verschiedene Anzahl Boxen */
.content-boxes-grid:has(.content-box:nth-child(1):last-child) {
  /* 1 Box - zentriert, max-width */
  grid-template-columns: 1fr;
  max-width: 600px;
  margin: 30px auto;
}

.content-boxes-grid:has(.content-box:nth-child(2):last-child) {
  /* 2 Boxen - nebeneinander */
  grid-template-columns: repeat(2, 1fr);
}

.content-boxes-grid:has(.content-box:nth-child(3):last-child) {
  /* 3 Boxen - responsive Layout */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

@media (max-width: 768px) {
  .content-boxes-grid:has(.content-box:nth-child(2):last-child),
  .content-boxes-grid:has(.content-box:nth-child(3):last-child) {
    grid-template-columns: 1fr;
  }
}