/* ============================================================
   SHELL.CSS — Layout partagé toutes les pages PWA
   Sidebar desktop / App bar / Bottom bar
   ============================================================ */

:root {
  --bottom-h:  72px;
  --sidebar-w: 260px;
  --appbar-h:  56px;
}

/* ── Reset shell ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ════════════════════════════════════════════════════════
   DESKTOP ≥ 1024px
════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  body { background: #eef0f6; }

  .app-shell {
    flex-direction: row;
  }

  .sidebar {
    display: flex !important;
    width: var(--sidebar-w);
    flex-shrink: 0;
    flex-direction: column;
    background: var(--surf);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    overflow-y: auto;
  }

  .main-wrapper {
    margin-left: var(--sidebar-w);
  }

  .bottom-bar    { display: none !important; }
  .ab-brand      { display: none !important; }
  .ab-back       { display: none !important; }
  .ab-page-title { display: block !important; }
}

/* ════════════════════════════════════════════════════════
   SIDEBAR (masquée mobile)
════════════════════════════════════════════════════════ */
.sidebar { display: none; }

.sb-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sb-logo-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--p-d), var(--p));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.sb-logo-name { font-size: 15px; font-weight: 900; color: var(--text); }
.sb-logo-sub  { font-size: 11px; color: var(--muted); }

.sb-nav {
  flex: 1; padding: 16px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-sm);
  cursor: pointer; transition: all .18s;
  color: var(--muted); font-size: 14px; font-weight: 600;
  border: none; background: none;
  font-family: 'Nunito', sans-serif;
  width: 100%; text-align: left;
}
.sb-item i      { font-size: 20px; flex-shrink: 0; }
.sb-item:hover  { background: var(--p-l); color: var(--p); }
.sb-item.active { background: var(--p-l); color: var(--p); font-weight: 800; }
.sb-notif {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 20px;
}

.sb-profile {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sb-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--p); color: #fff;
  font-size: 14px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.sb-profile-name  { font-size: 13px; font-weight: 700; color: var(--text); }
.sb-profile-phone { font-size: 11px; color: var(--muted); }

/* ════════════════════════════════════════════════════════
   MAIN WRAPPER
════════════════════════════════════════════════════════ */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ════════════════════════════════════════════════════════
   APP BAR
════════════════════════════════════════════════════════ */
.app-bar {
  height: var(--appbar-h);
  background: var(--surf);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 50;
  gap: 10px;
}

.ab-left {
  display: flex; align-items: center; gap: 8px;
}
.ab-back {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text); transition: all .15s; flex-shrink: 0;
}
.ab-back:hover  { background: var(--p-l); color: var(--p); }

.ab-brand {
  display: flex; align-items: center; gap: 8px;
}
.ab-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--p-d), var(--p));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
}
.ab-name { font-size: 15px; font-weight: 900; color: var(--text); }

/* Titre de page (desktop) */
.ab-page-title {
  display: none;
  font-size: 18px; font-weight: 900; color: var(--text);
  flex: 1;
}

.ab-actions {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.ab-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--bg);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text); position: relative; transition: all .15s;
}
.ab-btn:hover { background: var(--p-l); color: var(--p); }
.ab-notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surf);
}

/* ════════════════════════════════════════════════════════
   PAGE CONTENT
════════════════════════════════════════════════════════ */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px calc(var(--bottom-h) + 20px);
}
@media (min-width: 1024px) {
  .page-content { padding: 32px 36px 40px; }
}

/* ════════════════════════════════════════════════════════
   BOTTOM BAR
════════════════════════════════════════════════════════ */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: var(--surf); border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(64,81,137,.07);
}

.bb-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; cursor: pointer;
  font-family: 'Nunito', sans-serif; padding: 6px 2px;
  position: relative; transition: all .18s; min-width: 0;
}
.bb-item i    { font-size: 22px; color: var(--muted); transition: color .18s; }
.bb-item span { font-size: 10px; font-weight: 600; color: var(--muted); transition: color .18s; white-space: nowrap; }
.bb-item.active i    { color: var(--p); }
.bb-item.active span { color: var(--p); font-weight: 800; }
.bb-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--p); border-radius: 0 0 4px 4px;
}

.bb-fab-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.bb-fab {
  width: 50px; height: 50px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--p), #3577f1);
  box-shadow: 0 4px 16px rgba(64,81,137,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; cursor: pointer;
  transition: all .22s; margin-bottom: 4px;
}
.bb-fab:hover  { transform: scale(1.09); box-shadow: 0 6px 22px rgba(64,81,137,.5); }
.bb-fab:active { transform: scale(.94); }

/* ════════════════════════════════════════════════════════
   COMPOSANTS COMMUNS (réutilisés sur toutes les pages)
════════════════════════════════════════════════════════ */

/* Section label */
.section-label {
  font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 10px 0 8px; margin-top: 4px;
}

/* Page title mobile */
.page-title { font-size: 22px; font-weight: 900; color: var(--text); margin-bottom: 4px; }
.page-sub   { font-size: 14px; color: var(--muted); margin-bottom: 22px; }

/* Form field */
.f-group  { margin-bottom: 18px; }
.f-label  { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: .4px; }
.f-label .req { color: var(--danger); margin-left: 2px; }
.f-label .opt { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 4px; }

.f-input {
  width: 100%; height: 50px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text);
  font-size: 15px; font-family: 'Nunito', sans-serif; font-weight: 500;
  padding: 0 16px; transition: all .2s;
}
.f-input:focus { outline: none; border-color: var(--p); background: #fff; box-shadow: 0 0 0 3px var(--p-l); }
.f-input::placeholder { color: var(--muted); }
.f-input.err   { border-color: var(--danger); background: rgba(240,101,72,.03); }
textarea.f-input  { height: 120px; padding: 14px 16px; resize: none; line-height: 1.6; }
select.f-input    { cursor: pointer; }

.f-input-wrap { position: relative; }
.f-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--muted); pointer-events: none; }
.f-input-wrap .f-input { padding-left: 44px; }
.f-input-suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--muted); pointer-events: none; }
.f-input-wrap .f-input.has-sfx { padding-right: 56px; }

.f-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.f-err  { font-size: 12px; color: var(--danger); margin-top: 5px; display: none; }
.f-err.show { display: block; }

/* Btn principal */
.btn-main {
  width: 100%; height: 52px; border: none; border-radius: var(--r-sm);
  background: var(--p); color: #fff;
  font-size: 15px; font-weight: 800; font-family: 'Nunito', sans-serif;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-main:hover { background: var(--p-d); box-shadow: 0 4px 16px rgba(64,81,137,.3); }
.btn-main:active { transform: scale(.98); }

.btn-outline {
  width: 100%; height: 52px; border: 1.5px solid var(--p); border-radius: var(--r-sm);
  background: transparent; color: var(--p);
  font-size: 15px; font-weight: 700; font-family: 'Nunito', sans-serif;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-outline:hover { background: var(--p-l); }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 52px 20px; text-align: center; color: var(--muted); }
.empty-state i { font-size: 52px; opacity: .2; margin-bottom: 14px; }
.es-title { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.es-sub   { font-size: 14px; color: var(--muted); }

/* Spinner bouton */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}