/* Journal des modifications
 * 2026-06-12 - Recentrage du footer applicatif et alignement du rendu sur MayPlanning.
 * 2026-06-12 - Ajout du style du footer applicatif discret.
 */

:root {
  --layout-shell-width: min(900px, 96vw);
  --layout-shell-min-width: 0px;
  --blue: #005f9e;
  --blue-dark: #00497a;
  --bg: #f4f7f9;
  --card: #ffffff;
  --text: #333;
  --muted: #9aa6b2;
  --success: #27ae60;
  --success-dark: #1e874b;
  --warning: #f39c12;
  --danger: #e74c3c;
  --danger-hover: #a8322b;
  --warning-hover: #9a4608;
  --border: #e5e7eb;
  --border-soft: #d0d7de;
}

/* =========================================================
   BASE
   ========================================================= */

* { box-sizing: border-box; }

html, body { height: 100%; }

body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }

/*a {
  color: var(--blue);
}*/

img { max-width: 100%; display: block; }

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  position: sticky; top: 0; z-index: 100; background: var(--blue);
  color: #fff; padding: .6rem 1rem; display: flex; align-items: center;
  gap: .8rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  width: var(--layout-shell-width);
  min-width: var(--layout-shell-min-width);
  margin-left: auto;
  margin-right: auto;
}

.topbar img {
  height: 40px; width: 40px; object-fit: contain; border-radius: 6px;
  background: transparent;
}

.topbar h1 { font-size: 1.1rem; font-weight: 600; margin: 0; color: #fff; }

.topbar .topbar-actions { margin-left: auto; display: flex; gap: .5rem; }

/* =========================================================
   CONTAINER
   ========================================================= */

.container {
  width: var(--layout-shell-width); min-width: var(--layout-shell-min-width); margin: 1rem auto; padding: 2rem; background: var(--card);
  border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.app-footer {
  width: fit-content;
  max-width: min(900px, 96vw);
  min-width: 0;
  margin: -.35rem auto 1.2rem;
  padding: 0 .4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  color: #8a96a3;
  font-size: 1rem;
  text-align: center;
}

.app-footer a {
  color: #6f7d8b;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.app-footer a:hover {
  color: var(--blue);
  border-bottom-color: rgba(0, 95, 158, .35);
}

/* version large pour pages backoffice */
.container-wide {
  --layout-shell-width: min(1400px, 96vw);
  --layout-shell-min-width: 1200px;
}

/* =========================================================
   TYPO / FORMULAIRES
   ========================================================= */

h2 { margin-top: 0; color: var(--blue); text-align: left; }

h3 { margin-top: 0; color: var(--blue); }

label { display: block; font-weight: 600; margin-top: .8rem; }

input, select, textarea {
  width: 100%; padding: .45rem .65rem; margin-top: .35rem; border: 1px solid var(--border-soft);
  border-radius: 10px; background: #fff; color: var(--text); font: inherit;
}

input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 95, 158, .15); border-color: var(--blue); }

input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

.password-toggle-wrap { position: relative; display: block; }

.password-toggle-wrap > input { padding-right: 2.8rem; }

.password-toggle-btn {
  position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  width: 2rem; height: 2rem; padding: 0; border: 0;
  border-radius: 999px; background: transparent; color: #64748b; cursor: pointer;
  font-size: 1rem; line-height: 0; transition: none; display: inline-flex;
  align-items: center; justify-content: center;
}

.password-toggle-btn:hover, .password-toggle-btn:focus { background: transparent; color: #64748b; }

.password-toggle-btn:active { transform: translateY(-50%); }

.password-toggle-icon {
  width: 1.35rem; height: 1.35rem; display: block; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}

.password-toggle-btn.is-password-visible .password-toggle-slash { display: none; }

textarea { min-height: 120px; resize: vertical; }

.readonly { background: #f3f4f6; color: #6b7280; }

.row, .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; }

/* =========================================================
   ACTIONS / BOUTONS
   ========================================================= */

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }

button, .btn {
  appearance: none; border: 0; cursor: pointer; padding: .8rem 1.1rem;
  border-radius: 10px; background: var(--blue); color: #fff; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 1rem; font-weight: 600; line-height: 1.2; transition: transform .04s ease, background .2s ease;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button:hover, .btn:hover { background: var(--blue-dark); color: #fff; }

button:active, .btn:active { transform: translateY(1px); }

.btn-light { background: #e6edf3; color: #0b2842; }

.btn-light:hover { background: #d9e4ec; color: #0b2842; }

.btn-danger { background: var(--danger); }

.btn-danger:hover { background: var(--danger-hover); }

.btn-warning { background: var(--warning); }

.btn-warning:hover { background: var(--warning-hover); }

.btn-success { background: var(--success); }

.btn-success:hover { background: var(--success-dark); }

.btn-compact { padding: .35rem .75rem; }
.btn-table { height: 30px; }

/* =========================================================
   ALERTES
   ========================================================= */

.alert { padding: .8rem 1rem; border-radius: 10px; margin: .8rem 0; }

.alert.error { background: #ffe6e3; color: #7a1f11; border: 1px solid #ffc9c2; }

.alert.warning { background: #fff7e6; border: 1px solid #ffd9a6; color: #7a4e00; }

.alert.success { background: #eaffef; color: #1b6c3b; border: 1px solid #bfe7cb; }

/* =========================================================
   TABLEAUX
   ========================================================= */

.table-wrap { width: 100%; overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; margin-top: 1rem; background: #fff; }

.table th, .table td { border: 1px solid var(--border); padding: .4rem .8rem; text-align: left; vertical-align: middle; }

.table thead th { background: #f8fafc; font-weight: 700; }

.table tbody tr:hover { background: #fafcfe; }

.table td.center, .table th.center { text-align: center; }

.table td.nowrap, .table th.nowrap { white-space: nowrap; }

/* =========================================================
   MENU TOPBAR
   ========================================================= */

.topbar .topbar-menu { position: relative; margin: 0; padding: 0 1rem; }

.topbar .menu-toggle {
  background: #fff; color: var(--blue); border: none; padding: .5rem .75rem;
  border-radius: .5rem; cursor: pointer;
}

.topbar .menu-toggle:hover { background: #f3f4f6; }

.topbar .menu-toggle:focus { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: 2px; }

.topbar .menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--card);
  border: 1px solid #e5e7eb; border-radius: .75rem; padding: .6rem; min-width: 220px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .15); z-index: 1000;
}

.topbar .menu-panel .menu-item {
  display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem;
  margin: .25rem 0; border: 1px solid #e5e7eb; border-radius: .65rem; background: #fff;
  text-decoration: none; font-weight: 600; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: background-color .15s ease, transform .06s ease, box-shadow .15s ease, border-color .15s ease;
}

.topbar .menu-panel .menu-item:hover { background: #f7f8fa; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 0, 0, .06); border-color: #dfe3e8; }

.topbar .menu-panel .menu-item:active { transform: translateY(0); }

.topbar .menu-panel .menu-item .icon { font-size: 1.05em; line-height: 1; }

.topbar .menu-panel .menu-item.is-danger { border-color: rgba(231, 76, 60, .25); color: var(--danger); }

.topbar .menu-panel .menu-item.is-danger:hover { background: #fff7f6; border-color: rgba(231, 76, 60, .4); box-shadow: 0 4px 10px rgba(231, 76, 60, .08); }

.topbar .menu-panel .menu-item:focus { outline: 2px solid rgba(0, 95, 158, .25); outline-offset: 2px; }

/* =========================================================
   SIDEBAR / MENU GAUCHE MAYBULLETIN
   ========================================================= */

.page-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; align-items: start; }

.sidebar { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: .8rem; }

.sidebar-title { margin: 0 0 .7rem 0; font-size: 1rem; color: var(--blue); font-weight: 700; }

.sidebar-nav { display: flex; flex-direction: column; gap: .45rem; }

.sidebar-nav a {
  display: block; padding: .7rem .8rem; border-radius: 10px; text-decoration: none;
  color: var(--text); font-weight: 600; border: 1px solid transparent;
}

.sidebar-nav a:hover { background: #eef5fa; border-color: #d6e5f0; text-decoration: none; }

.sidebar-nav a.active { background: var(--blue); color: #fff; }

.page-main { min-width: 0; }

/* =========================================================
   BLOCS / CARTES
   ========================================================= */

.bo-card, .panel {
  margin-top: .8rem; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: .9rem;
}

.bo-card-title, .panel-title {
  margin: 0 0 .6rem; font-weight: 700; font-size: 1.25rem; text-align: center;
  color: var(--blue);
}

.card-title-left {
  margin: 0 0 .8rem; font-weight: 700; font-size: 1.05rem; color: var(--blue);
  text-align: left;
}

/* =========================================================
   BADGES / ETATS
   ========================================================= */

.badge {
  display: inline-block; padding: .25rem .6rem; border-radius: .6rem; font-weight: 700;
  border: 1px solid transparent;
}

.badge.success { background: #eaffef; color: #1b6c3b; border-color: #bfe7cb; }

.badge.warning { background: #fff7e6; color: #7a4e00; border-color: #ffd9a6; }

.badge.error { background: #ffe6e3; color: #7a1f11; border-color: #ffc9c2; }

.badge.info { background: #e8f1f8; color: var(--blue); border-color: #c9dceb; }
.badge.xs { padding: .15rem .45rem; border-radius: .45rem; font-size: .78rem; line-height: 1.15; }

/* =========================================================
   ZONES SPECIFIQUES MAYBULLETIN
   ========================================================= */

.upload-box { border: 2px dashed #cfd8e3; border-radius: 12px; padding: 1rem; background: #fbfdff; }

.file-info {
  margin-top: .7rem; padding: .7rem .9rem; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; font-weight: 600;
}

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }

.summary-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: .9rem; }

.summary-box .k { display: block; color: #6b7280; font-size: .92rem; margin-bottom: .3rem; }

.summary-box .v { display: block; font-size: 1.2rem; font-weight: 700; color: var(--blue); }

.preview-box {
  min-height: 420px; background: #fff; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}

.preview-box iframe, .preview-box object, .preview-box embed { width: 100%; min-height: 420px; border: 0; }

/* =========================================================
   DIALOG / MODALES
   ========================================================= */

.dlg-backdrop, .modal-backdrop, .hist-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 9999; }

.dlg, .hist-dialog {
  max-width: min(680px, 92vw); margin: 6vh auto; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column;
  overflow: hidden; position: relative; z-index: 10000;
}

/* ===== Modales MayPlanning / MayBulletin ===== */

.modal { position: fixed; inset: 0; display: none; z-index: 1000; }

.modal:target { display: block; }

/* Overlay */
.modal__overlay {
  position: absolute; inset: 0; background: rgba(17, 24, 39, 0.35); backdrop-filter: blur(2px) saturate(108%);
  -webkit-backdrop-filter: blur(2px) saturate(108%); z-index: 1;
}

/* Boîte centrée */
.modal__dialog {
  position: relative; margin: 6vh auto; padding: 0 .6rem; max-width: min(1050px, 96vw); min-width: 800px; 
  z-index: 2;
}

/* Panneau */
.modal__panel {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 15px 40px rgba(0, 0, 0, .18);
  overflow: hidden;
}

.modal__header {
  display: flex; align-items: center; justify-content: space-between; background: #f8fafc;
  padding: 10px 14px;
}

.modal__title { margin: 0; font-weight: 700; font-size: 1.05rem; color: #0b5ed7; }

.cal-popover-close {
  border: 0; background: transparent; color: var(--muted, #9aa6b2); font-size: 20px;
  font-weight: 700; line-height: 1; cursor: pointer; padding: 0 .25rem;
}
.cal-popover-close:hover { color: var(--blue, #005f9e); background: transparent; }

.modal__close {
  display: inline-block; text-decoration: none; border: 0; font-size: 1.4rem;
  line-height: 1; padding: 0 4px; cursor: pointer;
}

.modal__close:hover { color: var(--blue); }

.modal__body { padding: 12px 14px; max-height: 65vh; overflow: auto; -webkit-overflow-scrolling: touch; }

.modal__footer {
  display: flex; justify-content: flex-end; gap: 8px; background: #fafbfc;
  border-top: 1px solid #eef2f7; padding: 10px 14px;
}

.dlg-hd, .hist-hd {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .75rem 1rem; background: #f8fafc; border-bottom: 1px solid #eef2f7;
}

.dlg-hd, .hist-hd { font-weight: 600; color: #111827; }

.hist-hd h2 { margin: 0; }

.dlg-bd, .hist-bd { padding: 1rem; color: #111827; }

.hist-bd { max-height: 65vh; overflow: auto; }

.dlg-ft, .hist-ft {
  display: flex; gap: .5rem; justify-content: flex-end; padding: .75rem 1rem;
  background: #fafbfc; border-top: 1px solid #eef2f7;
}

.hist-close {
  background: transparent !important; color: #111827; display: inline-block; padding: 2px 6px;
  border: none; font-size: 22px; line-height: 1; cursor: pointer;
}

.hist-close:hover { color: var(--blue); }

.hist-btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: 8px 12px;
  border-radius: 10px; border: 1px solid #d1d5db; cursor: pointer;
}

.hist-btn:hover { background: var(--blue-dark); color: #fff; }

.hist-list { display: grid; gap: 8px; margin: 0; padding-left: 18px; }

.hist-empty { color: var(--muted, #6b7280); }

/* =========================================================
   SWITCHS — Harmonisation MayBulletin sur MayPlanning
   - Taille : 44 x 24
   - Rond : 20 x 20
   - Différenciation claire enabled / disabled
   ========================================================= */

.switch {
  position: relative; display: inline-block; width: 44px; min-width: 44px;
  height: 24px; flex: 0 0 44px; vertical-align: middle; cursor: pointer;
  margin-top: 0rem;
}

.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute; inset: 0; background: #e5e7eb; border: 1px solid #d0d7de;
  border-radius: 9999px; transition: background .2s, border-color .2s; cursor: pointer;
}

.switch-slider::before {
  content: ""; position: absolute; top: 1px; left: 2px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s, background .2s, box-shadow .2s;
}

/* ON + enabled */
.switch-input:checked + .switch-slider { background: var(--blue); border-color: var(--blue-dark); }

.switch-input:checked + .switch-slider::before { transform: translateX(20px); }

.switch-line {
  display: flex; align-items: center; gap: .6rem; margin-top: 1.1rem;
}

.switch-line .switch { margin: 0; }

.switch-line .label-text { margin: 0; line-height: 1; }

/* Disabled : attenuation coherente sur toute la ligne du switch */
.switch:has(.switch-input:disabled),
.switch:has(.switch-input:disabled) * { cursor: default; }

.switch-line:has(.switch-input:disabled) {
  opacity: .6;
  filter: grayscale(.4);
}

.label-text { color: #374151; font-weight: 500; }

/* =========================================================
   UTILITAIRES
   ========================================================= */

.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }


.muted { color: #64748b; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: .5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }

/* Onglets generiques reutilisables */
.ui-tabs {
  display: flex; align-items: center; gap: .8rem; border-top: 3px solid #d1d5db;
  border-bottom: 1px solid #d1d5db; margin: .9rem 0 0; padding: .95rem 0 0; overflow: hidden;
}

.ui-tab {
  position: relative; display: inline-flex; align-items: center; gap: .45rem;
  padding: .75rem .95rem .8rem; border-radius: 10px 10px 0 0; color: #0b2842; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}

.ui-tab:hover, .ui-tab.active { background: #eef6fc; color: var(--blue); }

.ui-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0;
  bottom: -1px; height: 3px; background: var(--blue);
}

.ui-tab-panel { padding-top: .8rem; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }

  .summary-grid, .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  /*    .row,
      .grid-2,
      .grid-3,
      .grid-4,
      .summary-grid {
        grid-template-columns: 1fr;
      }

      .topbar .menu-toggle {
        width: 100%;
      }

    .actions {
        flex-direction: column;
        align-items: stretch;
      }

      .actions .btn,
      .actions button {
        width: 100%;
      }*/
}
