/* ============================================================
   Remote Control — CSS v3.0 — Mobile-First
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --rc-sidebar-width: 240px;
  --rc-topbar-height: 56px;
  --rc-bottom-nav:    60px;
  --rc-primary:  #0d6efd;
  --rc-dark:     #1e293b;
  --rc-gray:     #64748b;
}

/* ── Reset & base ───────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  background-color: #f1f5f9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

/* ════════════════════════════════════════════════════════════
   LAYOUT DESKTOP (≥ 768px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  #sidebar {
    width: var(--rc-sidebar-width);
    min-height: 100vh;
    background-color: #1e293b;
    position: sticky;
    top: 0;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.25s ease;
  }

  #wrapper { display: flex; }
  #page-content { flex: 1; min-width: 0; overflow-x: hidden; }

  #wrapper.sidebar-hidden #sidebar {
    width: 0;
    overflow: hidden;
    padding: 0 !important;
  }

  .rc-bottom-nav { display: none !important; }
}

/* ════════════════════════════════════════════════════════════
   LAYOUT MOBILE (< 768px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* Sidebar : tiroir latéral masqué par défaut */
  #sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--rc-sidebar-width);
    background-color: #1e293b;
    z-index: 1050;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  /* Fond semi-transparent derrière la sidebar ouverte */
  #sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
  }
  #sidebar-backdrop.show { display: block; }

  /* Contenu plein écran */
  #page-content { width: 100%; min-width: 0; overflow-x: hidden; }
  #wrapper { display: block; }

  /* Espace pour la barre de navigation bas (employé) */
  .employee-layout #page-content {
    padding-bottom: calc(var(--rc-bottom-nav) + 8px);
  }

  /* Contenu intérieur : padding réduit */
  #page-content > .p-4 { padding: 0.75rem !important; }

  /* Topbar compacte */
  .topbar { padding: 0 0.75rem !important; }
  .topbar .ms-auto { display: none !important; }

  /* Cacher le toggle sidebar desktop dans la topbar si nécessaire */
  #sidebarToggle { display: inline-flex; }

  /* Cards : padding réduit */
  .card-body.p-4 { padding: 1rem !important; }
  .card-body.p-3 { padding: 0.75rem !important; }

  /* KPI cards : compacter */
  .card-body .fs-3 { font-size: 1.4rem !important; }
  .card-body .fs-4 { font-size: 1.2rem !important; }

  /* Tables : font réduite */
  .table { font-size: 0.82rem; }
  .table th, .table td { padding: 0.5rem 0.4rem !important; }

  /* Boutons action dans les tables : icône seulement */
  .btn-table-label { display: none; }

  /* Formulaires : champs pleine largeur */
  .input-group > .form-control,
  .input-group > .form-select { min-width: 0; }

  /* Alertes : padding réduit */
  .alert { padding: 0.6rem 0.85rem; font-size: 0.85rem; }

  /* Supprimer les sauts de ligne inutiles */
  .d-flex.gap-3 { gap: 0.5rem !important; }

  /* Avatar circle plus petit */
  .avatar-circle { width: 30px; height: 30px; font-size: 0.75rem; }
}

/* ════════════════════════════════════════════════════════════
   BARRE DE NAVIGATION BAS — EMPLOYÉ (mobile only)
   ════════════════════════════════════════════════════════════ */
.rc-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--rc-bottom-nav);
  background: #1e293b;
  display: flex;
  align-items: stretch;
  z-index: 1030;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.rc-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  gap: 2px;
  transition: color .15s, background .15s;
  border-radius: 0;
  padding: 0 4px;
}

.rc-bottom-nav a i { font-size: 1.25rem; line-height: 1; }
.rc-bottom-nav a.active,
.rc-bottom-nav a:active { color: #fff; background: rgba(255,255,255,.08); }
.rc-bottom-nav a.active i { color: var(--rc-primary); }

/* ════════════════════════════════════════════════════════════
   SIDEBAR COMMUNE
   ════════════════════════════════════════════════════════════ */
#sidebar .nav-link {
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: background 0.15s;
}
#sidebar .nav-link:hover  { background: rgba(255,255,255,.08); }
#sidebar .nav-link.active { background: var(--rc-primary) !important; font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════ */
.topbar {
  height: var(--rc-topbar-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ════════════════════════════════════════════════════════════
   COMPOSANTS
   ════════════════════════════════════════════════════════════ */
.card  { border-radius: 12px !important; }
.btn   { border-radius: 8px; }
.badge { font-weight: 500; font-size: 0.75rem; padding: 0.35em 0.65em; border-radius: 6px; }

.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
}

.progress { border-radius: 8px; }

.hover-lift { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.09) !important; }

.table > :not(caption) > * > * { padding: 0.7rem 0.5rem; }

.auth-page { background: linear-gradient(135deg, #0d6efd15, #6ea8fe25); }

/* ── Page connexion — centrage parfait sur mobile ─────────────── */
.auth-page .card { max-width: 420px; width: 100%; margin: 1rem; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ════════════════════════════════════════════════════════════
   SUPER ADMIN
   ════════════════════════════════════════════════════════════ */
.superadmin-layout #sidebar {
  background: linear-gradient(180deg,#0f172a 0%,#1e1b4b 100%) !important;
  border-right: 2px solid rgba(245,158,11,.25);
}
.superadmin-layout #sidebar .nav-link.active {
  background: linear-gradient(90deg,#f59e0b22,#ef444422);
  border-left: 3px solid #f59e0b;
}
.btn-xs { padding:.12rem .45rem; font-size:.75rem; border-radius:4px; line-height:1.4; }
code.text-dark { background:#f8f9fa; padding:.1em .35em; border-radius:4px; font-size:.8em; }
.alert.alert-warning.rounded-0 { position:sticky; top:0; z-index:1020; }

/* ════════════════════════════════════════════════════════════
   POINTAGE EMPLOYÉ — Bouton Hero mobile
   ════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .checkin-hero {
    padding: 1.5rem 1rem 1.25rem;
  }
  .checkin-hero .btn-lg {
    padding: 0.9rem 1.5rem;
    font-size: 1.05rem;
    border-radius: 14px;
  }
  /* Status bar sticky en haut sur mobile */
  .employee-status-bar {
    position: sticky;
    top: var(--rc-topbar-height);
    z-index: 90;
    border-radius: 0 !important;
  }
}

/* ════════════════════════════════════════════════════════════
   TABLES RESPONSIVE — colonnes optionnelles
   ════════════════════════════════════════════════════════════ */
@media (max-width: 575px) {
  .col-hide-xs  { display: none !important; }
}
@media (max-width: 767px) {
  .col-hide-sm  { display: none !important; }
}
