/* TookAndCook Recipe Sharing Styles */
/* Based on Vercel Design - Green Theme */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  color: #2D3748;
  background: #F7FAFC;
  line-height: 1.6;
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #F7FAFC;
  color: #2D3748;
}

.loader {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid #48BB78;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-container p {
  margin-top: 16px;
  font-size: 1.1rem;
  color: #4A5568;
}

/* Error State */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #F7FAFC;
  color: #2D3748;
  text-align: center;
  padding: 20px;
}

.error-container h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

.error-container p {
  font-size: 1rem;
  color: #718096;
  margin-bottom: 24px;
}

.btn-home {
  display: inline-block;
  padding: 12px 24px;
  background: #48BB78;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-home:hover {
  background: #38A169;
  transform: translateY(-2px);
}

/* Recipe Page */
.recipe-page {
  min-height: 100vh;
  background: #F7FAFC;
  padding: 24px;
}

/* Top Section */
.top-section {
  max-width: 1200px;
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 12px;
  align-items: center;
}

.top-section > .image-container,
.top-section > .info-container {
  grid-column: 1 / -1;
}

.top-section > a.btn-print {
  justify-self: start;
}

.top-section > button.btn-print {
  justify-self: end;
}

@media (min-width: 768px) {
  .top-section {
    grid-template-columns: 400px 1fr;
    column-gap: 20px;
    row-gap: 12px;
    align-items: start;
  }

  .top-section > .image-container,
  .top-section > .info-container {
    grid-column: auto;
  }
}

.image-container {
  border-radius: 16px;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  aspect-ratio: 4/3;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  background: #EDF2F7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-icon {
  font-size: 2rem;
  color: #A0AEC0;
}

/* Info Container */
.info-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.description-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.recipe-title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 700;
  color: #2D3748;
  line-height: 1.3;
}

.recipe-description {
  margin: 0;
  line-height: 1.6;
  color: #4A5568;
  font-size: 1rem;
}

/* Meta Grid */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.meta-item {
  background: white;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.meta-item .icon {
  font-size: 2rem;
  line-height: 1;
}

.meta-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #48BB78;
  line-height: 1;
}

.meta-label-inline {
  font-size: 0.95rem;
  color: #718096;
  line-height: 1;
}

/* Servings Control (Portionen anpassen) */
.servings-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.servings-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #48BB78;
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  line-height: 1;
}

.servings-btn:hover {
  background: #38A169;
  transform: scale(1.1);
}

.servings-btn:active {
  transform: scale(0.95);
}

.servings-btn:disabled {
  background: #CBD5E0;
  cursor: not-allowed;
  transform: none;
}

#servings-display {
  min-width: 24px;
  text-align: center;
}

/* Content Grid */
.content-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .content-grid {
    grid-template-columns: 400px 1fr;
  }
}

.left-col, .right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Tags: Desktop links, Mobile rechts */
.tags-desktop {
  display: block;
}

.tags-mobile {
  display: none;
}

@media (max-width: 899px) {
  .tags-desktop {
    display: none;
  }
  .tags-mobile {
    display: block;
  }
}

/* Section Cards */
.section-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-card h2 {
  margin: 0 0 20px;
  font-size: 1.5rem;
  font-weight: 600;
  color: #2D3748;
}

/* Ingredients */
.ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ingredient-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px;
  background: #F7FAFC;
  border-radius: 8px;
  border-left: 3px solid #48BB78;
}

.ingredient-name {
  flex: 1;
  color: #2D3748;
  font-size: 1rem;
}

.ingredient-amount {
  color: #48BB78;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: right;
  margin-left: 16px;
}

/* Steps */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #48BB78;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.step-text {
  flex: 1;
  margin: 0;
  line-height: 1.7;
  color: #4A5568;
  padding-top: 4px;
}

/* Tags */
.tags-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tags-card h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2D3748;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: #EDF2F7;
  color: #4A5568;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #E2E8F0;
}

/* App CTA Footer */
.app-cta {
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 32px;
  text-align: center;
  background: linear-gradient(135deg, #48BB78 0%, #38A169 100%);
  border-radius: 16px;
  color: white;
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.app-cta h3 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  font-weight: 700;
}

.app-cta p {
  margin: 0 0 24px;
  font-size: 1rem;
  opacity: 0.95;
}

.cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 600px;
  margin: 0 auto;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  flex: 1;
  min-width: 180px;
  justify-content: center;
}

.cta-btn-primary {
  background: white;
  color: #48BB78;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cta-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cta-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 2px solid white;
}

.cta-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 1.2rem;
}

.empty-state {
  color: #A0AEC0;
  font-style: italic;
  margin: 0;
}

/* Action Bar: Drucken / PDF (nur am Bildschirm) */
.recipe-actions {
  max-width: 1200px;
  margin: 0 auto 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

a.btn-print {
  text-decoration: none;
  color: white;
}

.btn-print {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #48BB78;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
  transition: all 0.2s;
}

.btn-print:hover {
  background: #38A169;
  transform: translateY(-2px);
}

/* Mobile Optimizations */
@media (max-width: 600px) {
  .recipe-page {
    padding: 16px;
  }
  
  .meta-grid {
    grid-template-columns: 1fr;
  }
  
  .section-card {
    padding: 20px;
  }
}

/* ════════════════════════════════════════════════════════════
   DRUCK / PDF-EXPORT (window.print → Drucker oder „Als PDF speichern")
   Rein additiv – verändert die Bildschirmdarstellung NICHT.
   ════════════════════════════════════════════════════════════ */
@media print {
  body {
    background: #fff;
    color: #2D3748;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .recipe-page {
    background: #fff;
    padding: 0;
    min-height: 0;
  }

  /* Nicht-druckbare Elemente ausblenden */
  .no-print,
  .recipe-actions,
  .app-cta,
  .loading-container,
  .error-container,
  .servings-control button {
    display: none !important;
  }

  /* Karten-Optik entfernen (Schatten/Rundung/Hintergrund kosten Tinte) */
  .description-card,
  .section-card,
  .meta-item,
  .tags-card,
  .image-container {
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #fff !important;
    padding: 0 !important;
  }

  /* Kopfbereich: Bild links, Titel+Beschreibung+Meta rechts daneben */
  .top-section {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 16px !important;
    max-width: 100% !important;
    margin: 0 0 12px !important;
  }

  .top-section .image-container {
    width: 55mm;
    flex-shrink: 0;
  }

  .info-container {
    flex: 1;
    gap: 10px;
  }

  /* Inhalt (Zutaten/Zubereitung) einspaltig untereinander */
  .content-grid {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    gap: 0 !important;
  }

  .left-col,
  .right-col {
    gap: 12px;
  }

  /* Bild kompakt halten */
  .image-container {
    aspect-ratio: auto;
    margin-bottom: 0;
  }

  .image-container img {
    width: 100%;
    max-width: 100%;
    max-height: 50mm;
    height: auto;
    object-fit: contain;
  }

  /* Typografie im HP-Grün-Theme */
  .recipe-title { color: #2D3748 !important; font-size: 22pt; margin-bottom: 6px; }
  .recipe-description { color: #4A5568 !important; font-size: 11pt; }
  .meta-value { color: #48BB78 !important; }
  .meta-label-inline { color: #718096 !important; }

  /* Grüne Trennlinie unter dem Kopfbereich (Bild/Titel/Meta) */
  .top-section {
    border-bottom: 2px solid #48BB78;
    padding-bottom: 10px !important;
  }

  /* Abschnitts-Abstände + grün unterstrichene Überschriften */
  .section-card { margin-bottom: 16px !important; }
  .section-card h2 {
    color: #2D3748 !important;
    font-size: 14pt;
    margin-bottom: 10px !important;
    padding-bottom: 5px;
    border-bottom: 2px solid #48BB78;
  }

  .meta-grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 0;
  }

  /* Zutaten: zweispaltig, im grünen App-Look */
  .ingredients-list {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px !important;
  }
  .ingredient-row {
    background: #F7FAFC !important;
    border: none !important;
    border-left: 3px solid #48BB78 !important;
    border-radius: 6px !important;
    padding: 6px 8px !important;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ingredient-name { color: #2D3748 !important; }
  .ingredient-amount { color: #48BB78 !important; }

  /* Schritte: Nummer als umrandeter Kreis (druckt zuverlässig ohne Farbfüllung) */
  .steps-list { gap: 12px !important; }
  .step-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .step-number {
    background: #48BB78 !important;
    color: #fff !important;
    border: none;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .step-text { color: #4A5568 !important; padding-top: 3px; }

  /* Tags im App-Look */
  .tag {
    background: #EDF2F7 !important;
    color: #4A5568 !important;
    border: 1px solid #E2E8F0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    margin: 12mm;
  }
}

