/* Styles pour orientation.php et orientation_reserve.php
   - Layout général, topbar, formulaires, selects dynamiques
   - Résultats, combobox, espace réservé, formulaires de création/modification
*/

:root {
  --bg: #ffffff;
  --muted: #6b7280;
  --accent: #0b5ed7;
  --accent-visited: #084a9e;
  --border: #e5e7eb;
  --danger: #b00020;
  --card-bg: #ffffff;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --gap: 12px;
  --max-width: 1100px;
}

/* Reset ponctuel */
.orientation-reserve {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: #fafafa;
  color: #111827;
  margin: 0;
  padding: 0 8px 32px;
}

.topbar {
  display: flex;
  width: 100%;
  justify-content: space-between;
  background: linear-gradient(180deg, #fff, #f7f9fc);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  box-shadow: var(--shadow);
}

.topbar .menu {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  justify-content: space-between; /* buttons at ends */
  align-items: center;
  gap: 8px;
}

.button_topbar .button_topbar {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border: none;
}
.topbar button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}

/* Ensure buttons don't stretch and are vertically centered */
.topbar .menu > button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* small tweak: if there are exactly two buttons, push them to edges
   (keeps compatibility if more items appear) */
.topbar .menu > button:first-child {
  margin-right: auto;
}

/* Ajustements supplémentaires pour alignement et taille d'images dans le topbar
   - centre le menu dans la largeur max de la page
   - force une taille raisonnable / responsive pour les images
   - évite d'écraser les règles globales en scoping  */
.topbar {
  align-items: center; /* vertical centering */
}
.topbar .menu {
  margin: 0 auto; /* centre le menu dans la page */
  padding: 0 16px; /* garde un peu de marge interne */
  box-sizing: border-box;
}
img.button_topbar {
  height: 34px !important; /* réduire les images */
  width: auto !important;
  display: block;
}
.menu button {
  padding: 6px;
}

/* si vous voulez des icônes encore plus petites sur mobile */
@media (max-width: 520px) {
  img.button_topbar {
    height: 28px !important;
  }
  .topbar .menu {
    padding: 0 8px;
  }
}
.topbar button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}

/* Layout principal */
.zone_orientation {
  max-width: var(--max-width);
  margin: 18px auto;
  background: transparent;
}

#zone_recherche {
  background: #fff;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#zone_recherche h4 {
  margin: 8px 0;
  color: #0f172a;
}
[id^="voies_"] {
  flex-direction: column;
}
#voies_generales,
#voies_technologiques,
#filtres {
  border-top: 1px solid #ccc; /* léger trait */
  margin-top: 3%;
}

/* Form items scoped to orientation pages */
select,
input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: #111827;
  outline: none;
  background: #fff;
}

select {
  min-width: 180px;
}

.select_options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.select_options select {
  min-width: 220px;
}
#voies_generales select,
#voies_technologiques select,
#voies_professionnelles select {
  max-width: 30%;
}
#voies_options select,
#voies_options_seconde2 select {
  max-width: fit-content;
}
#filtres {
  gap: 8px;
}
#filtres select {
  margin-right: 8px;
}

button,
input[type="submit"] {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}
button:hover,
input[type="submit"]:hover {
  background: var(--accent-visited);
}
button[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Loading indicator */
#ajax-loading {
  max-width: var(--max-width);
  margin: 8px auto;
  color: var(--muted);
}
/* Loading indicator */
#ajax-loading {
  max-width: var(--max-width);
  margin: 8px auto;
  color: var(--muted);
}

/* Résultats */
.zone_orientation .resultat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 12px;
  margin: 10px 0;
  border-radius: 8px;
  display: block;
}
.resultat h3 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
}
.resultat p {
  margin: 4px 0;
  color: #374151;
}

.zone_orientation .resultat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 12px;
  margin: 10px 0;
  border-radius: 8px;
  display: block;
}
.resultat h3 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
}
.resultat p {
  margin: 4px 0;
  color: #374151;
}

.no-result {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: #fff;
  color: var(--muted);
}

/* unscoped .no-result removed to avoid conflict with global styles; scoped rule above is used */

/* Bottombar (scoped) */
#bottombar {
  max-width: var(--max-width);
  margin: 18px auto;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
#bottombar a {
  color: var(--accent);
  text-decoration: none;
}
#bottombar a:hover {
  text-decoration: underline;
}

/* Combobox (orientation_reserve) scoped */
.combobox-container {
  position: relative;
  max-width: 720px;
  margin: 6px 0 6px -80px;
}
.combobox-input {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.combobox-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 260px;
  overflow: auto;
  display: none;
  z-index: 80;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}
.combobox-item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px dashed #f1f5f9;
}
.combobox-item:last-child {
  border-bottom: none;
}
.combobox-item:hover {
  background: #f8fafc;
}

/* Content zones for reserve (scoped) */
.content {
  width: 100%;
  max-width: 100%; /* allow full-bleed content */
  margin: 0; /* take full width, use internal padding for breathing room */
  padding: 18px 0px;
  display: flex;
  gap: 18px;
  flex-direction: column;
  align-items: stretch;
}
#zone_reserve h2 {
  margin: 6px 0 12px;
}
#zone_reserve_etab {
  background: #fff;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
#zone_reserve_etab_choix {
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-around; /* répartit les éléments aux extrémités */
  flex-wrap: wrap;
  position: relative; /* needed to absolutely center the middle paragraph */
}
#combobox-etab {
  flex: 0 1 40%; /* base 40%, but can shrink if space is limited */
  min-width: 200px;
  max-width: 420px; /* limit width so middle text can be centered */
}
#etablissements {
  flex: 0 0 auto;
  min-width: 160px;
}

/* Appliquer un espacement et alignement uniforme pour le <p> et le bouton */
/* center the "ou" paragraph in the parent regardless of sibling widths */
#zone_reserve_etab_choix p {
  margin: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none; /* avoid accidental clicks when overlapping inputs */
}
#zone_reserve_etab_choix > button {
  flex: 0 0 auto;
  align-self: center;
  margin-right: 12%;
}

/* Sur petits écrans, empiler verticalement en gardant un bel espacement */
@media (max-width: 720px) {
  #zone_reserve_etab_choix {
    flex-direction: column;
    align-items: stretch;
  }
  #combobox-etab,
  #etablissements,
  #zone_reserve_etab_choix > button {
    flex: 1 1 auto;
    min-width: 0;
  }
  #zone_reserve_etab_choix p {
    position: static; /* restore normal flow on small screens */
    transform: none;
    text-align: center;
    margin: 8px 0;
    pointer-events: auto;
  }
}

/* Blocks for each establishment (scoped) */
#choix_option_etab > div[id^="choix_etab_"] {
  display: none; /* shown via JS when needed */
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border-bottom: 1px solid #f3f4f6;
  flex-direction: column; /* ensure column layout when displayed as flex */
}

/* IDs in the markup contain dots (e.g. id="choix_etab.info"),
   so use attribute selectors to target them reliably. */
[id="choix_etab.info"] {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: center;
  width: 45%;
  justify-content: space-evenly;
}
[id^="choix_etab.info"] h3 {
  margin: 0;
}
[id^="choix_etab_modif_"] {
  display: none;
  flex-direction: column;
  gap: 8px;
}
[id^="option_etab_"] {
  flex-direction: column;
}
#option_etab-content {
  display: flex;
  flex-direction: row;
}
/* When JS reveals an element by adding a "visible" class, make it a flex container.
   Also handle common inline toggles where JS sets `style.display = 'block'`. */
#choix_option_etab > div[id^="choix_etab_"] .visible,
#choix_option_etab > div[id^="choix_etab_"].visible,
#choix_option_etab > div[id^="choix_etab_"][style*="display:block"],
#choix_option_etab > div[id^="choix_etab_"][style*="display: block"] {
  display: flex;
  flex-direction: column;
}

/* When JS toggles visibility by setting display:flex, these rules
   will enforce the intended flex-direction and spacing. */

#etab_info h4 {
  margin: 4px 0;
  color: #374151;
}
.btn-modifier {
  background: #e8edf8;
  color: #0b5ed7;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
}
.btn-modifier:hover {
  background: #dbe7fb;
}

/* Option lists */
.option-list {
  display: flex;
  flex-direction: column;
  background: #fafafa;
  border: 1px solid #f1f5f9;
  padding: 8px;
  border-radius: 6px;
}
.option-list label {
  display: block;
  margin: 6px 0;
}
.option-list input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

/* Form inputs inside address groups */
#adresse {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
#adresse input {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Buttons actions zone */
#valid_modif_etab {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: space-evenly;
}
#valid_modif_etab button {
  background: #10b981;
}
#valid_modif_etab button#cancel_modif {
  background: #ef4444;
}

/* Responsive */
@media (max-width: 820px) {
  .select_options {
    flex-direction: column;
  }
  #adresse {
    flex-direction: column;
  }
  .combobox-list {
    max-height: 180px;
  }
  .zone_orientation,
  .content {
    padding: 8px;
  }
}

/* Small utilities (scoped) */
.hidden {
  display: none !important;
}
.text-muted {
  color: var(--muted);
}

/* Inputs auto-size class referenced in pages */
.autosize {
  width: 100%;
  box-sizing: border-box;
}

/* Error class used in orientation_reserve password box */
.error {
  color: var(--danger);
  margin-bottom: 0.5rem;
}

/* Simple box style used for password dialog fallback (keeps compatibility) */
.box {
  max-width: 420px;
  margin: 4rem auto;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Accessibility focus outlines (scoped) */
button:focus,
select:focus,
input:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.12);
}

/* Utility: allow toggling visibility by adding/removing `.visible` */
.orientation-reserve .visible {
  display: flex !important;
}

/* Oral*/
#eleves{
  display: flex;
  width : fit-content;
  min-width: 20%;
  flex-direction: column;
  gap: 12px;
  padding-right: 1%;
  height: 100%;
  border-right: 1px solid black;
}
#liste_eleves{
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: fit-content;
} 
#commentaires{
  display: flex;
  flex-direction: column;
  width: fit-content;
  min-width: 75%;
  height:fit-content;
  overflow: auto;
}
