/* ==========================================================================
   Semplicità & Gusto - Inspired Styling & Theme Engine
   ========================================================================== */

:root {
  /* Brand Palette (Pizza Artisan Theme) */
  --primary: #1B8F58;
  --primary-hover: #156B43;
  --primary-light: rgba(27, 143, 88, 0.12);
  --accent: #F5A623;
  --accent-light: rgba(245, 166, 35, 0.15);
  
  /* Light Theme Colors */
  --bg-main: #F4F7F5;
  --bg-card: #FFFFFF;
  --bg-card-sub: #F2F6F4;
  --text-main: #1C2822;
  --text-muted: #55625A;
  --text-light: #6E7A72;
  --border-color: #DFE6E1;
  --border-highlight: #1B8F58;
  --shadow-sm: 0 2px 8px rgba(26, 20, 18, 0.05);
  --shadow-md: 0 8px 24px rgba(26, 20, 18, 0.08);
  --shadow-lg: 0 16px 32px rgba(27, 143, 88, 0.12);

  /* Font Families */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

html.dark {
  /* Dark Theme Colors (stile Cucinosano: nero + verde #38B87C) */
  --primary: #38B87C;
  --primary-hover: #5ACB94;
  --primary-light: rgba(56, 184, 124, 0.14);
  --bg-main: #101413;
  --bg-card: #181D1B;
  --bg-card-sub: #1F2523;
  --text-main: #E3E8E5;
  --text-muted: #9BA8A1;
  --text-light: #79857F;
  --border-color: #2A3330;
  --border-highlight: #38B87C;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.5);
}

/* Tema "Chiaro morbido": carta e verde oliva, senza nero.
   Testi scuri caldi invece che neri: riposa gli occhi e resta leggibile. */
html.chiaro-morbido {
  --primary: #4F6B2F;
  --primary-hover: #3F5726;
  --primary-light: rgba(79, 107, 47, 0.14);
  --accent: #B26B14;
  --accent-light: rgba(178, 107, 20, 0.15);

  --bg-main: #F7F4EC;
  --bg-card: #FFFDF7;
  --bg-card-sub: #F1ECE0;
  --text-main: #3A3A2E;
  --text-muted: #63614F;
  --text-light: #6A6856;
  --border-color: #E2DAC9;
  --border-highlight: #4F6B2F;
  --shadow-sm: 0 2px 8px rgba(74, 64, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(74, 64, 40, 0.09);
  --shadow-lg: 0 16px 32px rgba(79, 107, 47, 0.12);
}

/* Reset & Global Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   Header & Header Actions
   -------------------------------------------------------------------------- */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.logo-text h1 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-pro {
  font-size: 0.75rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #FFF;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.icon-btn {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.icon-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Navigation Tabs
   -------------------------------------------------------------------------- */
.nav-tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 0.75rem 1.5rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 99px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-sub);
}

.nav-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(31, 157, 98, 0.3);
}

/* --------------------------------------------------------------------------
   Main Content & Tab Pages
   -------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Cards & Layout Components
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.inner-card {
  background: var(--bg-card-sub);
  margin-top: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2, .card-header h3 {
  font-size: 1.25rem;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, #10231A, #1E6B45);
  color: #FFFFFF;
  border-radius: 20px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: "🍕";
  position: absolute;
  right: -10px;
  bottom: -20px;
  font-size: 8rem;
  opacity: 0.08;
  pointer-events: none;
}

.hero-text h2 {
  color: #FFFFFF;
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.hero-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.recipe-file-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFF;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
}

.file-upload-label:hover {
  background: rgba(255, 255, 255, 0.25);
}

.hidden-input {
  display: none;
}

/* --------------------------------------------------------------------------
   Forms & Controls
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.form-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.form-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .form-grid-3col, .form-grid-2col {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.temp-section-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  padding: 1.2rem;
  border-radius: 12px;
  margin-top: 0.5rem;
}

.temp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.temp-section-header h4 {
  font-size: 0.95rem;
  color: var(--primary);
  margin: 0;
}

.mode-toggle {
  display: flex;
  gap: 0.8rem;
}

.radio-inline {
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.radio-inline input {
  accent-color: var(--primary);
}

.multi-temp-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.multi-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-card-sub);
  border-radius: 8px;
}

.multi-step-tag {
  font-weight: 700;
  color: var(--text-main);
}

.inline-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.inline-group input {
  width: 60px;
  text-align: center;
  padding: 0.35rem;
}

.fermentation-progress-bar-wrapper {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.6rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.maturation-badge {
  background: #27ae60;
  color: #FFF;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

.progress-bar-bg {
  height: 10px;
  background: var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60, var(--accent));
  transition: width 0.3s ease;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-with-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.num-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 38px;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.num-btn:hover {
  background: var(--primary);
  color: #FFF;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-group input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.slider-group input[type="number"] {
  width: 75px;
  text-align: center;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.checkbox-group-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(31, 157, 98, 0.3);
}

.btn-secondary {
  background: var(--bg-main);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   Results Stats & Tables & Water Temp Card
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
}

.stat-box.primary {
  border-color: var(--primary);
  background: var(--primary-light);
}

.stat-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0.2rem 0;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Water Temp Card */
.water-temp-card {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(41, 128, 185, 0.15));
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1rem;
}

@media (max-width: 600px) {
  .water-temp-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.water-temp-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.water-icon {
  font-size: 1.5rem;
}

.temp-val {
  color: #2980b9;
  font-weight: 800;
}

html.dark .temp-val {
  color: #5DADE2;
}

.water-temp-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.phase-results-box {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.phase-tag {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.4rem 0.8rem;
  letter-spacing: 0.5px;
}

.biga-tag {
  background: rgba(245, 166, 35, 0.2);
  color: #D47A00;
}

html.dark .biga-tag {
  color: var(--accent);
}

.rinfresco-tag {
  background: var(--primary-light);
  color: var(--primary);
}

.res-table-wrapper {
  overflow-x: auto;
}

.res-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.res-table th, .res-table td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.res-table th {
  background: var(--bg-card-sub);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.res-table tr:last-child td {
  border-bottom: none;
}

.highlight-row {
  background: var(--bg-card-sub);
}

.flour-name-cell {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Pizza Recipes Showcase
   -------------------------------------------------------------------------- */
.recipes-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.search-input-wrapper input {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
}

.category-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.cat-pill {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cat-pill:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.cat-pill.active {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
}

.recipes-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.5rem;
}

.pizza-recipe-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pizza-recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.pizza-card-image-box {
  height: 180px;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #1A1412;
}

.pizza-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pizza-cat-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(26, 20, 18, 0.8);
  color: #FFF;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
}

.pizza-card-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex: 1;
}

.pizza-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.pizza-card-title-row h4 {
  font-size: 1.15rem;
  margin: 0;
}

.recipe-yield-badge {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.35rem;
  display: inline-block;
  background: var(--bg-card-subtle);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.pizza-card-actions {
  display: flex;
  gap: 0.3rem;
}

.recipe-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.recipe-ingredients-text {
  font-size: 0.88rem;
  color: var(--text-main);
  background: var(--bg-card);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  line-height: 1.4;
}

.recipe-prep-text {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
  white-space: pre-line;
}

.pizza-card-footer {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.dough-spec-pill {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   Flour Cards Grid & Usage Tags High-Visibility Engine
   -------------------------------------------------------------------------- */
.flour-filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.flour-filter-pill {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.flour-filter-pill:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.flour-filter-pill.active {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
}

.flours-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.flour-item-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.flour-item-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.flour-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.flour-card-header h4 {
  font-size: 1.05rem;
}

.flour-card-actions {
  display: flex;
  gap: 0.3rem;
}

.btn-icon-sm {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
  border-radius: 4px;
}

.btn-icon-sm:hover {
  background: var(--border-color);
}

.flour-type-badge {
  display: inline-block;
  background: var(--accent-light);
  color: #B86B00;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

html.dark .flour-type-badge {
  color: var(--accent);
}

.flour-specs {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* High-Visibility Biga / Rinfresco Badges */
.flour-usage-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.usage-tag {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.usage-tag.biga {
  background: #FFF3E0;
  color: #D35400;
  border: 1.5px solid #F39C12;
}

html.dark .usage-tag.biga {
  background: rgba(50, 190, 120, 0.18);
  color: #5ACB94;
  border-color: #38B87C;
}

.usage-tag.rinfresco {
  background: #FCE4D6;
  color: #C0392B;
  border: 1.5px solid #E85A1A;
}

html.dark .usage-tag.rinfresco {
  background: rgba(245, 166, 35, 0.18);
  color: #F5A623;
  border-color: #F5A623;
}

.flour-notes-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.add-flour-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.add-flour-section h3 {
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   Timeline / Schedule & Interactive Step Controls
   -------------------------------------------------------------------------- */
.schedule-controls-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
}

.direction-toggle-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.schedule-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.schedule-info-banner {
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.83rem;
  color: var(--text-main);
}

.info-icon {
  font-size: 1.2rem;
}

.timeline-container {
  position: relative;
  padding-left: 2rem;
}

.timeline-container::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--border-color);
  border-radius: 3px;
}

.timeline-step {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-step::before {
  content: "📍";
  position: absolute;
  left: -2rem;
  top: 0;
  width: 22px;
  height: 22px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
}

.timeline-step.active-step::before {
  content: "🔥";
  border-color: var(--primary);
}

.timeline-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-time {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--primary);
  font-size: 0.95rem;
}

.timeline-shift-btns {
  display: flex;
  gap: 0.3rem;
}

.shift-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.shift-btn:hover {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
}

.timeline-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0.1rem 0;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Step Guides (Biga & Rinfresco tabs)
   -------------------------------------------------------------------------- */
.phase-guide-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.guide-step {
  display: flex;
  gap: 1rem;
  background: var(--bg-card-sub);
  padding: 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.step-num {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--primary);
  color: #FFF;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-body h4 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.step-body p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ingredient-bullet-list {
  margin-top: 0.5rem;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

.ingredient-bullet-list li {
  margin-bottom: 0.2rem;
}

/* --------------------------------------------------------------------------
   Journal Cards
   -------------------------------------------------------------------------- */
.journal-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.journal-card-item {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.journal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.journal-date {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

/* --------------------------------------------------------------------------
   Method Toggle Bar for Bread & Pizza Master Guides
   -------------------------------------------------------------------------- */
.method-toggle-bar {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.btn-method {
  flex: 1;
  min-width: 220px;
  padding: 0.85rem 1.2rem;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-method:hover {
  border-color: var(--primary);
  background: var(--bg-card-subtle);
}

.btn-method.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 157, 98, 0.3);
}

/* --------------------------------------------------------------------------
   Step Photo Gallery & Responsive Thumbnails
   -------------------------------------------------------------------------- */
.step-image-gallery {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.step-img-thumb {
  width: 240px;
  height: 180px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: zoom-in;
}

.step-img-thumb:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(31, 157, 98, 0.3);
}

@media (max-width: 600px) {
  .step-img-thumb {
    width: 100%;
    max-width: 320px;
    height: 210px;
  }
}

/* --------------------------------------------------------------------------
   Lightbox Modal for Full-Size Photo View
   -------------------------------------------------------------------------- */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.lightbox-content {
  position: relative;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: #FFFFFF;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.lightbox-close:hover {
  color: var(--primary);
}

.lightbox-caption {
  color: #FFFFFF;
  margin-top: 0.8rem;
  font-size: 1rem;
  text-align: center;
  font-weight: 500;
}



/* Recipe Card Timing Summary & Collapsible Styles */
.recipe-timing-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.6rem 0;
}

.recipe-timing-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.recipe-timing-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.recipe-timing-pill.highlight {
  background: rgba(27, 143, 88, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.recipe-collapsible-wrapper {
  transition: all 0.3s ease-in-out;
}

.recipe-timing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.recipe-total-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Modern Clean Recipe Card Styles */
.recipe-quick-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.spec-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.spec-yield {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.spec-hydr {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.spec-time {
  background: #f4f4f5;
  color: #3f3f46;
  border: 1px solid #e4e4e7;
}

.recipe-card-block {
  margin-top: 0.6rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}

.block-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.ingredients-content {
  font-size: 0.83rem;
  color: var(--text-main);
  line-height: 1.45;
}

.timing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.8rem;
}

.timing-item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.83rem;
  color: var(--text-main);
  white-space: normal;
  min-width: 0;
  overflow-wrap: anywhere;
}

.timing-item.cottura {
  color: var(--primary);
  font-weight: 700;
}

.timing-name {
  color: var(--text-muted);
}

.timing-item.cottura .timing-name {
  color: var(--primary);
}

.timing-val {
  font-weight: 600;
}

.nutrition-strip {
  margin-top: 0.5rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.prep-expanded-block {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-color);
}

.card-footer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-color);
}

.card-footer-buttons button {
  white-space: nowrap;
  padding: 0.4rem 0.2rem;
  font-size: 0.8rem;
}

/* Interactive Ingredient Checklist for Recipe Guides */
.ingredient-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border-color);
}

.ingredient-checklist-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.ingredient-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.55rem 0.8rem;
}

.ingredient-check-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ingredient-check-item:hover {
  border-color: var(--primary);
  background: var(--bg-card-subtle);
}

.ingredient-check-item input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.ingredient-check-item.checked {
  background: #f0fdf4;
  border-color: #a7f3d0;
  color: #166534;
  text-decoration: line-through;
  opacity: 0.75;
}

.ingredient-check-item.checked input[type="checkbox"] {
  accent-color: #166534;
}


/* Ingredient Checkbox Styles */
.ing-check {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--primary, #E85A1A);
  flex-shrink: 0;
}
.ingredient-row:has(.ing-check:checked) {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: var(--primary, #E85A1A);
  text-decoration-thickness: 2px;
}
.ingredient-row:has(.ing-check:checked) td strong {
  color: var(--muted-foreground, #888);
}
.res-table th:first-child {
  width: 40px;
  text-align: center;
}
.ing-check {
  display: block;
  margin: 0 auto;
}


/* ============================================================
   INGREDIENTI RAGGRUPPATI PER COMPONENTE (frolla / ripieno ...)
   ============================================================ */
.ing-group {
  margin-bottom: 1rem;
  padding-left: 0.7rem;
  border-left: 3px solid var(--primary);
}
.ing-group:last-child { margin-bottom: 0; }
.ing-group-title {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #5ACB94);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
  box-shadow: 0 1px 3px rgba(31, 157, 98, 0.28);
}
.ing-compact-group { margin-bottom: 0.4rem; }
.ing-compact-group:last-child { margin-bottom: 0; }
.ing-chip {
  display: inline-block;
  background: rgba(27, 143, 88, 0.12);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  margin-right: 0.35rem;
}
.ing-compact-items { line-height: 1.5; }
.ing-qty { font-weight: 800; }
.ingredient-label-text .ing-qty { color: var(--primary); }


/* ============================================================
   VISTA COMPATTA: anteprima scheda + espansione al tocco
   ============================================================ */
.card-details { display: none; }
.pizza-recipe-card.expanded .card-details { display: block; }
.pizza-recipe-card:not(.expanded) .pizza-card-actions { display: none; }
.pizza-recipe-card.expanded { box-shadow: var(--shadow-md, 0 6px 20px rgba(0,0,0,0.12)); }
.pizza-card-image-box.clickable,
.pizza-card-title-row.clickable { cursor: pointer; }

.btn-expand {
  width: 100%;
  margin-top: 0.7rem;
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border-color);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-expand:hover { background: rgba(31, 157, 98, 0.08); border-color: var(--primary); }

@media (max-width: 600px) {
  .recipes-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }
  .pizza-card-image-box { height: 118px; }
  .pizza-card-body { padding: 0.6rem 0.65rem; }
  .pizza-recipe-card h4 { font-size: 0.92rem !important; }
  .recipe-quick-specs { gap: 0.25rem; }
  .spec-pill { font-size: 0.68rem; padding: 0.15rem 0.42rem; }
  .pizza-recipe-card:not(.expanded) .recipe-quick-specs .spec-hydr { display: none; }
  .pizza-recipe-card.expanded { grid-column: 1 / -1; }
  .btn-expand { font-size: 0.74rem; padding: 0.45rem 0.3rem; }
  /* su schermo stretto i tempi vanno a una colonna: altrimenti le etichette si spezzano */
  .pizza-recipe-card .timing-grid { grid-template-columns: 1fr; gap: 0.3rem; }
  .pizza-recipe-card .timing-name { font-size: 0.82rem; }
}


/* ============================================================
   TEMA SCURO: spunte e righe spuntate (verde su nero)
   ============================================================ */
html.dark .checked {
  background: rgba(56, 184, 124, 0.14);
  border-color: #2C5540;
  color: #7FE3B0;
}
html.dark .ingredient-row:has(.ing-check:checked) {
  background: rgba(50, 190, 120, 0.10);
}
html.dark .ingredient-check-item.checked {
  background: rgba(56, 184, 124, 0.14);
  border-color: #2C5540;
  color: #7FE3B0;
}


/* checkbox coerenti col tema */
input[type="checkbox"] {
  accent-color: var(--primary);
}


/* ============================================================
   RICETTARIO A ELENCO VERTICALE
   foto a sinistra, nome + dosi/tempo a destra, dettagli sotto
   ============================================================ */
.recipes-cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 0.7rem;
}
.pizza-recipe-card {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  padding: 7px;
  gap: 11px;
}
.pizza-card-image-box {
  width: 66px;
  flex: 0 0 66px;
  height: 66px !important;
  border-radius: 12px;
}
.pizza-card-image-box .pizza-card-img { width: 100%; height: 100%; object-fit: cover; }
.pizza-cat-tag {
  font-size: 0.5rem;
  padding: 0.08rem 0.3rem;
  left: 3px;
  bottom: 3px;
  /* senza questo resta anche "top: 10px" della regola base: con top E bottom
     insieme l'etichetta si allunga fra i due bordi del contenitore e diventa
     una fascia su tutto (sfocata, perché ha il backdrop-filter). */
  top: auto;
}
.pizza-card-body {
  flex: 1 1 60%;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  padding: 0;
}
.pizza-card-title-row { flex: 1 1 0; min-width: 0; margin: 0; }
.pizza-recipe-card h4 { font-size: 1rem !important; margin-bottom: 0.3rem !important; }
.card-details { flex-basis: 100%; width: 100%; }
.pizza-recipe-card .btn-expand {
  flex: 0 0 auto;
  width: auto;
  margin: 0 0 0 auto;
  padding: 0.38rem 0.7rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .pizza-recipe-card.expanded { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .recipes-cards-grid { grid-template-columns: 1fr; }
  .pizza-card-image-box { width: 58px; flex-basis: 58px; height: 58px !important; }
  /* in anteprima su telefono: solo dosi e tempo, righe piu' compatte */
  .pizza-recipe-card h4 { font-size: 0.95rem !important; line-height: 1.25 !important; }
  .pizza-recipe-card .recipe-quick-specs { margin-top: 0.2rem; }
  .pizza-recipe-card .spec-pill { font-size: 0.66rem; padding: 0.12rem 0.4rem; }
}


/* pillole dosi/idratazione/tempo leggibili su fondo scuro */
html.dark .spec-hydr {
  background: rgba(56, 184, 124, 0.14);
  color: #5ACB94;
  border-color: rgba(50, 190, 120, 0.32);
}
html.dark .spec-time {
  background: rgba(255, 255, 255, 0.07);
  color: #D9DCDA;
  border-color: rgba(255, 255, 255, 0.14);
}
/* nell'elenco la miniatura è piccola: l'etichetta categoria non ci sta */
.pizza-recipe-card .pizza-cat-tag { display: none; }


/* rifiniture elenco: righe compatte */
.pizza-recipe-card .recipe-quick-specs { margin-top: 0.25rem; }
@media (max-width: 600px) {
  .pizza-recipe-card { padding: 6px; gap: 9px; }
  .pizza-recipe-card h4 { font-size: 0.92rem !important; }
  .pizza-recipe-card .btn-expand { padding: 0.3rem 0.55rem; font-size: 0.7rem; }
}


/* titolo al massimo 2 righe nell'elenco */
.pizza-recipe-card h4 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================================
   BARRA DI NAVIGAZIONE IN BASSO (solo smartphone)
   ============================================================ */
.bottom-nav { display: none; }

@media (max-width: 820px) {
  body { padding-bottom: 74px; }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 200;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.28);
  }
  .bottom-nav-btn {
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-family: var(--font-body);
    font-size: 0.63rem;
    font-weight: 700;
    color: var(--text-light);
    padding: 4px 2px;
    border-radius: 10px;
    transition: all 0.18s ease;
  }
  .bottom-nav-btn span { font-size: 1.2rem; line-height: 1; }
  .bottom-nav-btn.active {
    color: var(--primary);
    background: var(--primary-light);
  }
}


/* ============================================================
   LISTA DELLA SPESA
   ============================================================ */
.shop-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.shop-summary { font-size: 0.88rem; color: var(--text-light); margin: 0.2rem 0 1rem; }
.shop-summary b { color: var(--primary); }

.shop-empty {
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1.7;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
}
.shop-empty span { font-size: 0.85rem; }

.shop-group {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.9rem;
  background: var(--bg-card);
}
.shop-group-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.shop-group-title {
  flex: 1;
  font-weight: 800;
  font-size: 1rem;
  color: var(--primary);
}
.shop-group-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--primary-light);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
}
.shop-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.75;
  padding: 0.2rem 0.3rem;
}
.shop-del:hover { opacity: 1; }

.shop-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}
.shop-item:last-child { border-bottom: none; }
.shop-item:hover { background: var(--primary-light); }
.shop-item input { width: 19px; height: 19px; margin-top: 1px; accent-color: var(--primary); flex: 0 0 auto; cursor: pointer; }
.shop-item span { flex: 1; }
.shop-item.done span { text-decoration: line-through; opacity: 0.5; }

/* avviso a comparsa */
#app-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 12px);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--primary);
  border-radius: 30px;
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 400;
  max-width: 90vw;
  text-align: center;
}
#app-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Lista della spesa: pulsanti su una riga, sotto il titolo, quando lo schermo è piccolo */
@media (max-width: 700px) {
  #shopping-tab .card-header { flex-wrap: wrap; }
  #shopping-tab .shop-actions {
    flex: 1 0 100%;
    margin-top: 0.7rem;
    gap: 0.5rem;
  }
  #shopping-tab .shop-actions .btn-outline {
    flex: 1;
    padding: 0.5rem 0.4rem;
    font-size: 0.82rem;
  }
}


/* ============================================================
   I MIEI RICETTARI (raccolte di ricette)
   ============================================================ */
.collection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 1rem 0 0.4rem;
  flex-wrap: wrap;
}
.collection-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-light);
}
.collection-manage { font-size: 0.78rem; padding: 0.3rem 0.6rem; }
.collection-pills { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.col-pill b { font-weight: 800; opacity: 0.75; margin-left: 0.15rem; }
.col-new { border-style: dashed !important; }

.col-pick-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s ease;
}
.col-pick-row:hover { background: var(--primary-light); }
.col-pick-row input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.col-pick-row span { flex: 1; font-weight: 600; }
.col-pick-row em { font-style: normal; font-size: 0.78rem; color: var(--text-light); }

.col-pick-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

.col-mgr-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 0.5rem;
}
.col-mgr-name { flex: 1; font-weight: 700; }
.col-mgr-name em { display: block; font-style: normal; font-size: 0.76rem; font-weight: 500; color: var(--text-light); }
.col-mgr-actions { display: flex; gap: 0.2rem; }

@media (max-width: 700px) {
  .collection-bar { margin-top: 0.9rem; }
  .collection-pills { gap: 0.4rem; }
  .col-pill { font-size: 0.78rem; padding: 0.35rem 0.6rem; }
}


/* ============================================================
   SICUREZZA iOS / WebKit — nessun allargamento orizzontale
   (su iPhone una striscia scorrevole senza min-width:0 faceva
   allargare tutta la pagina: contenuti tagliati a destra e
   finestre spostate)
   ============================================================ */
html, body { max-width: 100%; }
body { overflow-x: hidden; }
/* 'clip' non crea un contenitore di scorrimento: l'intestazione sticky continua a funzionare */
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

.app-header, .header-container, .main-content, main, .tab-page,
.card, .card-header, .recipes-filter-bar, .collection-bar, .pizza-card-body {
  min-width: 0;
  max-width: 100%;
}

.nav-tabs, .category-pills, .collection-pills {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

img, video, iframe, canvas, table { max-width: 100%; }

.lightbox-overlay { width: 100%; height: 100%; }
.modal-card-box { max-width: 92vw !important; overflow-x: hidden; }
#recipe-guide-modal-content {
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: anywhere;
}
/* le tabelle delle guide (miscele, dosi) non devono allargare la finestra */
#recipe-guide-modal-content table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
}
#recipe-guide-modal-content th,
#recipe-guide-modal-content td {
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 0.35rem 0.45rem;
  font-size: 0.82rem;
}
#recipe-guide-modal-content pre,
#recipe-guide-modal-content code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* schede dei passi: il testo non deve comprimersi né uscire */
.guide-step { max-width: 100%; }
.step-body { flex: 1; min-width: 0; }
.step-body h4, .step-body p, .step-body li { overflow-wrap: anywhere; }
.step-image-gallery { max-width: 100%; }
.step-img-thumb { max-width: 100%; height: auto; }

/* Finestre su smartphone: più spazio utile, meno cornice */
@media (max-width: 600px) {
  .modal-card-box {
    padding: 1.1rem 0.9rem 1.4rem !important;
    max-height: 94vh !important;
    border-radius: 14px !important;
  }
  .modal-card-box .lightbox-close { top: 4px !important; right: 12px !important; }
}

/* ============================================================
   iOS/WebKit: via i backdrop-filter (su iPhone il velo sfocato
   si ridisegnava SOPRA il contenuto delle finestre, tagliandolo)
   ============================================================ */
.lightbox-overlay {
  top: 0; left: 0; right: 0; bottom: 0;
  width: auto;
  height: auto;
  background: rgba(0, 0, 0, 0.88);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.app-header {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ============================================================
   FINESTRE SU SMARTPHONE: foglio a tutto schermo che scorre
   (niente scorrimento interno: è più comodo e su iOS/WebKit
   evita che il contenuto venga disegnato fuori posto)
   ============================================================ */
@media (max-width: 700px) {
  #recipe-guide-modal,
  #collection-modal {
    align-items: flex-start !important;
    justify-content: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0.6rem !important;
  }
  #recipe-guide-modal .modal-card-box,
  #collection-modal .modal-card-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    margin: auto 0;
  }
}

/* ============================================================
   GUIDA COME PAGINA INTERA (smartphone)
   ============================================================ */
#guide-inline-page {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.8rem 0.9rem 2.5rem;
}
.guide-inline-close {
  position: sticky;
  top: 6px;
  z-index: 5;
  margin-bottom: 0.7rem;
  background: var(--bg-card);
}
.guide-inline-card {
  padding: 1rem 1.1rem 1.4rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  #guide-inline-page { padding: 0.6rem 0.7rem 2.2rem; }
  .guide-inline-card { padding: 0.9rem 0.85rem 1.3rem; }
  .guide-inline-card table { width: 100% !important; table-layout: fixed; }
  .guide-inline-card th, .guide-inline-card td { overflow-wrap: anywhere; word-break: break-word; font-size: 0.82rem; padding: 0.35rem 0.4rem; }
  .guide-inline-card img { max-width: 100%; height: auto; }
  .guide-inline-card .step-img-thumb { width: 100%; height: auto; }
}

/* Su smartphone i filtri vanno a capo: nessuna pillola mozzata a destra */
@media (max-width: 700px) {
  .category-pills {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 0.45rem;
  }
  .category-pills .cat-pill,
  .collection-pills .cat-pill {
    font-size: 0.74rem;
    padding: 0.32rem 0.55rem;
    border-radius: 18px;
  }
  .recipes-filter-bar { gap: 0.6rem; }
}


/* ============================================================
   PAGINA INIZIALE (Home)
   ============================================================ */
.home-hero { margin-bottom: 0.9rem; }
.home-hero h2 { margin-bottom: 0.5rem; }
.home-hero p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.65; }
.home-hero .home-sub { font-size: 0.86rem; margin-top: 0.5rem; color: var(--text-light); }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}
.home-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--text-main);
  transition: all 0.18s ease;
}
.home-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}
.home-ico { font-size: 1.5rem; line-height: 1.2; flex: 0 0 auto; }
.home-txt { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.home-txt b { font-family: var(--font-heading); font-size: 0.98rem; }
.home-txt em { font-style: normal; font-size: 0.82rem; color: var(--text-light); }
.home-tips h3 { margin-bottom: 0.5rem; font-size: 1.05rem; }
.home-tips p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 0.4rem; }

/* ============================================================
   TELEFONO: la fila di tab in alto è superflua (c'è la barra in
   basso) → via, e più spazio alle ricette
   ============================================================ */
@media (max-width: 820px) {
  .nav-tabs { display: none !important; }
  .app-header .header-container { padding-bottom: 0.9rem; }
  .recipes-head .subtitle { display: none; }
  .recipes-head h2 { font-size: 1.08rem; margin: 0; }
  .recipes-head { align-items: center; }
  .recipes-head #btn-add-recipe {
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .bottom-nav-btn { font-size: 0.56rem; gap: 2px; padding: 3px 1px; }
  .bottom-nav-btn span { font-size: 1.05rem; }
  #home-tab .card, #recipes-tab .card { padding: 0.9rem 0.85rem; }
  .home-grid { grid-template-columns: 1fr; gap: 0.55rem; }
}


/* ============================================================
   "+" accanto a ogni ingrediente (lista della spesa)
   ============================================================ */
.ing-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card-sub);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  margin-left: 0.35rem;
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.15s ease;
}
.ing-add:hover { border-color: var(--primary); background: var(--primary-light); }
.ing-add.on { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }
.ingredient-check-item .ing-add { margin-left: auto; }
.ing-item { display: inline-flex; align-items: center; }
.ing-sep { color: var(--text-light); margin: 0 0.15rem; }


/* ============================================================
   HOME SU TELEFONO: voci a tutta larghezza, stile menu nativo
   (niente riquadri rientrati: si prende tutto lo schermo)
   ============================================================ */
@media (max-width: 820px) {
  #home-tab .home-grid {
    gap: 0;
    margin-bottom: 0.9rem;
  }
  #home-tab .home-card,
  #home-tab .home-tips {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 1.1rem;
    position: relative;
  }
  #home-tab .home-card:first-child { border-top: 1px solid var(--border-color); }
  #home-tab .home-card:hover { transform: none; }
  #home-tab .home-card::after {
    content: '›';
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.8;
  }
  #home-tab .home-ico { font-size: 1.35rem; }
  #home-tab .home-txt { padding-right: 1.3rem; }
  #home-tab .home-tips {
    margin-top: 0.2rem;
    border-top: 1px solid var(--border-color);
  }
  #home-tab .home-tips h3 { margin-bottom: 0.35rem; }
}

/* Su telefono il sottotitolo dell'intestazione sparisce: il nome basta e si guadagna spazio */
@media (max-width: 820px) {
  .app-header .subtitle { display: none; }
  .app-header .header-container { padding-bottom: 0.75rem; }
}

/* ============================================================
   Immagine di apertura della Home
   ============================================================ */
.home-banner {
  display: block;
  width: 100%;
  height: 185px;
  object-fit: cover;
  object-position: center 45%;
  border-radius: 14px;
  margin: 0 0 0.85rem;
}
@media (max-width: 820px) {
  #home-tab .home-banner {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    border-radius: 0;
    height: 200px;
    margin-bottom: 0;
  }
}

/* ============================================================
   Filtri ripiegati nella pagina Ricette (una riga sola)
   ============================================================ */
.filtri-fold { margin-bottom: 0.7rem; }
.filtri-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}
.filtri-summary::-webkit-details-marker { display: none; }
.filtri-title { font-weight: 600; }
.filtri-attivi {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filtri-chevron { color: var(--text-muted); transition: transform 0.2s; font-size: 0.9rem; }
.filtri-fold[open] .filtri-chevron { transform: rotate(180deg); }
.filtri-fold[open] .filtri-summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.filtri-contenuto { padding: 0.7rem 0.2rem 0.1rem; }

/* ============================================================
   SCHEDA RICETTA APERTA SU TELEFONO:
   foto a tutta larghezza SOPRA il titolo (niente sovrapposizioni)
   ============================================================ */
@media (max-width: 820px) {
  .pizza-recipe-card.expanded {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
    /* tutta la larghezza del display, bordo a bordo */
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .pizza-recipe-card.expanded .pizza-card-image-box {
    width: 100%;
    max-width: none;
    flex: none;
    height: 195px !important;
    border-radius: 0;
  }
  .pizza-recipe-card.expanded .pizza-card-img { width: 100%; height: 100%; object-fit: cover; }
  .pizza-recipe-card.expanded .pizza-cat-tag { display: inline-block; }
  /* Nella scheda aperta il corpo torna in colonna: da riga, il titolo troncato a
     2 righe (line-clamp) viene misurato come una riga sola da WebKit e le pillole
     gli finiscono sopra. Vale anche per le azioni e per le pillole: tutta larghezza. */
  .pizza-recipe-card.expanded .pizza-card-body {
    flex-direction: column;
    align-items: stretch;
    flex: none;
    width: 100%;
    padding: 0.8rem 0.9rem 0;
  }
  .pizza-recipe-card.expanded .pizza-card-title-row { flex: none; width: 100%; }
  .pizza-recipe-card.expanded .recipe-quick-specs { width: 100%; margin-top: 0.45rem; }
  .pizza-recipe-card.expanded h4 {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
  }
  .pizza-recipe-card.expanded .btn-expand { margin: 0.6rem 0.9rem 0; }
  .pizza-recipe-card.expanded .card-details {
    flex-basis: auto;
    width: 100%;
    padding: 0.55rem 0.9rem 0.95rem;
  }
  .pizza-recipe-card.expanded .pizza-card-actions { display: flex !important; }

}

/* ============================================================
   INGREDIENTI NELLA SCHEDA APERTA SU TELEFONO:
   un ingrediente per riga, dose allineata, ＋ a destra
   ============================================================ */
@media (max-width: 820px) {
  .pizza-recipe-card.expanded .ingredients-content .ing-item,
  .guide-inline-card .ingredients-content .ing-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.34rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
    font-size: 0.9rem;
    line-height: 1.3;
  }
  .ingredients-content .ing-sep { display: none; }
  .ingredients-content .ing-item .ing-qty { flex: 0 0 auto; min-width: 3.2rem; }
  .ingredients-content .ing-item .shop-add-btn,
  .ingredients-content .ing-item .ing-add-btn,
  .ingredients-content .ing-item button { margin-left: auto; flex: 0 0 auto; }
  .ingredients-content .ing-compact-group { display: block; width: 100%; }
}

/* ============================================================
   GUIDA = PAGINA FISSA A TUTTO SCHERMO (a qualsiasi larghezza)
   La regola di base la centrava con margin:0 auto + max-width:900px:
   su un telefono largo 393px finiva spostata a destra e tagliata a metà.
   ============================================================ */
#guide-inline-page {
  position: fixed;
  inset: 0;
  z-index: 900;
  margin: 0;
  max-width: none;
  width: 100%;
  background: var(--bg-main);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.6rem 0.7rem 2.4rem;
}
#guide-inline-page {
  transform: translateZ(0);   /* livello grafico dedicato: su iOS non resta il disegno vecchio */
  will-change: transform;
}
#guide-inline-page .guide-inline-card {
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}
#guide-inline-page .guide-inline-close {
  max-width: 860px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   Apertura della Home: due righe che presentano l'app (senza riquadro)
   ============================================================ */
.home-intro {
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.home-intro b { color: var(--text-main); font-weight: 700; display: block; margin-bottom: 0.15rem; }
@media (max-width: 820px) {
  #home-tab .home-intro {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    padding: 0.85rem 1.1rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
  }
}

/* ============================================================
   PULSANTE MENU (☰) E PANNELLO IMPOSTAZIONI
   ============================================================ */
#menu-btn {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
}
#settings-page {
  position: fixed;
  inset: 0;
  z-index: 950;
  margin: 0;
  max-width: none;
  width: 100%;
  background: var(--bg-main);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
  padding: 0.7rem 0.85rem 2.4rem;
}
.set-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  max-width: 760px;
  margin: 0 auto 0.8rem;
}
.set-title { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
.set-wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.75rem; }
.set-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.95rem 1rem 1.05rem;
}
.set-block h3 { margin: 0 0 0.35rem; font-size: 1rem; color: var(--text-main); }
.set-hint { margin: 0 0 0.75rem; font-size: 0.85rem; line-height: 1.45; color: var(--text-muted); }
.set-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.set-row .btn-primary, .set-row .btn-secondary { flex: 1 1 auto; }
.set-theme.active { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.set-danger { border-color: #c0563a; color: #e07a5f; }
.set-link { display: inline-block; text-decoration: none; text-align: center; }

/* ============================================================
   PAGINA RICETTE SENZA IL RIQUADRO CONTENITORE:
   titolo, ricerca e filtri poggiano direttamente sulla pagina
   ============================================================ */
#recipes-tab > .card {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}
#recipes-tab > .card .card-header.recipes-head {
  padding: 0 0.15rem 0.2rem;
  border-bottom: none;
}

/* ============================================================
   RIFINITURE GRAFICHE PAGINA RICETTE
   ============================================================ */
/* titolo su una riga su telefono, per esteso su desktop */
.only-mobile { display: inline; }
.only-desktop { display: none; }
@media (min-width: 821px) {
  .only-mobile { display: none; }
  .only-desktop { display: inline; }
}
/* meno vuoto tra i filtri e le ricette */
#recipes-tab .filtri-fold { margin-bottom: 0.55rem; }
#recipes-tab #pizza-recipes-grid { margin-top: 0; }
#recipes-tab .recipes-filter-bar { margin-bottom: 0.35rem; }
/* card un filo più morbide e pulsante Dettagli allineato */
#recipes-tab .pizza-recipe-card { border-radius: 14px; }
#recipes-tab .btn-expand {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

/* ============================================================
   SCELTE RAPIDE "HO VOGLIA DI..." (pagina Ricette)
   ============================================================ */
.voglia-bar { margin: 0 0 0.55rem; }
.voglia-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.45rem 0.15rem;
}
.voglia-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.voglia-chip {
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.voglia-chip:hover { border-color: var(--primary); }
.voglia-chips.mood .voglia-chip {
  border-color: rgba(50, 190, 120, 0.45);
  color: var(--primary);
  background: rgba(50, 190, 120, 0.08);
}
.voglia-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #08251A;
  font-weight: 800;
}

/* ============================================================
   PULSANTI CON CONTORNO: il colore del testo non si eredita,
   "✕ Chiudi guida" restava nero su fondo nero.
   ============================================================ */
.btn-outline {
  color: var(--text-main);
  border: 1px solid var(--border-color);
  background: transparent;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.guide-inline-close {
  color: var(--text-main);
  border-color: var(--border-color);
  background: var(--bg-card);
}
#settings-page .set-top .btn-outline { color: var(--text-main); }

/* ============================================================
   SCHEDA RICETTA APERTA SU TELEFONO: flusso normale, niente flex.
   Con flex WebKit misurava male il titolo e ci disegnava sopra le
   pillole; qui ogni pezzo è un blocco e non può sovrapporsi.
   ============================================================ */
@media (max-width: 820px) {
  /* La scheda aperta prende tutta la larghezza NON con 100vw (che sporgeva di
     24 px a sinistra e spostava tutto il contenuto), ma togliendo il margine
     interno della pagina finché è aperta: così resta dentro i suoi bordi. */
  body.scheda-aperta .main-content,
  body.scheda-aperta #pizza-recipes-grid {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .pizza-recipe-card.expanded {
    display: block !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }
  .pizza-recipe-card.expanded .pizza-card-image-box {
    /* deve restare "relative": l'etichetta categoria è posizionata in assoluto
       dentro la foto. Con static si ancorava alla scheda intera e si stirava
       da cima a fondo, diventando la fascia grigia trasparente sopra al testo. */
    position: relative !important;
    width: 100% !important;
    height: 195px !important;
    border-radius: 0 !important;
  }
  /* l'etichetta resta in un angolo della foto, senza allungarsi */
  .pizza-recipe-card.expanded .pizza-cat-tag {
    top: auto !important;
    bottom: 8px !important;
    left: 8px !important;
    display: inline-block !important;
  }
  .pizza-recipe-card.expanded .pizza-card-body,
  .pizza-recipe-card.expanded .pizza-card-title-row,
  .pizza-recipe-card.expanded .recipe-quick-specs {
    display: block !important;
    width: auto !important;
    flex: none !important;
  }
  .pizza-recipe-card.expanded .pizza-card-body { padding: 0.8rem 0.9rem 0 !important; }
  .pizza-recipe-card.expanded h4 {
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
    margin-bottom: 0.5rem !important;
  }
  .pizza-recipe-card.expanded .btn-expand { margin: 0.5rem 0.9rem 0 !important; }
  .pizza-recipe-card.expanded .card-details { display: block !important; padding: 0.6rem 0.9rem 0.95rem !important; }
}


/* Nella guida l'etichetta è un'intestazione, non una scritta sulla foto: se resta
   in posizione assoluta si aggancia alla pagina della guida (che è fissa) e si stira
   su tutto, sfocando con il suo backdrop-filter il testo che ci sta sotto. */
#guide-inline-page .pizza-cat-tag,
.guide-inline-card .pizza-cat-tag {
  position: static !important;
  display: inline-block !important;
  margin-bottom: 0.6rem;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}


/* --------------------------------------------------------------------------
   Tabella delle dosi (Calcolatore al grammo): sul telefono era più larga
   dello schermo e la colonna "Dettagli / Farina / Temp." veniva tagliata a
   metà parola. Colonne proporzionate, testo che va a capo, niente scorrimento.
   -------------------------------------------------------------------------- */
.res-table { table-layout: fixed; }
.res-table th, .res-table td { overflow-wrap: anywhere; word-break: break-word; }
.res-table th:first-child, .res-table td:first-child { width: 34px; padding-left: 0.45rem; padding-right: 0.2rem; }
.res-table th:nth-child(2), .res-table td:nth-child(2) { width: 30%; }
.res-table th:nth-child(3), .res-table td:nth-child(3) { width: 21%; white-space: nowrap; }
.res-table td:nth-child(4), .res-table th:nth-child(4) { font-size: 0.8rem; line-height: 1.35; }

@media (max-width: 480px) {
  .res-table { font-size: 0.78rem; }
  .res-table th, .res-table td { padding: 0.42rem 0.38rem; }
  .res-table th:nth-child(2), .res-table td:nth-child(2) { width: 32%; }
  .res-table th:nth-child(3), .res-table td:nth-child(3) { width: 19%; }
  .res-table td:nth-child(4) { font-size: 0.73rem; }
  .res-table th { font-size: 0.66rem; letter-spacing: 0.2px; }
}


/* --------------------------------------------------------------------------
   Rifiniture Calcolatore (telefono):
   - le intestazioni "Quantità" e "Dettagli" erano attaccate: serve aria tra le
     colonne, che con table-layout: fixed va messa come padding;
   - i cinque valori nutrizionali stavano a tutta larghezza (minmax 130px non
     lasciava spazio a due colonne) e costringevano a scorrere: ENERGIA a tutta
     riga, gli altri quattro in due colonne.
   -------------------------------------------------------------------------- */
.res-table th:nth-child(3), .res-table td:nth-child(3) { padding-right: 0.7rem; }
.res-table th:nth-child(4), .res-table td:nth-child(4) { padding-left: 0.55rem; }

@media (max-width: 480px) {
  .nutri-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.55rem !important; }
  .nutri-grid > div { padding: 0.6rem 0.45rem !important; }
  .nutri-grid > div:first-child { grid-column: 1 / -1; }
  .nutri-grid strong { font-size: 1.12rem !important; }
  .nutri-grid span { font-size: 0.68rem !important; letter-spacing: 0.2px; }
}

/* --------------------------------------------------------------------------
   Tabelle dentro le GUIDE (metodi Autolisi / Biga / Pieghe): usano la stessa
   classe .res-table del Calcolatore, dove la prima colonna è la spunta da 34px
   e l'ultima è piccola. Nelle guide la prima colonna è testo ("Fase Cottura",
   "Fase 1 (Sviluppo)") e a 34px andava a capo lettera per lettera. Qui le
   larghezze vengono rimesse proporzionate al contenuto della guida.
   -------------------------------------------------------------------------- */
.phase-guide-content .res-table, .guide-step .res-table { table-layout: fixed; font-size: 0.82rem; }
.phase-guide-content .res-table th, .phase-guide-content .res-table td,
.guide-step .res-table th, .guide-step .res-table td { width: auto; font-size: inherit; padding: 0.5rem 0.55rem; overflow-wrap: anywhere; white-space: normal; }
.phase-guide-content .res-table th:first-child, .phase-guide-content .res-table td:first-child,
.guide-step .res-table th:first-child, .guide-step .res-table td:first-child { width: 24%; padding: 0.5rem 0.55rem; }
.phase-guide-content .res-table th:nth-child(2), .phase-guide-content .res-table td:nth-child(2),
.guide-step .res-table th:nth-child(2), .guide-step .res-table td:nth-child(2) { width: 22%; }
.phase-guide-content .res-table th:nth-child(3), .phase-guide-content .res-table td:nth-child(3),
.guide-step .res-table th:nth-child(3), .guide-step .res-table td:nth-child(3) { width: 18%; white-space: normal; }
.phase-guide-content .res-table th:nth-child(4), .phase-guide-content .res-table td:nth-child(4),
.guide-step .res-table th:nth-child(4), .guide-step .res-table td:nth-child(4) { width: 36%; font-size: inherit; }

@media (max-width: 480px) {
  .phase-guide-content .res-table, .guide-step .res-table { font-size: 0.76rem; }
  .phase-guide-content .res-table th, .phase-guide-content .res-table td,
.guide-step .res-table th, .guide-step .res-table td { padding: 0.4rem 0.35rem; }
  .phase-guide-content .res-table th:first-child, .phase-guide-content .res-table td:first-child,
.guide-step .res-table th:first-child, .guide-step .res-table td:first-child { width: 27%; }
  .phase-guide-content .res-table th:nth-child(2), .phase-guide-content .res-table td:nth-child(2),
.guide-step .res-table th:nth-child(2), .guide-step .res-table td:nth-child(2) { width: 21%; }
  .phase-guide-content .res-table th:nth-child(3), .phase-guide-content .res-table td:nth-child(3),
.guide-step .res-table th:nth-child(3), .guide-step .res-table td:nth-child(3) { width: 17%; }
  .phase-guide-content .res-table th:nth-child(4), .phase-guide-content .res-table td:nth-child(4),
.guide-step .res-table th:nth-child(4), .guide-step .res-table td:nth-child(4) { width: 35%; }
}

/* --------------------------------------------------------------------------
   Impaginazione delle schede guida (comune a tutte le schede di metodo)
   -------------------------------------------------------------------------- */
.step-body h4 { line-height: 1.3; }
.step-body p { line-height: 1.5; }
.step-body ul, .step-body ol { margin: 0.55rem 0; padding-left: 1.25rem; }
.step-body li { line-height: 1.5; margin-bottom: 0.35rem; }
.step-body li > ul, .step-body li > ol { margin: 0.35rem 0; }
.step-body li:last-child { margin-bottom: 0; }
.ingredient-bullet-list { line-height: 1.55; }
.step-body .step-sub { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin: 0.9rem 0 0.3rem; line-height: 1.35; }
.step-note { background: rgba(50, 190, 120, 0.10); border-left: 5px solid var(--primary); padding: 0.9rem 1.1rem; border-radius: 8px; margin: 0.9rem 0; }
.step-note h5 { margin: 0 0 0.35rem 0; color: var(--primary); font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.step-note p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--text-main); }
.step-num--muted { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border-color); font-size: 1.05rem; }
.step-img-thumb--wide { width: 100%; max-width: 100%; height: auto; }

/* --- gusti da preparare (selezione dei condimenti) --- */
.gusto-add {
  display: inline-block; align-self: flex-start; flex: 0 0 auto; margin-top: 14px; padding: 7px 14px;
  border: 1px solid #38B87C; border-radius: 999px; background: transparent;
  color: #38B87C; font: inherit; font-size: 0.78rem; line-height: 1.2; cursor: pointer;
}
.gusto-add:hover { background: rgba(50, 190, 120, 0.12); }
.gusto-add.on { background: #38B87C; border-color: #38B87C; color: #101413; font-weight: 600; }
#gusti-count { display: inline-block; min-width: 1.1em; }
.gusti-lista { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; }
.gusto-riga { padding: 9px 13px; border-left: 3px solid #38B87C; border-radius: 0 8px 8px 0; background: rgba(50, 190, 120, 0.08); }
.gusto-riga strong { display: block; margin-bottom: 4px; }
.gusto-riga span { font-size: 0.82rem; opacity: 0.85; }
.gusti-vuoto { opacity: 0.7; font-size: 0.85rem; }
.gusti-titolo { margin: 18px 0 8px; font-size: 0.95rem; }
.gusti-ingredienti { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.gusti-ingredienti li { padding: 7px 12px; border-radius: 8px; background: rgba(50, 190, 120, 0.08); border: 1px solid rgba(50, 190, 120, 0.18); font-size: 0.88rem; }
.gusti-ingredienti li span { color: #38B87C; font-size: 0.78rem; margin-left: 6px; }
.gusto-scheda {
  display: flex; flex-direction: column; gap: 9px; padding: 13px; margin-bottom: 14px;
  border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card-sub);
}
.gusto-scheda h4 { font-size: 1.02rem; line-height: 1.3; margin: 0; }
.gusto-scheda p { font-size: 0.87rem; line-height: 1.5; color: var(--text-muted); margin: 0; }
.gusto-foto { width: 100%; max-width: 100%; height: auto; border-radius: 10px; cursor: zoom-in; }
.guide-step.gusto-scelto { border-color: #38B87C; box-shadow: 0 0 0 1px rgba(50, 190, 120, 0.35); }
.gusti-nota { font-weight: 400; opacity: 0.7; font-size: 0.78rem; }
/* --- griglia: 1 colonna su telefono, 2 su desktop --- */
.gusti-griglia { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .gusti-griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* tre colonne disattivate: su desktop restano due */
.gusto-scheda { margin-bottom: 0; }
.gusto-foto { max-height: 260px; object-fit: cover; }
/* --- elenco ingredienti compatto, senza contorni --- */
.gusti-ingredienti { gap: 1px; margin-bottom: 12px; }
.gusti-ingredienti li { background: none; border: none; border-radius: 0; padding: 3px 0 3px 24px; position: relative; font-size: 0.88rem; cursor: pointer; }
.gusti-ingredienti li::before { content: '\2713'; position: absolute; left: 4px; color: #38B87C; font-weight: 700; }
.gusti-ingredienti li:not(.da-comprare) { opacity: 0.45; text-decoration: line-through; }
.gusti-ingredienti li:not(.da-comprare)::before { content: '\25CB'; font-weight: 400; }
.gusti-nota { display: block; font-weight: 400; opacity: 0.65; font-size: 0.76rem; margin-top: 2px; }
@media (min-width: 900px) { .gusti-ingredienti { columns: 2; column-gap: 26px; } }
/* --- condimenti: 1 colonna su telefono, 2 su desktop (le card dei gusti) --- */
@media (min-width: 900px) {
  #pizza-guide-tonda-content, #pizza-guide-teglia-content, #pizza-guide-pala-content {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start;
  }
  #pizza-guide-tonda-content > .guide-step:not(:has(.gusto-add)),
  #pizza-guide-teglia-content > .guide-step:not(:has(.gusto-add)),
  #pizza-guide-pala-content > .guide-step:not(:has(.gusto-add)) { grid-column: 1 / -1; }
}

/* tre colonne sui monitor larghi (deve stare DOPO la regola delle due) */
@media (min-width: 1280px) {
  #pizza-guide-tonda-content, #pizza-guide-teglia-content, #pizza-guide-pala-content {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Galleria a foto singole con didascalia (guide) */
.step-image-gallery.single { display: block; }
.step-fig { margin: 0 0 1.1rem; }
.step-img-single {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  cursor: zoom-in;
}
.step-img-cap {
  display: block;
  max-width: 560px;
  margin-top: 0.4rem;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* Invito a installare l'app sulla Home */
.installa-banner {
  position: fixed; left: 0.7rem; right: 0.7rem; bottom: 0.7rem; z-index: 3000;
  display: flex; gap: 0.7rem; align-items: flex-start;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 0.85rem 0.95rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.installa-banner .ib-txt { flex: 1; font-size: 0.86rem; line-height: 1.4; color: var(--text-muted); }
.installa-banner .ib-txt strong { color: var(--text-main); display: block; margin-bottom: 0.15rem; }
.installa-banner .ib-x { background: none; border: 0; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 0 0.2rem; }
.installa-banner .ib-go { white-space: nowrap; }
.installa-passi { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.installa-passi li { margin-bottom: 0.35rem; }
