/* ===================================================
   LEARNENG THEME BOOKLETS — HERO & SHELF STYLES
   =================================================== */

/* --- HERO CARD (PRINTABLES EXPLORER) --- */
.theme-booklet-hero-card {
  background: linear-gradient(135deg, #092c3e 0%, #0d5c75 55%, #0f766e 100%);
  color: #ffffff;
  border-radius: 18px;
  padding: 22px 26px;
  margin: 0 0 24px 0;
  box-shadow: 0 10px 28px rgba(9, 44, 62, 0.22);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
}
.theme-booklet-hero-card::after {
  content: "📚";
  position: absolute;
  right: -15px;
  bottom: -25px;
  font-size: 130px;
  opacity: 0.07;
  pointer-events: none;
}
.tb-hero-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.tb-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef08a;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  width: fit-content;
}
.tb-hero-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}
.tb-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0;
}
.tb-hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #e2e8f0;
}
.tb-hero-stat b { color: #ffffff; }
.tb-hero-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
}
.tb-hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.btn-download-theme-booklet {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn-download-theme-booklet:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.55);
  filter: brightness(1.08);
}
.tb-btn-badge {
  background: #fef08a;
  color: #78350f;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.tb-hero-hint {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 768px) {
  .theme-booklet-hero-card {
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
  }
  .tb-hero-right {
    align-items: stretch;
  }
  .btn-download-theme-booklet {
    justify-content: center;
  }
  .tb-hero-hint {
    justify-content: center;
  }
}

/* --- THEME BOOKLETS SHELF VIEW --- */
.tb-shelf-container {
  padding: 0 0 50px 0;
}
.tb-shelf-hero {
  background: linear-gradient(135deg, #092c3e 0%, #0d5c75 60%, #0f766e 100%);
  color: white;
  border-radius: 20px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(9,44,62,0.18);
  position: relative;
  overflow: hidden;
}
.tb-shelf-hero::after {
  content: "📚";
  position: absolute;
  right: 15px;
  bottom: -20px;
  font-size: 120px;
  opacity: 0.08;
  pointer-events: none;
}
.tb-shelf-hero h2 {
  margin: 0 0 6px 0;
  font-size: 26px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.5px;
}
.tb-shelf-hero p {
  margin: 0 0 14px 0;
  font-size: 14px;
  color: #cbd5e1;
  max-width: 780px;
  line-height: 1.5;
}
.tb-shelf-plus-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(254, 240, 138, 0.15);
  border: 1px solid rgba(254, 240, 138, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fef08a;
}
.tb-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 22px;
  scrollbar-width: thin;
}
.tb-filter-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tb-filter-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.tb-filter-pill.active {
  background: #092c3e;
  border-color: #092c3e;
  color: #ffffff;
}
.tb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
}
.tb-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tb-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}
.tb-card-cover {
  background: linear-gradient(135deg, #092c3e 0%, #0d5c75 60%, #0f766e 100%);
  color: white;
  padding: 24px 20px;
  min-height: 135px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.tb-card-cover::after {
  content: "📖";
  position: absolute;
  right: -8px;
  bottom: -15px;
  font-size: 84px;
  opacity: 0.12;
}
.tb-card-grade-tag {
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tb-card-theme-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin: 6px 0 0 0;
  line-height: 1.3;
}
.tb-card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}
.tb-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tb-card-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}
.tb-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-card-download {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white !important;
  border: none;
  border-radius: 10px;
  padding: 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: filter 0.15s;
  text-decoration: none;
}
.btn-card-download:hover { filter: brightness(1.1); }
.btn-card-browse {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.btn-card-browse:hover { background: #e2e8f0; color: #1e293b; }

/* --- GATE / UPGRADE MODAL --- */
.tb-gate-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.78);
  backdrop-filter: blur(8px);
  z-index: 9999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-family: inherit;
}
.tb-gate-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.tb-gate-modal-card {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.3);
  overflow: hidden;
  text-align: center;
  position: relative;
  animation: tbModalPop 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes tbModalPop {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.tb-gate-modal-head {
  background: linear-gradient(135deg, #092c3e, #0f766e);
  color: white;
  padding: 24px 24px 20px 24px;
  position: relative;
}
.tb-gate-modal-head .tb-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tb-gate-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #1e293b;
}
.tb-gate-features {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tb-gate-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
}
.tb-gate-feature-item i {
  color: #10b981;
  font-size: 16px;
}

/* ===================================================
   THEME BOOKLET ACCORDION BANNER (PRINTABLES BROWSER)
   =================================================== */
.tb-accordion-banner {
  background: linear-gradient(135deg, #092c3e 0%, #0d5c75 50%, #0f766e 100%);
  color: #ffffff;
  border-radius: 14px;
  margin: 0 0 22px 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 20px rgba(9, 44, 62, 0.16);
  overflow: hidden;
  transition: all 0.25s ease;
  font-family: inherit;
}
.tb-accordion-banner:hover {
  box-shadow: 0 8px 26px rgba(9, 44, 62, 0.24);
  border-color: rgba(255, 255, 255, 0.3);
}
.tb-banner-bar {
  padding: 13px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
  user-select: none;
}
.tb-banner-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.tb-banner-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}
.tb-banner-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.tb-banner-headline {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}
.tb-banner-summary {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .tb-accordion-banner {
    width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
  }
  .tb-banner-bar {
    padding: 13px 12px;
    align-items: flex-start;
    gap: 8px;
  }
  .tb-banner-bar-left {
    align-items: flex-start;
    gap: 9px;
  }
  .tb-banner-icon {
    font-size: 21px;
    padding-top: 2px;
  }
  .tb-banner-text {
    width: 100%;
  }
  .tb-banner-headline {
    font-size: 13.5px;
    line-height: 1.35;
  }
  .tb-banner-summary {
    white-space: normal;
    font-size: 11.5px;
    line-height: 1.5;
    text-align: justify;
    text-justify: inter-word;
    overflow-wrap: anywhere;
  }
  .tb-banner-bar-right {
    gap: 5px;
    padding-top: 1px;
  }
  .tb-accordion-banner.is-open .tb-banner-content {
    max-height: 900px;
    padding: 7px 12px 14px;
  }
  .tb-banner-content,
  .tb-banner-desc {
    text-align: justify;
    text-justify: inter-word;
  }
  .tb-banner-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .tb-banner-stat-chip {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    line-height: 1.3;
  }
  .tb-banner-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tb-action-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    white-space: normal;
  }
}
@media (max-width: 430px) {
  .tb-banner-stats {
    grid-template-columns: 1fr;
  }
  .tb-badge-plus {
    padding-inline: 5px;
  }
}
.tb-banner-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tb-badge-plus {
  background: #fef08a;
  color: #78350f;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.tb-toggle-arrow {
  font-size: 18px;
  color: #e2e8f0;
  transition: transform 0.25s ease;
  display: flex;
  align-items: center;
}
.tb-accordion-banner.is-open .tb-toggle-arrow {
  transform: rotate(180deg);
}
.tb-banner-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.25s ease;
  padding: 0 18px;
  text-align: left;
}
.tb-accordion-banner.is-open .tb-banner-content {
  max-height: 500px;
  opacity: 1;
  padding: 6px 18px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.tb-banner-desc {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.45;
  margin: 8px 0 12px 0;
}
.tb-banner-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tb-banner-stat-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: #f1f5f9;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tb-banner-stat-chip b { color: #ffffff; }
.tb-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.tb-action-btn {
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}
.tb-action-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.tb-action-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.tb-action-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.tb-action-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}
.tb-action-btn-download {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.tb-action-btn-download:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ===================================================
   FLOATING IN-APP DOWNLOAD PROGRESS TOAST
   =================================================== */
.tb-download-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 350px;
  max-width: calc(100vw - 32px);
  background: #0f172a;
  color: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 16px 18px;
  z-index: 9999999 !important;
  font-family: inherit;
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.tb-download-toast.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.tb-toast-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tb-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.tb-download-toast.completed .tb-toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.tb-download-toast.error .tb-toast-icon {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.tb-toast-info {
  flex: 1;
  min-width: 0;
}
.tb-toast-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.2;
}
.tb-toast-sub {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.tb-toast-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.tb-toast-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.tb-toast-progress-wrap {
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 7px;
}
.tb-toast-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.tb-download-toast.completed .tb-toast-progress-bar {
  background: #10b981;
}
.tb-download-toast.error .tb-toast-progress-bar {
  background: #ef4444;
}
.tb-toast-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}
.tb-toast-footer span i {
  margin-right: 4px;
}
@media (max-width: 640px) {
  .tb-download-toast {
    right: 14px;
    left: 14px;
    bottom: 16px;
    width: auto;
  }
}
