:root {
  --peach: #ff8c66;
  --peach-dark: #ff7043;
  --dark-bg: #121212;
  --dark-card: #1e1e1e;
  --dark-border: #2a2a2a;
  --text-light: #e6e6e6;
  --text-muted: #b5b5b5;
  --nav-dark: #8f8f8f;
}

.text-light
  {
  color:var(--text-light) !important;
  }

/* Fond */
/* Fond global */
body {
  background-image: url("https://banpeach.fr/imgs/fond.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* permet de rester sur tout le scroll */
  color: var(--text-light);
  overflow-y: auto; /* scroll fonctionnel */
}

/* html juste pour reset hauteur */
html {
  height: 100%;
  margin: 0;
}

/* Body : ne scroll pas, scroll unique dans app-content */
body {
  background-color: transparent;
  color: var(--text-light);
  overflow-y: auto; /* <-- corrigé ici pour permettre le scroll */
}

/* Container app */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;    /* PC */
  min-height: 100dvh;   /* Mobile */
  /* padding-top: 56px; <-- on retire pour ne pas bloquer scroll */
}

/* Contenu scrollable */
.app-content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  padding-top: 75px; /* <-- décalage du haut */
  padding-bottom: calc(75px + env(safe-area-inset-bottom));
}

/* Masquer scrollbar */
.app-content::-webkit-scrollbar { display: none; }
.app-content { scrollbar-width: none; -ms-overflow-style: none; }



/* ---------------------------
   CKEditor Dark Theme
--------------------------- */

/* Barre de menu */
.ck.ck-menu-bar {
    background-color: #2a2a2a !important;
    border-bottom: 1px solid #444 !important;
}

/* Tous les boutons de menu */
.ck.ck-menu-bar__menu__button,
.ck.ck-menu-bar__menu__item__button {
    background-color: #2a2a2a !important;
    color: #e6e6e6 !important;
    border: none !important;
}

/* Boutons hover/focus/active */
.ck.ck-menu-bar__menu__button:hover,
.ck.ck-menu-bar__menu__item__button:hover,
.ck.ck-menu-bar__menu__button:focus,
.ck.ck-menu-bar__menu__item__button:focus,
.ck.ck-menu-bar__menu__button.ck-on,
.ck.ck-menu-bar__menu__item__button.ck-on {
    background-color: #ff7043 !important;
    color: #000 !important;
}

/* Icônes des boutons */
.ck.ck-menu-bar__menu__button .ck-icon,
.ck.ck-menu-bar__menu__item__button .ck-icon {
    fill: #e6e6e6 !important;
}

/* Menus déroulants */
.ck.ck-menu-bar__menu__panel {
    background-color: #1e1e1e !important;
    color: #e6e6e6 !important;
    border: 1px solid #444 !important;
}

/* Items du panel */
.ck.ck-list__item {
    background-color: transparent !important;
    color: #e6e6e6 !important;
}

/* Item hover */
.ck.ck-list__item:hover {
    background-color: #ff7043 !important;
    color: #000 !important;
}

/* Éditeur principal */
.ck-editor__editable_inline {
    background-color: #121212 !important;
    color: #e6e6e6 !important;
}

/* Placeholder */
.ck.ck-editor__editable_inline .ck-placeholder {
    color: #777 !important;
}

/* Toolbar CKEditor en dark */
.ck.ck-toolbar__items {
    background-color: #1e1e1e; /* fond sombre */
    border-color: #333;        /* bordure discrète */
}

.ck.ck-button {
    color: #eee;               /* texte clair */
    background-color: #2a2a2a; /* fond des boutons */
}

.ck.ck-button:hover {
    background-color: #3a3a3a; /* hover effect */
}

.ck.ck-dropdown__panel {
    background-color: #1e1e1e; /* menu déroulant sombre */
    color: #eee;
}

.ck.ck-toolbar__separator {
    border-color: #555; /* séparateur discret */
}

/* Fond et texte des menus déroulants */
.ck.ck-list {
    background-color: #1e1e1e; /* fond sombre */
    color: #eee;               /* texte clair */
}

/* Boutons des items du menu */
.ck.ck-list__item .ck-button {
    background-color: #2a2a2a; /* fond sombre des boutons */
    color: #eee;               /* texte clair */
}

/* Hover sur les boutons du menu */
.ck.ck-list__item .ck-button:hover {
    background-color: #3a3a3a;
}

/* Séparateurs dans les menus */
.ck.ck-list__separator {
    border-top: 1px solid #555; /* ligne plus visible sur fond sombre */
    margin: 4px 0;
}

/* Icones SVG dans les boutons */
.ck.ck-list__item .ck-icon {
    fill: #eee; /* couleur claire pour les icônes */
}

/* Fond et texte des menus déroulants */
.ck.ck-list {
    background-color: #1e1e1e; /* fond sombre */
    color: #eee;               /* texte clair */
}

/* Boutons des items du menu */
.ck.ck-list__item .ck-button {
    background-color: #2a2a2a; /* fond sombre des boutons */
    color: #eee;               /* texte clair */
    transition: background-color 0.2s ease;
}

/* Hover sur les boutons du menu - couleur pêche */
.ck.ck-list__item .ck-button:hover {
    background-color: #FFA07A; /* pêche */
    color: #1e1e1e;            /* texte sombre pour contraste */
}

/* Séparateurs dans les menus */
.ck.ck-list__separator {
    border-top: 1px solid #555; /* ligne plus visible sur fond sombre */
    margin: 4px 0;
}

/* Icones SVG dans les boutons */
.ck.ck-list__item .ck-icon {
    fill: #eee; /* couleur claire pour les icônes */
}

/* Hover sur les icônes pour le contraste si nécessaire */
.ck.ck-list__item .ck-button:hover .ck-icon {
    fill: #1e1e1e;
}

/* Boutons CKEditor (ex: Souligné) */
.ck.ck-button {
    background-color: #2a2a2a; /* fond sombre par défaut */
    color: #eee;               /* texte clair */
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Hover pêche */
.ck.ck-button:hover {
    background-color: #FFA07A; /* pêche */
    color: #1e1e1e;            /* texte sombre pour contraste */
}

/* Icone à l'intérieur du bouton */
.ck.ck-button:hover .ck-icon {
    fill: #1e1e1e; /* icône sombre sur fond pêche */
}




/* Alert pêche */
.alert-peach {
    background-color: #FFDAB9; /* pêche clair */
    color: #8B4513;            /* brun/orangé foncé pour le texte */
    border: 1px solid #FFA07A; /* contour pêche plus soutenu */
    border-radius: 5px;
    padding: 15px 20px;
    font-size: 1rem;
}

/* Bouton de fermeture de l'alert */
.alert-peach .btn-close {
    color: #8B4513;
    opacity: 0.8;
}

.alert-peach .btn-close:hover {
    color: #5C2C00;
    opacity: 1;
}







/* Pagination Peach Theme */
.pagination .page-item.active .page-link {
  background-color: var(--peach);
  border-color: var(--peach);
  color: #000;
}

.pagination .page-item .page-link {
  color: var(--text-light);
  background-color: #1e1e1e; /* couleur du card */
  border: 1px solid var(--dark-border);
  transition: all 0.2s;
}

.pagination .page-item .page-link:hover {
  background-color: var(--peach-dark);
  border-color: var(--peach-dark);
  color: #000;
}

.pagination .page-link {
  border-radius: 0.35rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Select2 */
/* Conteneur général */
.select2-container--default .select2-selection--single {
  background-color: #1e1e1e;       /* couleur card */
  border: 1px solid var(--dark-border);
  color: var(--text-light);
  height: 38px;
  line-height: 38px;
  border-radius: 0.35rem;
  padding: 0 0.75rem;
}

/* Placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #777;
}

/* Flèche */
.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-light) transparent transparent transparent;
}

/* Dropdown */
.select2-container--default .select2-results>.select2-results__options {
  background-color: #1e1e1e;
  color: var(--text-light);
}

/* Options */
.select2-container--default .select2-results__option {
  padding: 0.4rem 0.75rem;
}

/* Option survolée */
.select2-container--default .select2-results__option--highlighted {
  background-color: var(--peach);
  color: #000;
}

/* Option sélectionnée dans le dropdown */
.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: var(--peach-dark);
  color: #000;
}

/* Texte sélectionné */
.select2-container--default .select2-selection__rendered {
  color: var(--text-light);
}

/* Input Select2 en dark */
.select2-search__field {
    background-color: #2b2b2b;  /* fond sombre */
    color: #f0f0f0;             /* texte clair */
    border: 1px solid #444;     /* bordure discrète */
    padding: 6px 10px;
    border-radius: 4px;
}

/* Placeholder clair */
.select2-search__field::placeholder {
    color: #aaa;
    opacity: 1; /* assure que le placeholder soit visible */
}

/* Focus avec lueur douce */
.select2-search__field:focus {
    outline: none;
    border-color: #ffb07c;      /* couleur pêche pour le focus */
    box-shadow: 0 0 5px rgba(255, 176, 124, 0.5);
    background-color: #3a3a3a;  /* légèrement plus clair au focus */
}





.barcode-result {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    margin-top: 15px;
    max-width: 100%;
    flex-wrap: wrap;
    font-family: 'Segoe UI', sans-serif;
}

.barcode-result.found {
    background: linear-gradient(135deg, #ffb07c, #ff8f6b);
    color: #1a1a1a;
}

.barcode-result.not-found {
    background-color: #3a3a3a;
    color: #ff6b6b;
}

.barcode-result .info {
    flex: 1 1 auto;
    min-width: 150px;
}

.barcode-result .checkmark {
    font-size: 1.2rem;
}

.barcode-result .product-name {
    display: block;
    font-size: 1.1rem;
    margin-top: 5px;
}

.barcode-result .image-container {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
}

.barcode-result .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #fff3e0;
}

/* Responsive : sur petit écran, image en dessous du texte */
@media (max-width: 768px) {
    .barcode-result {
        flex-direction: column;
        align-items: flex-start;
    }
    .barcode-result .image-container {
        width: 100%;
        height: auto;
    }
    .barcode-result .image-container img {
        width: 100%;
        height: auto;
    }
}












/* Carnet ingredients*/
.ingredient-card {
    border-radius: 16px;
    overflow: hidden;          /* ⬅️ empêche tout débordement */
    background: #1e1e1e;
    height: 100%;
}

.ingredient-img-wrapper img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;         /* ⬅️ recadrage propre */
    display: block;
}
.ingredient-img-wrapper {
    width: 100%;
    height: 140px;             /* mobile */
    background: #111;
    overflow: hidden;          /* ⬅️ CRUCIAL */
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .ingredient-img-wrapper {
        height: 180px;
    }
}

@media (hover: hover) {
    .ingredient-card:hover img {
        transform: scale(1.05);
    }
}




/* Form-select dark theme */
.form-select {
  background-color: #1e1e1e;        /* couleur card */
  border: 1px solid var(--dark-border);
  color: var(--text-light);
  border-radius: 0.35rem;
  padding: 0.375rem 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Placeholder / option non sélectionnée */
.form-select option:disabled {
  color: #777;
}

/* Focus */
.form-select:focus {
  background-color: #1e1e1e;
  color: var(--text-light);
  border-color: var(--peach);
  box-shadow: 0 0 0 0.15rem rgba(255, 140, 102, 0.25);
  outline: none;
}

/* Dropdown arrow */
.form-select::-ms-expand {
  display: none; /* IE10+ */
}

/* Hover */
.form-select:hover {
  border-color: var(--peach-dark);
}





/* Header */
.navbar2 {
  position: fixed;
  top: 0;
  width: 100%;
  height: 56px;
  z-index: 1030;
  background: linear-gradient(135deg, var(--peach), var(--peach-dark));
}

/* Cards */
.card {
  background-color: rgba(30, 30, 30, 0.95);
  border: 1px solid var(--dark-border);
  color: var(--text-light);
  backdrop-filter: blur(6px);
}

/* Buttons */
.btn-peach {
  background-color: var(--peach);
  border: none;
  color: #000;
  font-weight: 500;
}

.btn-peach:hover {
  background-color: var(--peach-dark);
  color: #000;
}

/* Inputs */
.form-control {
  background-color: #151515;
  border: 1px solid #333;
  color: var(--text-light);
}

.form-control::placeholder {
  color: #777;
}

.form-control:focus {
  background-color: #151515;
  color: var(--text-light);
  border-color: var(--peach);
  box-shadow: 0 0 0 0.15rem rgba(255, 140, 102, 0.25);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 65px;
  background-color: var(--dark-card);
  border-top: 1px solid var(--dark-border);
  z-index: 1030;
}

/* iOS Safari fallback */
@supports (padding-bottom: constant(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: constant(safe-area-inset-bottom); }
}

.bottom-nav a {
  font-size: 0.75rem;
  color: var(--nav-dark);
  text-decoration: none;
  transition: color 0.2s ease;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bottom-nav a.active,
.bottom-nav a:hover { color: var(--peach); }

.bottom-nav i {
  font-size: 1.1rem;
  margin-bottom: 2px;
}





/* Bande caméra */
#scanner {
    position: relative;
    width: 100%;
    height: 120px; /* hauteur réduite */
    overflow: hidden;
    background: #000;
}

/* Vidéo zoomée pour remplir la bande */
#scanner video {
    width: 100%;
    height: auto;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

/* Cadre de scan */
#scan-zone {
    position: absolute;
    top: 50%;
    left: 5%;
    width: 90%;
    height: 50px;
    transform: translateY(-50%);
    border: 2px solid #00ff00;
    box-sizing: border-box;
    border-radius: 6px;
}

/* Champ résultat */
#code_barre {
    margin-top: 15px;
    width: 90%;
    font-size: 1.2em;
    padding: 8px;
}




@media (max-width: 768px) {
  .app-content {
    transform-origin: top center; /* garde le haut visible */
  }

  .app-content p {
    font-size: 0.85em; /* référence */
  }

  /* Titres : multiplicateurs par rapport à <p> */
  .app-content h1 { font-size: calc(0.85em * 2.0); } /* 2x p */
  .app-content h2 { font-size: calc(0.85em * 1.8); }
  .app-content h3 { font-size: calc(0.85em * 1.6); }
  .app-content h4 { font-size: calc(0.85em * 1.4); }
  .app-content h5 { font-size: calc(0.85em * 1.2); }
  .app-content h6 { font-size: calc(0.85em * 1.0); } /* presque comme <p> */

  /* Petits textes : labels, span, small */
  .app-content small,
  .app-content label,
  .app-content span {
    font-size: calc(0.85em * 0.9); /* un peu plus petit que p */
  }
}