/* ==========================================================================
   FEUILLE DE STYLE OPTIMISÉE IPAD 2 (iOS 9.3.5 / Safari 9 - 1024x768)
   - Zéro CSS Grid, Zéro variable CSS (--var)
   - Flexbox avec préfixes -webkit-
   - Gros boutons tactiles (>= 48px) pour utilisation en cuisine
   ========================================================================== */

* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-color: #f1f5f9;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input {
  font-family: inherit;
  font-size: inherit;
}

/* ==================== ÉCRAN PIN TACTILE ==================== */
.pin-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #0f172a;
  z-index: 9999;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.pin-card {
  background-color: #1e293b;
  border: 2px solid #334155;
  border-radius: 20px;
  padding: 28px 36px;
  width: 380px;
  text-align: center;
  color: #ffffff;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.pin-icon {
  font-size: 46px;
  margin-bottom: 6px;
}

.pin-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.pin-subtitle {
  font-size: 15px;
  color: #94a3b8;
  margin-bottom: 20px;
}

.pin-dots {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: center;
  justify-content: center;
  margin-bottom: 18px;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 10px;
  border: 2px solid #64748b;
  margin: 0 10px;
  display: inline-block;
  background-color: transparent;
}

.pin-dot.filled {
  background-color: #38bdf8;
  border-color: #38bdf8;
}

.pin-error {
  background-color: #7f1d1d;
  color: #fecaca;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 14px;
}

.pin-keypad {
  margin-top: 8px;
}

.pin-row {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pin-btn {
  width: 88px;
  height: 68px;
  border-radius: 14px;
  border: 1px solid #475569;
  background-color: #334155;
  color: #ffffff;
  font-size: 26px;
  font-weight: bold;
  cursor: pointer;
}

.pin-btn:active {
  background-color: #0284c7;
  border-color: #38bdf8;
}

.pin-btn-action {
  background-color: #1e293b;
  color: #94a3b8;
  font-size: 22px;
}

/* ==================== BARRE SUPÉRIEURE ==================== */
.topbar {
  background-color: #0f172a;
  color: #ffffff;
  height: 64px;
  padding: 0 16px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  border-bottom: 2px solid #1e293b;
}

.topbar-tabs {
  display: -webkit-flex;
  display: flex;
}

.nav-tab {
  height: 48px;
  padding: 0 22px;
  margin-right: 10px;
  border-radius: 10px;
  border: none;
  background-color: #1e293b;
  color: #cbd5e1;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.nav-tab.active {
  background-color: #0284c7;
  color: #ffffff;
}

.topbar-right {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.btn-top-timer {
  height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #475569;
  background-color: #1e293b;
  color: #f8fafc;
  font-size: 16px;
  font-weight: bold;
  margin-right: 10px;
  cursor: pointer;
}

.btn-top-lock {
  height: 44px;
  width: 48px;
  border-radius: 10px;
  border: 1px solid #475569;
  background-color: #1e293b;
  color: #f8fafc;
  font-size: 18px;
  cursor: pointer;
}

.timer-widget {
  background-color: #ea580c;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 10px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.timer-label {
  font-size: 22px;
  font-weight: bold;
  margin-right: 12px;
  font-family: monospace;
}

.timer-stop-btn {
  background-color: #9a3412;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

/* ==================== CONTENEUR & BARRE D'OUTILS ==================== */
.main-container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 16px;
}

.toolbar {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 14px;
}

.filter-group {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.pill-btn {
  height: 46px;
  padding: 0 18px;
  margin-right: 8px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #334155;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.pill-btn.active {
  background-color: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.search-box, .freezer-search-bar {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 12px;
  width: 100%;
}

.search-input {
  -webkit-flex: 1;
  flex: 1;
  height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  font-size: 17px;
  color: #0f172a;
}

.btn-clear-search {
  height: 48px;
  width: 48px;
  margin-left: 8px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #e2e8f0;
  color: #475569;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

/* ==================== GRILLE DES RECETTES (FLEXBOX) ==================== */
.cards-list {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 0 -8px;
}

.recipe-card-wrap {
  width: 50%;
  padding: 8px;
}

@media (max-width: 680px) {
  .recipe-card-wrap {
    width: 100%;
  }
}

.recipe-card {
  background-color: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  height: 100%;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}

.recipe-card:active {
  border-color: #0284c7;
  background-color: #f0f9ff;
}

.card-top-row {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 10px;
}

.badge-cat {
  display: inline-block;
  background-color: #e0f2fe;
  color: #0369a1;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-stock {
  display: inline-block;
  background-color: #dcfce7;
  color: #15803d;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 6px;
}

.recipe-card-title {
  font-size: 21px;
  font-weight: bold;
  color: #0f172a;
  margin-bottom: 10px;
}

.recipe-card-meta {
  font-size: 15px;
  color: #64748b;
}

.recipe-card-meta span {
  margin-right: 14px;
}

/* ==================== VUE DÉTAIL RECETTE (2 COLONNES IPAD) ==================== */
.detail-topbar {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 14px;
}

.btn-back {
  height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

.btn-freeze-recipe {
  height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  background-color: #0284c7;
  color: #ffffff;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

.recipe-header-card {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
}

.recipe-main-title {
  font-size: 26px;
  font-weight: bold;
  color: #0f172a;
  margin-top: 6px;
}

.recipe-meta-pills {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.meta-pill {
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 16px;
  margin-left: 8px;
}

.recipe-columns {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
}

.recipe-col-left {
  width: 36%;
  padding-right: 14px;
}

.recipe-col-right {
  width: 64%;
}

@media (max-width: 740px) {
  .recipe-columns {
    -webkit-flex-direction: column;
    flex-direction: column;
  }
  .recipe-col-left, .recipe-col-right {
    width: 100%;
    padding-right: 0;
    margin-bottom: 14px;
  }
}

.panel-box {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 18px;
}

.panel-subtitle {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #0f172a;
}

.panel-hint {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 12px;
}

.portions-control {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
}

.portions-label {
  font-size: 17px;
  font-weight: bold;
}

.portions-stepper {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.btn-step {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid #94a3b8;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.btn-step:active {
  background-color: #0284c7;
  color: #ffffff;
}

.portions-val {
  font-size: 22px;
  margin: 0 16px;
  min-width: 28px;
  text-align: center;
}

.ingredients-list {
  list-style: none;
}

.ingredient-item {
  padding: 12px 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 18px;
  cursor: pointer;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.ingredient-item.checked {
  text-decoration: line-through;
  color: #94a3b8;
  background-color: #f8fafc;
}

.ing-checkbox {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px solid #64748b;
  margin-right: 12px;
  display: inline-block;
  text-align: center;
  line-height: 22px;
  font-size: 16px;
  font-weight: bold;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.ingredient-item.checked .ing-checkbox {
  background-color: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.steps-list {
  list-style: none;
}

.step-item {
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 19px;
  line-height: 1.5;
  background-color: #ffffff;
  cursor: pointer;
}

.step-item.active-step {
  border-color: #0284c7;
  background-color: #f0f9ff;
}

.step-item.done-step {
  opacity: 0.55;
  background-color: #f8fafc;
}

.step-num {
  display: inline-block;
  background-color: #0f172a;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 15px;
  text-align: center;
  line-height: 30px;
  font-size: 16px;
  font-weight: bold;
  margin-right: 10px;
}

.step-item.active-step .step-num {
  background-color: #0284c7;
}

.inline-timer-btn {
  display: inline-block;
  background-color: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
  border-radius: 8px;
  padding: 2px 10px;
  margin: 0 2px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.inline-timer-btn:active {
  background-color: #ea580c;
  color: #ffffff;
}

.notes-box {
  margin-top: 18px;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 17px;
  color: #92400e;
}

.notes-title {
  font-size: 18px;
  margin-bottom: 6px;
}

/* ==================== VUE CONGÉLATEUR ==================== */
.btn-add-freezer {
  height: 48px;
  padding: 0 20px;
  border-radius: 10px;
  border: none;
  background-color: #16a34a;
  color: #ffffff;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

.freezer-section-title {
  font-size: 18px;
  font-weight: bold;
  color: #334155;
  margin: 16px 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid #cbd5e1;
}

.freezer-row {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}

.freezer-row.age-warning {
  border-left: 6px solid #f59e0b;
}

.freezer-row.age-danger {
  border-left: 6px solid #ef4444;
}

.freezer-row.age-fresh {
  border-left: 6px solid #22c55e;
}

.frz-info {
  -webkit-flex: 1;
  flex: 1;
  padding-right: 12px;
}

.frz-name {
  font-size: 20px;
  font-weight: bold;
  color: #0f172a;
}

.frz-sub {
  font-size: 14px;
  color: #64748b;
  margin-top: 4px;
}

.frz-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  margin-right: 8px;
  background-color: #f1f5f9;
  color: #334155;
}

.frz-controls {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.frz-qty-badge {
  font-size: 20px;
  font-weight: bold;
  color: #0f172a;
  min-width: 115px;
  text-align: center;
  margin: 0 8px;
}

.btn-qty {
  width: 52px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #0f172a;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
}

.btn-qty:active {
  background-color: #0284c7;
  color: #ffffff;
}

.btn-out {
  height: 48px;
  padding: 0 14px;
  margin-left: 10px;
  border-radius: 10px;
  border: 1px solid #fca5a5;
  background-color: #fef2f2;
  color: #b91c1c;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

/* ==================== MODAL AJOUT CONGÉLATEUR ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.75);
  z-index: 5000;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background-color: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
  background-color: #0f172a;
  color: #ffffff;
  padding: 14px 20px;
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
}

.btn-close-modal {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: none;
  background-color: #334155;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 18px 20px;
}

.form-row {
  margin-bottom: 14px;
}

.form-row-split {
  display: -webkit-flex;
  display: flex;
  margin-bottom: 14px;
}

.form-col {
  width: 50%;
  padding-right: 10px;
}

.form-col:last-child {
  padding-right: 0;
}

.form-label {
  display: block;
  font-size: 15px;
  font-weight: bold;
  color: #334155;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #94a3b8;
  font-size: 18px;
}

.choice-buttons {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.choice-btn {
  height: 44px;
  padding: 0 14px;
  margin-right: 8px;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #334155;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

.choice-btn.active {
  background-color: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.qty-stepper {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.qty-input {
  width: 90px;
  text-align: center;
  font-weight: bold;
  margin: 0 8px;
}

.modal-footer {
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 14px 20px;
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
}

.btn-cancel {
  height: 48px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #475569;
  font-size: 17px;
  font-weight: bold;
  margin-right: 12px;
  cursor: pointer;
}

.btn-save {
  height: 48px;
  padding: 0 24px;
  border-radius: 10px;
  border: none;
  background-color: #16a34a;
  color: #ffffff;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

.empty-box {
  background-color: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
  color: #64748b;
  font-size: 18px;
  width: 100%;
}
