/* ===================== RESET LIGHT ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

/* ===================== BASE ===================== */

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #e5e7eb;
}

/* Mobile-first : taille de texte confortable */
body {
  font-size: 15px;
}

/* ===================== BACKGROUND / SHELL ===================== */

.app-bg {
  min-height: 100vh;
  padding: 0.75rem 0.5rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.35), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.3), transparent 55%),
    radial-gradient(circle at 50% 110%, rgba(76, 29, 149, 0.4), #020617 70%);
  display: flex;
  justify-content: center;
}

.noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='4' stitchTiles='noStitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1100px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.95);
  box-shadow:
    0 22px 45px -28px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(30, 64, 175, 0.5);
  overflow: hidden;
}

/* ===================== HEADER + BURGER ===================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background:
    radial-gradient(circle at top left, rgba(148, 163, 184, 0.2), transparent 60%),
    #020617;
  border-bottom: 1px solid rgba(51, 65, 85, 0.9);
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 10px;
}

.logo-title {
  font-family: "Cinzel", "Inter", system-ui;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Burger */

.menu-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.18rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.95);
  cursor: pointer;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin-inline: auto;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.9);
}

/* ===================== NAVIGATION MOBILE ===================== */

.main-nav {
  display: block;
  width: 100%;
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(30, 64, 175, 0.6);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    max-height 0.25s ease-out,
    opacity 0.25s ease-out,
    transform 0.25s ease-out;
  position: relative;
  padding: 0;
}

.nav-open .main-nav {
  max-height: 500px;
  opacity: 1;
  transform: translateY(0);
  padding: 0.6rem 1rem 0.8rem;
}

.main-nav .nav-link {
  display: block;
  padding: 0.55rem 0;
  font-size: 1rem;
  color: #e2e8f0;
  text-decoration: none;
  border-bottom: 1px solid rgba(30, 64, 175, 0.25);
}

.main-nav .nav-link:last-child {
  border-bottom: none;
}


/* ===================== CONTEXT BAR ===================== */

.context-bar {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(30, 64, 175, 0.7);
  background:
    radial-gradient(circle at top left, rgba(148, 163, 184, 0.18), transparent 60%),
    #020617;
}

.context-main {
  margin-bottom: 0.5rem;
}

.page-title {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "Cinzel", "Inter", system-ui;
}

.page-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: #9ca3af;
}

.context-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(129, 140, 248, 0.8);
  background: radial-gradient(circle at top, rgba(79, 70, 229, 0.35), rgba(15, 23, 42, 0.95));
}

.tag-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #c4b5fd;
}

/* ===================== PANELS & LAYOUT (MOBILE) ===================== */

.page-grid,
.guides-layout {
  display: block; /* 1 colonne par défaut */
  padding: 0.75rem 1rem 1rem;
}

.panel {
  margin-bottom: 0.75rem;
}

.card {
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 55, 0.95);
  background:
    radial-gradient(circle at top left, rgba(148, 163, 184, 0.16), transparent 60%),
    rgba(15, 23, 42, 0.96);
  padding: 0.85rem 0.9rem 1rem;
  box-shadow: 0 16px 30px -22px rgba(0, 0, 0, 0.9);
}

.panel-title {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #c7d2fe;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
}

.panel-pill {
  align-self: flex-start;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(129, 140, 248, 0.8);
  background: radial-gradient(circle at top, rgba(129, 140, 248, 0.3), rgba(15, 23, 42, 0.96));
}


/* ===================== FORM FIELDS ===================== */

.form-row,
.filter-group {
  margin-bottom: 0.75rem;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: #e5e7eb;
}

.field-input,
textarea {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(55, 65, 81, 0.95);
  background: #020617;
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
}

.field-input::placeholder,
textarea::placeholder {
  color: #6b7280;
}

.field-input:focus,
textarea:focus {
  border-color: rgba(96, 165, 250, 0.95);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.5);
}

.field-help {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #9ca3af;
}

.field-wrapper.icon-left {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.8;
}

.field-wrapper.icon-left .field-input {
  padding-left: 1.9rem;
}

/* ===================== BUTTONS ===================== */

.btn-primary {
  border: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #f9fafb;
  background: radial-gradient(circle at top, #38bdf8, #4f46e5);
  cursor: pointer;
  width: 100%;
}

/* ===================== TABLES ===================== */

.table-wrapper {
  margin-top: 0.4rem;
  border-radius: 10px;
  border: 1px solid rgba(30, 64, 175, 0.8);
  overflow: hidden;
}

.aion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.aion-table thead {
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.5), rgba(15, 23, 42, 0.96));
}

.aion-table th,
.aion-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.95);
  text-align: left;
  cursor: pointer;
}

.aion-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #e5e7eb;
}

.aion-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.96);
}

.aion-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.92);
}

/* État du reset : 3 couleurs DA Aion */

.tr-daily {
  background: rgba(59, 130, 246, 0.12);
  border-left: 3px solid rgba(96, 165, 250, 0.25);
}

.tr-daily td {
  background: rgba(59, 130, 246, 0.12);
}

.tr-weekly {
  background: rgba(251, 146, 60, 0.12);
  border-left: 3px solid rgba(251, 146, 60, 0.25);
}

.tr-weekly td {
  background: rgba(251, 146, 60, 0.12);
}

.tr-nreset {
  background: rgba(168, 85, 247, 0.12);
  border-left: 3px solid rgba(168, 85, 247, 0.25);
}

.tr-nreset td {
  background: rgba(168, 85, 247, 0.12);
}

/* Hover léger pour faire plus “UI Aion” */
.aion-table tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}



/* ===================== GUIDE LIST & DETAIL ===================== */

.guides-sidebar {
  margin-bottom: 0.75rem;
}

.guides-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guides-list li {
  margin-bottom: 0.35rem;
}

.guides-list button {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(31, 41, 55, 0.95);
  background:
    radial-gradient(circle at left, rgba(37, 99, 235, 0.35), rgba(15, 23, 42, 0.98));
  color: #e5e7eb;
  font-size: 0.9rem;
  cursor: pointer;
}

.guide-detail h3 {
  margin-top: 0;
}

.guide-detail ol {
  padding-left: 1.1rem;
}

/* ===================== STEP EDITOR (ADMIN) ===================== */

.step-editor {
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.95);
  background: rgba(15, 23, 42, 0.96);
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.5rem;
}

.step-editor label {
  font-size: 0.8rem;
}

.step-editor .step-title {
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(55, 65, 81, 0.95);
  background: #020617;
  color: #e5e7eb;
}

.step-editor .step-content {
  min-height: 70px;
  border-radius: 0.6rem;
  border: 1px solid rgba(55, 65, 81, 0.95);
  background: #020617;
  padding: 0.45rem 0.5rem;
  font-size: 0.9rem;
}

/* ===================== FOOTER ===================== */

.app-footer {
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  color: #9ca3af;
  border-top: 1px solid rgba(15, 23, 42, 0.95);
  background: #020617;
}

/* ===================== DESKTOP (≥ 900px) ===================== */

@media (min-width: 900px) {
  .app-bg {
    padding: 2rem 1rem;
  }

  .app-shell {
    border-radius: 22px;
  }

  .app-header {
    padding-inline: 1.75rem;
  }

  .menu-toggle {
    display: none;
  }

  .main-nav {
    max-height: none;
    padding: 0;
    border-top: none;
    background: transparent;
    flex-direction: row;
    gap: 0.6rem;
  }

  .nav-link {
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid transparent;
  }

  .nav-link:hover {
    border-color: rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
  }

  .nav-link-active {
    border-color: rgba(129, 140, 248, 0.9);
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.4), rgba(15, 23, 42, 0.95));
  }

  .context-bar {
    padding-inline: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .page-grid {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1.4fr);
    gap: 1.25rem;
    padding: 1.25rem 1.75rem 1.5rem;
  }

  .guides-layout {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1.6fr);
    gap: 1.25rem;
    padding: 1.25rem 1.75rem 1.5rem;
  }

  .panel {
    margin-bottom: 0;
  }

  .btn-primary {
    width: auto;
  }

  .guide-detail {
    max-height: 480px;
    overflow: auto;
  }

  .table-wrapper {
    overflow-x: visible;
  }

  .aion-table {
    font-size: 0.9rem;
  }

  
}

@media (min-width: 900px) {

  /* On cache le burger */
  .menu-toggle {
    display: none;
  }

  /* Le menu revient en mode horizontal */
  .main-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    /* On reset les styles du mobile */
    max-height: none;
    opacity: 1;
    transform: none;
    padding: 0;
    border-top: none;
    background: transparent;
    overflow: visible;
    position: static;
  }

  .main-nav .nav-link {
    font-size: 0.85rem;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    text-decoration: none;

    color: #dbeafe; /* bleu clair lisible */
    border: 1px solid transparent;
    transition: 0.15s ease;
  }

  .main-nav .nav-link:hover {
    color: #ffffff;
    background: rgba(30, 64, 175, 0.35);
    border-color: rgba(148, 163, 184, 0.4);
  }

  .main-nav .nav-link-active {
    color: #ffffff;
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.45), rgba(15, 23, 42, 0.95));
    border-color: rgba(129, 140, 248, 0.9);
  }

  .panel-filters {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    justify-content: space-between;
  }

  .panel-filters .filter-group:first-child {
    width: 60%
  }

}



/* ===== Toolbar de l'éditeur d'étapes ===== */

.step-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.4rem;
}

.step-toolbar .tool-btn {
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.step-toolbar .tool-btn:hover {
  border-color: rgba(96, 165, 250, 0.9);
}

/* Placeholder visuel pour le contenteditable */

.step-content[placeholder]:empty::before {
  content: attr(placeholder);
  color: #6b7280;
  pointer-events: none;
}

/* ===== Images de guide ===== */

.guide-step-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.4rem 0;
  display: block;
}

/* ===== Lightbox ===== */

.guide-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.guide-lightbox.is-open {
  display: flex;
}

.guide-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
}

.guide-lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.9);
  box-shadow:
    0 20px 60px -30px rgba(0, 0, 0, 1),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.guide-lightbox-inner img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
}


/* Images dans le contenu des guides (vue normale, pas lightbox) */
.guide-step-content {
  overflow-x: hidden; /* évite les barres de scroll horizontales */
}

.guide-step-content img {
  display: block;
  max-width: 100% !important;  /* ne dépasse jamais la largeur du conteneur */
  height: auto !important;      /* garde les proportions */
  margin: 0.5rem auto;          /* centre l'image dans le texte */
  border-radius: 8px;
  object-fit: contain;
}

/* Option : limiter un peu la hauteur sur mobile pour éviter un effet "mur d'image" */
@media (max-width: 768px) {
  .guide-step-content img {
    max-height: 60vh;
  }
}


/* ===== Liens utiles ===== */

.links-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

.link-card {
  border-radius: 12px;
  border: 1px solid rgba(30, 64, 175, 0.9);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.3), transparent 60%),
    rgba(15, 23, 42, 0.96);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.link-card-image-wrapper {
  max-height: 140px;
  overflow: hidden;
  background: #020617;
}

.link-card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.link-card-body {
  padding: 0.6rem 0.7rem 0.7rem;
}

.link-card-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.link-card-desc {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.link-card-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: #f9fafb;
  background: radial-gradient(circle at top, #38bdf8, #4f46e5);
}

.btn-link-secondary {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  cursor: pointer;
}

@media (min-width: 900px) {
  .links-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
