/* =========================================================
   Film Recipe Base — global stylesheet
   Loaded automatically by Dash from app/assets/styles.css
   ========================================================= */

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.25rem;
}

.navbar-brand-icon {
  height: 1.15em;
  width: auto;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.navbar-nav {
  gap: 0.75rem;
}

/* sticky-top is applied in shell.py; keep navbar above page content */
.navbar.sticky-top {
  z-index: 1030;
}

/* ─── Page container top-padding handled in shell.py (pt-2) ─ */

/* ─── Footer ─────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell > .container-fluid {
  flex: 1 0 auto;
}

.app-footer {
  flex-shrink: 0;
  margin-top: auto;
  background-color: #212529;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
  padding: 1rem 0;
}

.app-footer-inner {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.app-footer-brand {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.app-footer-version {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0;
}

.app-footer-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.app-footer-link:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.card-subtitle {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ─── Stat / KPI cards ───────────────────────────────────── */
.stat-card .card-body {
  padding: 1.1rem 1.25rem;
  height: 100%;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #212529;
}

/* ─── Loading spinner minimum height ────────────────────── */
/* Prevents cards from collapsing to 0-height before the first
   callback fires. Set to something taller than the spinner itself. */
.chart-loading {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Sidebar — sticky on desktop ───────────────────────── */
/*
 * Sticky is on the column (not the card) so the containing block is the
 * tall Explore row. Sticky on .sidebar-card alone failed because
 * #sidebar-collapse was only as tall as the filters themselves.
 */
.sidebar-card {
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

@media (min-width: 768px) {
  .explore-sidebar-col {
    position: sticky;
    /* Clear the sticky navbar (~56px) plus a small gap */
    top: 4.25rem;
    align-self: flex-start;
    /* md=3 is 25%; ×0.8 → 20% sidebar / 80% main */
    flex: 0 0 20% !important;
    width: 20%;
    max-width: 20%;
  }

  .explore-main-col {
    flex: 0 0 80% !important;
    width: 80%;
    max-width: 80%;
  }
}

/* Suppress sticky / max-height on mobile where the sidebar collapses. */
@media (max-width: 767.98px) {
  .sidebar-card {
    max-height: none;
    overflow-y: visible;
  }
}

/* ─── Collapsible sidebar on mobile ─────────────────────── */
/*
 * The sidebar Collapse (id="sidebar-collapse") starts with is_open=False so
 * it's hidden on xs/sm.  On md+ we force it visible via !important to
 * override the inline height:0/overflow:hidden that dbc.Collapse applies.
 */
@media (min-width: 768px) {
  #sidebar-collapse {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* ─── Explore — Section A header row (A1 : stats : tabs = 5:2:3) ─ */
@media (min-width: 992px) {
  .explore-section-a-a1-col {
    flex: 5 1 0 !important;
    width: 50%;
    max-width: 50%;
  }

  .explore-section-a-stats-col {
    flex: 2 1 0 !important;
    width: 20%;
    max-width: 20%;
  }

  .explore-section-a-tabs-col {
    flex: 3 1 0 !important;
    width: 30%;
    max-width: 30%;
  }
}

.explore-section-a-stats .stat-card .card-body {
  padding: 0.75rem 0.5rem;
}

.explore-section-a-stats .card-subtitle {
  font-size: 0.7rem;
}

.explore-section-a-stats .stat-card-value {
  font-size: 1.5rem;
}

/* ─── Genre Finder — F2 + secondary tabs side-by-side ───── */
/* 2:3 width ratio (F2 : F1/F5 card) on desktop; stack on smaller screens. */
@media (min-width: 992px) {
  .genre-finder-f2-col {
    flex: 2 1 0 !important;
    width: 40%;
    max-width: 40%;
  }

  .genre-finder-secondary-col {
    flex: 3 1 0 !important;
    width: 60%;
    max-width: 60%;
  }
}

/* ─── Genre pills (Genre Finder page) ───────────────────── */
.genre-pill {
  border-radius: 1.5rem !important;
  padding: 0.3rem 0.9rem !important;
  font-size: 0.85rem;
  margin: 0.2rem 0.4rem 0.2rem 0 !important;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.genre-pill:last-child {
  margin-right: 0 !important;
}

.genre-pill.active {
  font-weight: 600;
}

/* ─── Cluster chips (Discover page) ─────────────────────── */
.cluster-chip {
  border-radius: 1.5rem !important;
  padding: 0.3rem 0.85rem !important;
  font-size: 0.82rem;
  margin: 0.2rem 0.4rem 0.2rem 0 !important;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.cluster-chip:last-child {
  margin-right: 0 !important;
}

.cluster-chip.active {
  font-weight: 600;
}

/* ─── Empty-state banner ─────────────────────────────────── */
/* Sits between the navbar and the page container; flush edges. */
.empty-state-banner-alert {
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  margin-bottom: 0 !important;
}

/* ─── Similar-recipe cards (Recipe Profile) ─────────────── */
[id*="similar-recipe-card"] .card {
  cursor: pointer;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

[id*="similar-recipe-card"]:hover .card {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15) !important;
}

/* ─── Tabs ───────────────────────────────────────────────── */
.nav-tabs .nav-link {
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
}

/* ─── Hint alerts ────────────────────────────────────────── */
.alert-light {
  background-color: #f8f9fa;
  border-color: #e9ecef;
  color: #6c757d;
  font-size: 0.85rem;
}

/* Vertically centre the dismiss icon with single-line (py-2) hint text.
 * Bootstrap defaults .btn-close to top:0, which sits above the text when
 * the alert is only one line tall. */
.alert-dismissible.alert-light .btn-close {
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem 1rem;
}

/* ─── Responsive tablet tweaks ───────────────────────────── */
/*
 * At tablet width (md) the main container gets tighter; reduce horizontal
 * padding slightly so chart cards don't become cramped.
 */
@media (min-width: 768px) and (max-width: 991.98px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* ─── Filter sidebar label sizes ─────────────────────────── */
.sidebar-card .fw-semibold.small {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6c757d;
}

/* ─── Dropdown multi-select clear-all-values spacing ────── */
.Select-clear-zone {
  padding: 0 4px;
}

/* ─── Look Space — Clear selection (match dropdown height) ─ */
.btn.btn-clear-b1-selection {
  min-height: 34px;
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  line-height: 1.2;
  background-color: rgba(220, 53, 69, 0.1) !important;
  border: 1px solid rgba(220, 53, 69, 0.28) !important;
  color: #a71d2a !important;
  box-shadow: none !important;
}

.btn.btn-clear-b1-selection:hover,
.btn.btn-clear-b1-selection:focus,
.btn.btn-clear-b1-selection:focus-visible {
  background-color: rgba(220, 53, 69, 0.18) !important;
  border-color: rgba(220, 53, 69, 0.45) !important;
  color: #842029 !important;
}

.btn.btn-clear-b1-selection:active {
  background-color: rgba(220, 53, 69, 0.26) !important;
  border-color: rgba(220, 53, 69, 0.55) !important;
  color: #842029 !important;
}

/* ─── Recipe Profile settings table ─────────────────────── */
.table-sm td,
.table-sm th {
  font-size: 0.85rem;
}

/* ─── Explore — Explorer recipe table ───────────────────── */
.explorer-recipe-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.explorer-recipe-link:hover {
  color: var(--bs-primary, #0d6efd);
}

/* Genre radar card matches Camera Settings card height */
.recipe-genre-card {
  width: 100%;
}

/* ─── Help page ──────────────────────────────────────────── */
.help-page {
  padding-bottom: 3rem;
}

.help-page-blurb h5 {
  font-size: 1.05rem;
}

.help-feature-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #212529;
}

.help-feature-item {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.help-feature-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.help-feature-accordion .accordion-button {
  font-size: 0.95rem;
  font-weight: 600;
}

.help-feature-accordion .accordion-body {
  padding-top: 1rem;
}

/* ─── Scrollbar polish (webkit) ──────────────────────────── */
.sidebar-card::-webkit-scrollbar {
  width: 4px;
}

.sidebar-card::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}

.sidebar-card::-webkit-scrollbar-track {
  background: transparent;
}
