/************************************************************
 * AquariumLesson – Save Bookmark Feature
 * - Bookmark-Button (Grid + Single + Modals)
 * - Grid-Overlay-Herz (oben rechts im Thumb)
 * - Saved-Cards Layout
 *
 * Bookmark = neuer Name
 * Heart    = Legacy-Alias (damit alter Code weiter läuft)
 ************************************************************/

/* ==========================================================
   1) Basis-Button (Pill-Style) – Single Lesson, Meta-Box, etc.
   ========================================================== */

/* Basis-Stil für Bookmark-Button (inkl. Legacy .al-heart-btn) */
.al-bookmark-btn,
.al-heart-btn {
  all: unset !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;

  padding: 8px 12px !important;
  border: 1px solid var(--al-border, #d8d8d8) !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: inherit !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.06) !important;
}

.al-bookmark-btn:hover,
.al-heart-btn:hover {
  background: #fafafa !important;
}

.al-bookmark-btn .al-ico,
.al-heart-btn .al-ico {
  width: 20px !important;
  height: 20px !important;
  display: inline-block !important;
}

.al-bookmark-btn svg,
.al-heart-btn svg {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
}

/* Standard: Outline-Icon, erst im Saved-State gefüllt */
.al-bookmark-btn .al-fillable,
.al-heart-btn .al-fillable {
  fill: transparent !important;
  transition: fill .2s ease !important;
}

/* Saved-State (aria-pressed oder .is-saved) */
.al-bookmark-btn[aria-pressed="true"] .al-fillable,
.al-heart-btn[aria-pressed="true"] .al-fillable,
.al-bookmark-btn.is-saved .al-fillable,
.al-heart-btn.is-saved .al-fillable {
  fill: #2C6B4A !important;   /* AL Brandgrün */
  stroke: #2C6B4A !important;
}

/* Kompakte Variante (ohne Text) – z.B. in Karten-Headern */
.al-bookmark-btn.-compact,
.al-heart-btn.-compact {
  padding: 6px !important;
  border-radius: 10px !important;
}

.al-bookmark-btn.-compact .al-label,
.al-heart-btn.-compact .al-label {
  display: none !important;
}

/* ==========================================================
   2) Platzierung – Single Lesson / Grid Cards / Modal Header
   ========================================================== */

/* Lesson Grid: Topline + Bookmark rechts */
.card-body .topline {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.card-body .topline .al-bookmark-wrap,
.card-body .topline .al-heart-wrap {
  margin-left: auto !important;
  display: flex !important;
}

/* Modale: wenn der Bookmark im Header sitzt */
.al-modal .al-bookmark-btn,
.modal .al-bookmark-btn,
.al-modal .al-heart-btn,
.modal .al-heart-btn {
  margin-left: 8px !important;
}

/* ==========================================================
   3) Grid-Overlay: Icon-Only oben rechts im Thumbnail
   ========================================================== */

/* Host-Elemente mit Bookmark (z.B. .card .thumb) */
.al-has-bookmark,
.al-has-heart {
  position: relative !important;
}

/* Overlay-Container oben rechts */
.al-bookmark-abs,
.al-heart-abs {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  z-index: 5 !important;
  pointer-events: auto !important;
}

/* Sicherheit: Thumb kann Bookmark tragen */
.card .thumb {
  position: relative !important;
}

/* Icon-only Button im Grid (große Hit-Area, kein sichtbarer Rahmen) */
.al-has-bookmark .al-bookmark-btn,
.al-has-heart .al-heart-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;

  width: 48px !important;
  height: 48px !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 9999px !important;
  line-height: 0 !important;
  cursor: pointer !important;
  transform: translateZ(0); /* schärferes SVG auf manchen GPUs */
}

/* Icon-Größe + Drop-Shadow für bessere Lesbarkeit */
.al-has-bookmark .al-bookmark-btn .al-ico,
.al-has-bookmark .al-bookmark-btn svg,
.al-has-heart .al-heart-btn .al-ico,
.al-has-heart .al-heart-btn svg {
  width: 24px !important;
  height: 24px !important;
  display: block !important;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.45));
}

/* Unsaved: weiße Kontur, transparente Füllung */
.al-has-bookmark .al-bookmark-btn .al-fillable,
.al-has-heart .al-heart-btn .al-fillable {
  fill: transparent !important;
  stroke: #fff !important;
  transition: fill .18s ease, transform .12s ease !important;
}

/* Saved im Grid: voll in Brandgrün */
.al-has-bookmark .al-bookmark-btn[aria-pressed="true"] .al-fillable,
.al-has-heart .al-heart-btn[aria-pressed="true"] .al-fillable,
.al-has-bookmark .al-bookmark-btn.is-saved .al-fillable,
.al-has-heart .al-heart-btn.is-saved .al-fillable {
  fill: #2C6B4A !important;
  stroke: #2C6B4A !important;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.35));
}

/* Tap-Feedback im Grid */
.al-has-bookmark .al-bookmark-btn:hover,
.al-has-heart .al-heart-btn:hover {
  transform: translateZ(0);
}

.al-has-bookmark .al-bookmark-btn:active,
.al-has-heart .al-heart-btn:active {
  transform: scale(.94);
}

/* Label im Grid immer verstecken (rein Icon) */
.al-has-bookmark .al-bookmark-btn .al-label,
.al-has-heart .al-heart-btn .al-label {
  display: none !important;
}

/* Herz-Overlay blockiert Klicks nur an dieser Stelle */
.al-lessons .card .thumb::after {
  pointer-events: none !important;
}

/* ==========================================================
   4) Toast / Teaser – „Saved“ Hinweis
   ========================================================== */

#al-toast-portal {
  position: fixed !important;
  inset: 0 !important;
  pointer-events: none !important;
  z-index: 2147483600 !important;
  isolation: isolate !important;
}

/* kleiner Teaser unten rechts (z.B. „Saved to your Library“) */
.al-teaser {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483646;
  pointer-events: auto;
}

.al-teaser .b.ghost {
  background: #fff;
  color: #2c6b4a;
  border-color: #2c6b4a;
}

/* Sentinel + Loading-Hinweis für Infinite Scroll */
.al-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
}

.al-loading-hint {
  font-size: 13px;
  color: #6b7280;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease;
}

/************************************************************
 * 5) Saved-Cards – Layout für gespeicherte Lessons & Presets
 ************************************************************/

/* Basis-Karte */
.al-saved-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--al-line, #E9EDF2);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(13,15,20,.06);
}

/* Kopfzeile (Titel + Badge + Bookmark) */
.al-saved-card .al-card-top {
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: space-between;
  margin-bottom: .4rem;
}

/* Titel (max. 2 Zeilen) */
.al-saved-card .al-card-top .al-title {
  margin-left: .25rem;
  margin-right: auto;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.6em;
}

/* kleine Badge (Lesson / Preset) */
.al-badge,
.al-type-badge {
  background: #eef0f2;
  color: #5c6673;
  border-radius: 9999px;
  padding: .15rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* kompaktes Bookmark oben rechts in der Saved-Card */
.al-saved-card .al-bookmark-btn.-compact,
.al-saved-card .al-heart-btn.-compact {
  flex: 0 0 auto;
}

/* Visual-Zone: Sparkline oder Thumb */
.al-saved-card .al-spark {
  height: 56px;
  margin: 6px 0 10px;
}

.al-saved-card .al-thumb-in-card,
.al-saved-card.is-lesson .al-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  background: #f4f6f5;
}

/* Für Lessons explizites 16:9-Format */
.al-saved-card.is-lesson .al-thumb {
  display: block;
  aspect-ratio: 16 / 9;
}

/* Meta-Grid (3 Spalten) */
.al-saved-card .al-meta3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .4rem .8rem;
  margin-bottom: 8px;
}

.al-saved-card .al-meta3 > div {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
}

.al-saved-card .al-meta3 .k {
  display: block;
  font-size: .85rem;
  color: #6b7a6e;
  white-space: nowrap;
}

.al-saved-card .al-meta3 .v {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Chips (z.B. NO3 / PO4 / K) */
.al-chips {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .35rem;
}

.al-chips span {
  padding: .15rem .45rem;
  border: 1px solid #e4ebe6;
  border-radius: 999px;
  font-size: .8rem;
  color: #2b3a34;
  background: #fff;
}

.al-chips .muted {
  opacity: .5;
}

/* Buttons unten */
.al-saved-card .al-actions-row {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
}

.al-btn-primary {
  min-width: 140px;
  height: 40px;
  border-radius: 999px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--al-accent, #1a7f49);
  color: #fff;
  border: none;
}

/* Ghost-Button */
.al-btn-ghost {
  background: #fff;
  border: 1px solid var(--al-line, #E9EDF2);
  padding: 8px 12px;
  border-radius: 10px;
}

/* Alte/Legacy-Pillen in den Saved-Cards sicher ausblenden */
.al-saved-card .preset,
.al-saved-card .al-pill,
.al-saved-card .badge-preset,
.al-saved-card.is-lesson .preset-pill,
.al-saved-card.is-lesson .legacy-heart {
  display: none !important;
}
/* === Bookmark auf Plant Cards =================================== */

/* Karte & Bild als Bezugspunkt */
.plant-card {
  position: relative;
}

.plant-card .plant-image-wrapper {
  position: relative;
}

/* Button oben rechts – Optik wie Saved-Grid (weiße Pill mit Schatten) */
.plant-card .plant-save-toggle {
  position: absolute !important;
  top: 10px !important;
  right: 12px !important;
  left: auto !important;
  z-index: 5 !important;

  width: 34px !important;
  height: 34px !important;
  border-radius: 999px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;
  border: 1px solid rgba(148, 163, 184, 0.7) !important; /* Slate-400-ish */
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.20) !important;
  cursor: pointer !important;
}

/* Icon-Größe im Button */
.plant-card .plant-save-toggle .al-ico,
.plant-card .plant-save-toggle svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
}

/* Standard: Outline dunkel, Füllung transparent */
.plant-card .plant-save-toggle .al-fillable {
  stroke: #0f172a !important;          /* Slate-900 */
  fill: transparent !important;
  transition:
    fill .18s ease,
    stroke .18s ease,
    transform .12s ease !important;
}

/* Saved-State: gefüllt in Brandgrün (wie auf Saved-Seiten) */
.plant-card .plant-save-toggle.is-saved .al-fillable,
.plant-card .plant-save-toggle[aria-pressed="true"] .al-fillable {
  stroke: #2C6B4A !important;
  fill: #2C6B4A !important;
}

/* Hover / Tap Feedback */
.plant-card .plant-save-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24) !important;
}

.plant-card .plant-save-toggle:active {
  transform: scale(.96);
}

/* Fokus-Ring dezent */
.plant-card .plant-save-toggle:focus-visible {
  outline: 0 !important;
  box-shadow:
    0 0 0 2px rgba(34, 197, 94, 0.45),
    0 4px 12px rgba(15, 23, 42, 0.20) !important;
}

/* ============================================
   Cleanup: Bookmark-Icon im Lessons-Grid
   (gleicher, crisprer Shadow wie Plant-Library)
   ============================================ */

.card.plant-card.lesson-card .plant-save-toggle {
  /* exakt wie in der Plant-Library */
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15) !important;

  border: none !important;
  outline: none !important;

  /* falls Elementor/Theme einen Drop-Shadow/Filter drauflegt -> killen */
  filter: none !important;
}

/* falls das SVG selbst noch einen Shadow/Filter bekommt */
.card.plant-card.lesson-card .plant-save-toggle svg {
  filter: none !important;
}

.lesson-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
}

.lesson-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: .9rem;
  line-height: 1.4;
}

.lesson-meta-label {
  font-weight: 600;
  color: #111827;
}

.lesson-meta-value {
  color: #4b5563;
}

.lesson-header .al-single-lesson-save .al-bookmark-btn {
  padding: .35rem .9rem;
  border-radius: 999px;
  background: #f3f4f6;
}

/* Meta-Zeile auf Single-Lesson: Save + Reading Time + Level in einer Row */

.lesson-content .lesson-meta-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Wrapper für den Save-Button in der Meta-Zeile */
.lesson-content .lesson-meta-box .al-bookmark-wrap {
  display: inline-flex;
}

/* Button selbst als Pill wie deine Badges */
.lesson-content .lesson-meta-box .al-bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 0.9rem;
}

/* Icon-Größe */
.lesson-content .lesson-meta-box .al-bookmark-btn .al-ico {
  width: 18px;
  height: 18px;
}

/* -----------------------------------------
   Lesson Single – Meta-Zeile: immer links
   ----------------------------------------- */

/* Desktop & Tablet: linksbündig */
.lesson-content .lesson-meta-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start !important;
  text-align: left !important;
}

/* Mobile: untereinander, aber ebenfalls linksbündig */
@media (max-width: 768px) {
  .lesson-content .lesson-meta-box {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .lesson-content .lesson-meta-box > * {
    align-self: flex-start;
  }
}

/* -----------------------------------------
   Lesson Single – Meta-Zeile: Layout
   ----------------------------------------- */

.lesson-content .lesson-meta-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start !important;
  text-align: left !important;
}

/* Mobile: Spalten-Layout + Elementor-Override */
@media (max-width: 767px) {
  .lesson-content .lesson-meta-box {
    flex-direction: column;
    align-items: flex-start !important;
  }

  /* 💥 Elementor-Kit zentriert alle Buttons -> hier explizit übersteuern */
  .lesson-content .lesson-meta-box .al-bookmark-wrap .al-bookmark-btn {
    display: inline-flex !important;
    margin-left: 0 !important;
    margin-right: auto !important; /* bleibt linksbündig */
    align-self: flex-start !important;
  }
}

/* -----------------------------------------
   Lesson Single – Meta-Zeile: immer links
   ----------------------------------------- */

.lesson-content .lesson-meta-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start;
  text-align: left;
}

/* Mobile: untereinander + Elementor-Override */
@media (max-width: 767px) {

  .lesson-content .lesson-meta-box {
    flex-direction: column;
    align-items: flex-start;
  }

  /* 🧨 Elementor-Kit überschreiben – Button nicht zentrieren */
  .elementor-kit-24888 .single-lesson .lesson-content .lesson-meta-box .al-bookmark-wrap .al-bookmark-btn {
    display: inline-flex !important;
    margin: 0 !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    align-self: flex-start !important;
  }

/* =========================================================
   Single Lesson – Meta-Leiste + Save-Button
   Mobile-first: alles linksbündig untereinander
   ========================================================= */

.lesson-content .lesson-meta-box {
  display: flex;
  flex-direction: column;   /* mobile: untereinander */
  gap: 0.6rem;
  align-items: flex-start;  /* linksbündig */
}

/* Wrapper um den Save-Button */
.lesson-content .lesson-meta-box .al-bookmark-wrap {
  display: flex;
  align-self: flex-start;
  margin: 0;                /* KEIN margin-left:auto mehr */
}

/* Button selbst – wie gewohnt */
.lesson-content .lesson-meta-box .al-bookmark-wrap .al-bookmark-btn {
  display: inline-flex;
  align-items: center;
}

/* ---------------------------------------------------------
   Desktop / Tablet (>= 768px):
   Meta-Items + Save-Button in einer Reihe,
   Save-Button nach rechts schieben
   --------------------------------------------------------- */
@media (min-width: 768px) {
  .lesson-content .lesson-meta-box {
    flex-direction: row;
    align-items: center;
  }

  .lesson-content .lesson-meta-box .al-bookmark-wrap {
    margin-left: auto;      /* nur Desktop: nach rechts */
  }
  
  
}
}

.skeleton-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  padding: 1rem 0;
}

.skeleton-card {
  height: 260px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    #e6e8eb 0%,
    #f2f3f5 35%,
    #e6e8eb 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ======================================================================
   SAVED / FAVORITES — Responsive Grid (Add-on, no markup changes)
   Targets: #alSavedGrid + .al-saved-card / .al-thumb / .is-preset
   ====================================================================== */

#alMemberArea #alSavedGrid{
  /* override baseline 1-col grid */
  grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
  row-gap: var(--al-4) !important;
  column-gap: var(--al-3) !important;
  align-items: stretch !important;
}

/* 2 columns */
@media (min-width: 860px){
  #alMemberArea #alSavedGrid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* 3 columns (fits your ~1120 content max nicely) */
@media (min-width: 1180px){
  #alMemberArea #alSavedGrid{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ---------- Cards inside grid (stabilisieren) ---------- */
#alMemberArea #alSavedGrid .al-saved-card{
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
}

/* Thumb: verhindert “riesige leere Fläche” */
#alMemberArea #alSavedGrid .al-saved-card .al-thumb{
  display: block !important;
  width: 100% !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  border: 1px solid color-mix(in srgb, var(--al-border) 80%, #fff) !important;
  background: var(--al-surface-2) !important;

  /* default: nice card preview size */
  aspect-ratio: 16 / 9 !important;
}

#alMemberArea #alSavedGrid .al-saved-card .al-thumb img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

/* ---------- Presets: dürfen breiter sein (Charts) ---------- */
@media (min-width: 860px){
  #alMemberArea #alSavedGrid .al-saved-card.is-preset{
    grid-column: span 2 !important;
  }
}

/* Preset thumbs: chart-typisch flacher */
#alMemberArea #alSavedGrid .al-saved-card.is-preset .al-thumb{
  aspect-ratio: 16 / 6 !important;
  background: #fff !important;
}

#alMemberArea #alSavedGrid .al-saved-card.is-preset .al-thumb img{
  object-fit: contain !important;
  background: #fff !important;
}

/* Optional: wenn du sehr große Chart-Images bekommst -> kappen */
#alMemberArea #alSavedGrid .al-saved-card.is-preset .al-thumb{
  max-height: 320px !important;
}

/* ---------- Plants: quadratischer wirkt cleaner ---------- */
#alMemberArea #alSavedGrid .al-saved-card.is-plant .al-thumb{
  aspect-ratio: 1 / 1 !important;
}

/* ✅ ensure SavedGrid is actually a grid */
#alMemberArea #alSavedGrid.al-grid{
  display: grid !important;
}

@media (min-width: 860px){
  html[data-saved-tab="presets"] #alMemberArea #alSavedGrid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html[data-saved-tab="presets"] #alMemberArea #alSavedGrid .al-saved-card.is-preset{
    grid-column: auto !important;
  }
}


