/************************************************/
/* CORE STYLE SHEET - CC17 TICKETS APPLICATION */
/* Incorporates all variables, button behaviors,*/
/* and styling rules from Resources/style.css    */
/************************************************/

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100vh;
}

/************************************************/
/* VARIABLES THEME CLAIR (DEFAULT) */
/************************************************/

:root {
  --fond-page: #f3f4f6;
  --fond-bloc: #ffffff;
  --texte: #1f2937;
  --texte-secondaire: #4b5563;
  --bordure: #e5e7eb;

  --champ-fond: #ffffff;
  --champ-texte: #111827;
  --champ-bordure: #cbd5e1;

  --couleur-consulter: #a7a7a7;
  --couleur-creer: #0262F0;
  --couleur-modifier: #E37630;
  --couleur-supprimer: #ef4444;
  --couleur-rechercher: #6C757D;
  --couleur-ok: #00B050;
  --couleur-annuler: #a7a7a7;
  --couleur-retour: #a7a7a7;
  --couleur-imprimer: #0DB7DB;

  --couleur-action: #0D6EFD;
  --couleur-autre: #7B7B7B;

  --couleur-primary: #0D6EFD;
  --couleur-secondary: #6C757D;
  --couleur-success: #198754;
  --couleur-danger: #DC3545;
  --couleur-warning: #FFC107;
  --couleur-info: #0dcaf09f;
  --couleur-dark: #212529;

  --sidebar-fond: #1e293b;
  --sidebar-texte: #cbd5e1;
  --sidebar-actif: #3b82f6;
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(229, 231, 235, 0.5);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/************************************************/
/* THEME SOMBRE */
/************************************************/

body.theme-sombre {
  --fond-page: #0f172a;
  --fond-bloc: #1e293b;
  --texte: #f8fafc;
  --texte-secondaire: #94a3b8;
  --bordure: #334155;

  --champ-fond: #334155;
  --champ-texte: #ffffff;
  --champ-bordure: #475569;

  --couleur-consulter: #64748b;
  --couleur-creer: #3b82f6;
  --couleur-modifier: #f97316;
  --couleur-supprimer: #ef4444;
  --couleur-rechercher: #64748b;
  --couleur-ok: #22c55e;
  --couleur-annuler: #64748b;
  --couleur-retour: #64748b;
  --couleur-imprimer: #06b6d4;

  --couleur-action: #3b82f6;
  --couleur-autre: #64748b;

  --couleur-primary: #3b82f6;
  --couleur-secondary: #64748b;
  --couleur-success: #22c55e;
  --couleur-danger: #ef4444;
  --couleur-warning: #eab308;
  --couleur-info: #06b6d4;
  --couleur-dark: #0f172a;

  --sidebar-fond: #0b0f19;
  --sidebar-texte: #94a3b8;
  --sidebar-actif: #3b82f6;
  
  --glass-bg: rgba(30, 41, 59, 0.8);
  --glass-border: rgba(51, 65, 85, 0.5);
}

/************************************************/
/* PAGE BASE */
/************************************************/

body {
  background: var(--fond-page);
  color: var(--texte);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--fond-page);
}
::-webkit-scrollbar-thumb {
  background: var(--bordure);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--couleur-secondary);
}

/************************************************/
/* LAYOUT STRUCTURE */
/************************************************/

.app-wrapper {
  display: flex;
  min-height: 100vh;
  flex-direction: row;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  background: var(--sidebar-fond);
  color: var(--sidebar-texte);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--bordure);
  transition: all 0.3s ease;
  z-index: 100;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.sidebar-menu {
  list-style: none;
  padding: 20px 12px;
  flex: 1;
}

.menu-item {
  margin-bottom: 6px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--sidebar-texte);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}

.menu-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.menu-item.active .menu-link {
  background: var(--sidebar-actif);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.menu-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--texte-secondaire);
  text-align: center;
}

/* Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

/* Header */
.app-header {
  height: 70px;
  background: var(--fond-bloc);
  border-bottom: 1px solid var(--bordure);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--fond-page);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--bordure);
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--couleur-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
}

.user-info-text {
  font-size: 13px;
  font-weight: 600;
}

.user-role-label {
  font-size: 11px;
  color: var(--texte-secondaire);
}

/* Application Views */
.app-content {
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/************************************************/
/* SIMULATOR BAR CONTROLS */
/************************************************/

.simulator-bar {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  z-index: 95;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.sim-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sim-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--texte-secondaire);
  letter-spacing: 0.5px;
}

.sim-select {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--champ-bordure);
  background: var(--champ-fond);
  color: var(--champ-texte);
  cursor: pointer;
  max-width: 200px;
}

.sim-input {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--champ-bordure);
  background: var(--champ-fond);
  color: var(--champ-texte);
  width: 120px;
  text-align: center;
}

.badge-mode {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.mode-dev {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.mode-prod {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.mode-lock {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/************************************************/
/* REUSABLE CARDS & MODULES */
/************************************************/

.bloc {
  background: var(--fond-bloc);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.bloc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--bordure);
  padding-bottom: 12px;
}

.bloc-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-6 {
    grid-template-columns: 1fr;
  }
}

/************************************************/
/* STANDARD BUTTONS */
/************************************************/

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  appearance: none;
  border: none;
  outline: none;
  padding: 8px 16px;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-width: 100px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Hover effects */
button:hover,
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: var(--shadow-md);
}

button:active,
.btn:active {
  transform: translateY(0);
  filter: brightness(0.92);
}

button:focus,
.btn:focus {
  outline: none;
}

button i,
.btn i {
  margin-right: 6px;
}

/* Colors for specific buttons */
.btn_creer { background-color: var(--couleur-creer) !important; }
.btn_consulter { background-color: var(--couleur-consulter) !important; }
.btn_modifier { background-color: var(--couleur-modifier) !important; }
.btn_supprimer { background-color: var(--couleur-supprimer) !important; }
.btn_rechercher { background-color: var(--couleur-rechercher) !important; }
.btn_ok { background-color: var(--couleur-ok) !important; }
.btn_annuler { background-color: var(--couleur-annuler) !important; }
.btn_retour { background-color: var(--couleur-retour) !important; }
.btn_imprimer { background-color: var(--couleur-imprimer) !important; }
.btn_sauvegarder { background-color: var(--couleur-action) !important; }
.btn_parametres { background-color: var(--couleur-autre) !important; }

/* Keep button background colors correct on hover/active */
.btn_creer:hover, .btn_creer:active { background-color: var(--couleur-creer) !important; }
.btn_consulter:hover, .btn_consulter:active { background-color: var(--couleur-consulter) !important; }
.btn_modifier:hover, .btn_modifier:active { background-color: var(--couleur-modifier) !important; }
.btn_supprimer:hover, .btn_supprimer:active { background-color: var(--couleur-supprimer) !important; }
.btn_rechercher:hover, .btn_rechercher:active { background-color: var(--couleur-rechercher) !important; }
.btn_ok:hover, .btn_ok:active { background-color: var(--couleur-ok) !important; }
.btn_annuler:hover, .btn_annuler:active { background-color: var(--couleur-annuler) !important; }
.btn_retour:hover, .btn_retour:active { background-color: var(--couleur-retour) !important; }
.btn_imprimer:hover, .btn_imprimer:active { background-color: var(--couleur-imprimer) !important; }
.btn_sauvegarder:hover, .btn_sauvegarder:active { background-color: var(--couleur-action) !important; }
.btn_parametres:hover, .btn_parametres:active { background-color: var(--couleur-autre) !important; }

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

.ligne {
  margin-bottom: 18px;
}

.champ_lbl {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--texte);
}

.champ_txt,
.champ_date,
.champ_heure,
.champ_nombre,
.champ_prix,
.champ_combo,
.champ_textearea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--champ-bordure);
  background: var(--champ-fond);
  color: var(--champ-texte);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.champ_txt:focus,
.champ_date:focus,
.champ_heure:focus,
.champ_nombre:focus,
.champ_prix:focus,
.champ_combo:focus,
.champ_textearea:focus {
  border-color: var(--couleur-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.champ_textearea {
  min-height: 120px;
  resize: vertical;
}

.champ-radio-group {
  display: flex;
  gap: 16px;
  padding: 8px 0;
}

.champ-radio-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--champ-fond);
  color: var(--champ-texte);
  border: 1px solid var(--bordure);
  border-radius: 4px;
}

.autocomplete-list {
  position: absolute;
  z-index: 9999;
  background: var(--fond-bloc);
  border: 1px solid var(--bordure);
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  display: none;
  border-radius: 4px;
}

.autocomplete-list div {
  padding: 8px;
  cursor: pointer;
  font-size: var(--table-font-size, 13px);
  border-bottom: 1px solid var(--bordure);
  color: var(--texte);
}

.autocomplete-list div:last-child {
  border-bottom: 0;
}

.autocomplete-list div:hover {
  background: var(--couleur-primary);
  color: white;
}

.appointment-modal .modal-content {
  font-size: 12px;
}

.appointment-modal .modal-body {
  padding-top: 14px;
}

.appointment-modal .ligne {
  margin-bottom: 10px;
}

.appointment-modal .champ_lbl {
  font-size: 11px;
  margin-bottom: 4px;
}

.appointment-modal .champ_txt,
.appointment-modal .champ_combo,
.appointment-modal .champ_textearea,
.appointment-modal .champ_nombre {
  font-size: 12px;
  padding: 7px 9px;
}

.appointment-modal .champ_textearea {
  min-height: 72px;
}

.appointment-related-zone {
  background: var(--fond-page);
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--couleur-primary);
  border-radius: 8px;
  padding: 12px 14px 4px;
  margin: 12px 0;
}

body.theme-sombre .appointment-related-zone {
  background: rgba(255, 255, 255, 0.04);
}

.appointment-date-row {
  display: grid;
  grid-template-columns: 1fr 0.9fr 1.1fr;
  gap: 12px;
  align-items: end;
}

.appointment-date-row input[type="date"],
.appointment-date-row input[type="time"] {
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
}

.vacation-duration-grid {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.vacation-duration-field {
  display: flex;
  align-items: center;
  background: var(--champ-fond);
  border: 1px solid var(--champ-bordure);
  border-radius: 6px;
  padding: 0 8px;
  height: 31px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vacation-duration-field:focus-within {
  border-color: var(--couleur-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.vacation-duration-field input[type="number"] {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 2px 0 0 !important;
  font-size: 12px;
  font-weight: 600;
  color: var(--champ-texte);
  text-align: center;
  outline: none;
}

.vacation-duration-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--texte-secondaire);
  margin-left: 3px;
  user-select: none;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .appointment-date-row {
    grid-template-columns: 1fr;
  }
}

/************************************************/
/* TABLES */
/************************************************/

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  margin-top: 10px;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.custom-table th {
  background: var(--fond-page);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--texte-secondaire);
  border-bottom: 1px solid var(--bordure);
}

.custom-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bordure);
  color: var(--texte);
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

.custom-table tbody tr:hover td {
  background: rgba(13, 110, 253, 0.03);
}

/************************************************/
/* DASHBOARD KPI CARDS */
/************************************************/

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--fond-bloc);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.kpi-details h3 {
  font-size: 13px;
  color: var(--texte-secondaire);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-details .value {
  font-size: 24px;
  font-weight: 700;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.kpi-icon.primary { background: rgba(13, 110, 253, 0.1); color: var(--couleur-primary); }
.kpi-icon.success { background: rgba(34, 197, 94, 0.1); color: var(--couleur-success); }
.kpi-icon.warning { background: rgba(234, 179, 8, 0.1); color: var(--couleur-warning); }
.kpi-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--couleur-danger); }

/* Alert Box */
.alert-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert-message {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
}

/************************************************/
/* TICKET STEPPER TIMELINE */
/************************************************/

.stepper-wrapper {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 30px 0;
  padding: 0 10px;
}

.stepper-wrapper::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--bordure);
  z-index: 1;
}

.stepper-progress {
  position: absolute;
  top: 15px;
  left: 0;
  height: 4px;
  background: var(--couleur-primary);
  z-index: 1;
  transition: width 0.3s ease;
}

.step-item {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
}

.step-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--fond-page);
  border: 3px solid var(--bordure);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--texte-secondaire);
  transition: all 0.3s ease;
}

.step-label {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--texte-secondaire);
  text-align: center;
}

.step-item.active .step-circle {
  border-color: var(--couleur-primary);
  color: var(--couleur-primary);
}

.step-item.completed .step-circle {
  background: var(--couleur-primary);
  border-color: var(--couleur-primary);
  color: #ffffff;
}

.step-item.completed .step-label {
  color: var(--texte);
}

.step-item.cancelled .step-circle {
  background: var(--couleur-danger);
  border-color: var(--couleur-danger);
  color: #ffffff;
}

/************************************************/
/* PLANNING CALENDAR */
/************************************************/

.calendar-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bordure);
  gap: 1px;
}

.calendar-day-header {
  background: var(--fond-page);
  padding: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--texte-secondaire);
}

.calendar-cell {
  background: var(--fond-bloc);
  min-height: 120px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-cell.other-month {
  opacity: 0.4;
}

.calendar-cell-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--texte-secondaire);
  align-self: flex-end;
}

.calendar-event {
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  flex-direction: column;
}

/* Event color styling based on Planning Type */
.event-atelier { background-color: #3b82f6; } /* Dépannage Atelier */
.event-site { background-color: #f59e0b; } /* Intervention Site */
.event-tele { background-color: #06b6d4; } /* Télémaintenance */
.event-perso { background-color: #8b5cf6; } /* Perso */
.event-compta { background-color: #10b981; } /* Compta */
.event-admin { background-color: #64748b; } /* Administratif */

/************************************************/
/* POPUPS & MODALS */
/************************************************/

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-content {
  background: var(--fond-bloc);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalEnter 0.2s ease-out;
}

.modal-content.modal-large {
  max-width: 900px;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--bordure);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--bordure);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.close-btn {
  background: none !important;
  color: var(--texte-secondaire) !important;
  font-size: 20px;
  min-width: auto !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/************************************************/
/* UTILITIES & BADGES */
/************************************************/

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-low { background: rgba(100, 116, 139, 0.15); color: #64748b; }
.badge-medium { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-high { background: rgba(249, 115, 22, 0.15); color: #ea580c; }
.badge-critical { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

/* Status Badges */
.status-1 { background: rgba(14, 165, 233, 0.15); color: #0284c7; } /* Créé */
.status-2 { background: rgba(99, 102, 241, 0.15); color: #4f46e5; } /* Planifié */
.status-3 { background: rgba(100, 116, 139, 0.15); color: #475569; } /* Annulé */
.status-4 { background: rgba(34, 197, 94, 0.15); color: #16a34a; } /* Terminé */
.status-5 { background: rgba(245, 158, 11, 0.15); color: #d97706; } /* En cours */
.status-6 { background: rgba(236, 72, 153, 0.15); color: #db2777; } /* Facturé */
.status-7 { background: rgba(168, 85, 247, 0.15); color: #9333ea; } /* Sous contrat */
.status-8 { background: rgba(20, 184, 166, 0.15); color: #0d9488; } /* Validé */

/* Quick login grid */
.quick-login-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.quick-login-card {
  background: var(--fond-page);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-login-card:hover {
  border-color: var(--couleur-primary);
  background: rgba(13, 110, 253, 0.05);
  transform: translateY(-1px);
}

.quick-login-card h4 {
  font-size: 12px;
  margin-bottom: 2px;
}

.quick-login-card p {
  font-size: 10px;
  color: var(--texte-secondaire);
}

.notification-badge {
  background: var(--couleur-danger);
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

/* responsive sidebar collapser */
.app-sidebar {
  transition: margin-left 0.3s ease, transform 0.3s ease !important;
}

/* Desktop Collapse styling */
body.sidebar-collapsed .app-sidebar {
  margin-left: -260px;
}

/* Sidebar Toggle Burger Button style */
.sidebar-toggle-btn {
  background: none !important;
  color: var(--texte) !important;
  border: none !important;
  box-shadow: none !important;
  min-width: auto !important;
  font-size: 20px;
  cursor: pointer;
  padding: 8px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}
.sidebar-toggle-btn:hover {
  background: var(--fond-page) !important;
  border-radius: 6px;
  transform: none !important;
}

/* Mobile responsive override */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    z-index: 1000;
    transform: translateX(-100%);
    margin-left: 0 !important; /* override desktop collapse margin */
    box-shadow: none;
  }

  .app-sidebar .sidebar-menu {
    flex: 0 0 auto !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  .app-sidebar .sidebar-footer {
    margin-top: 44px !important;
    padding: 14px 15px 24px 15px !important;
    flex-shrink: 0;
  }
  
  /* When active on mobile */
  body.sidebar-active .app-sidebar {
    transform: translateX(0);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.15);
  }
  
  /* Overlay background */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(1px);
    z-index: 999;
  }
  
  body.sidebar-active .sidebar-overlay {
    display: block;
  }
}

/* Page header left toggle visibility rules */
.app-header .header-left {
  display: none !important;
}

body.sidebar-collapsed .app-header .header-left {
  display: flex !important;
}

@media (max-width: 768px) {
  .app-header .header-left {
    display: flex !important;
  }
}



.app-content-full {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 12px 12px 16px !important;
}

#headerUserRole {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 11px !important;
  margin-top: 2px !important;
}

/* Boutons d'icône carrés 26x26px centrés */
.btn-icon {
  width: 26px !important;
  height: 26px !important;
  min-width: auto !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center !important;
  justify-content: center !important;
}

.btn-icon i {
  margin-right: 0 !important;
  margin-left: 0 !important;
  font-size: 11px !important;
}

/* Badges d'accès et séparation visuelle de mode */
.sidebar-mode-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: background-color 0.2s ease;
}

.badge-mode-office {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-mode-external {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
