@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');
@import url('components.css');

/* Roots */
:root {
  /* Colors */
  --color-primary: #C82876;
  --color-primary-light: #C487A5;
  --color-secondary: #361B6E;
  --color-secondary-light: #806AAD;
  --color-tertiary: #5329A8;
  --color-gray: #F5F5F5;
  --color-white: #FFFFFF;
  --color-quinary: #d0021b;

  /* Fonts */
  --font-family: 'Inter', 'Roboto', sans-serif;

  /* Font sizes */
  --small-size: 0.8rem;
  --medium-size: 1rem;
  --large-size: 1.2rem;
}

/* Global */
*,
::after,
::before {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  text-decoration: none;
  list-style: none;
}

a {
  text-decoration: none;
  color: var(--color-secondary);
}

ul {
  list-style: none;
}

html {
  font-size: clamp(14px, 2.5vw, 16px);
  font-family: var(--font-family);
  height: 100vh;
  width: auto;
  overflow-x: hidden;
}

body {
  width: 100%;
  height: 100%;
}



h1 {
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-secondary);
  font-family: var(--font-family);
  margin-bottom: 3rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-secondary);
  font-family: var(--font-family);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-secondary);
  font-family: var(--font-family);
  margin: 0;
}


.color-primary {
  color: var(--color-primary);
}

.color-secondary {
  color: var(--color-secondary);
}

.admin_account {
  background-color: var(--color-secondary);
  color: var(--color-white);
  padding: 5px 10px;
  border-radius: 8px;
}

/* .wrapper {
  width: 95%;
  margin: 0 auto;
  padding-block: 1rem;
} */

.wapper-flex-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

/* On met le parent en flexbox */
.main-container {
  display: flex;
  align-items: stretch;
  min-height: 100%;
  width: 100%;
}


/* L’aside à 30% de largeur */
.aside {
  position: relative;
  flex: 0 0 25%;
  max-width: 250px;
  background-color: #f5f5f5;
  padding: 1rem;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease, width 0.3s ease;
}

/* fermer / ouvrir */
.aside.closed {
  transform: translateX(-100%);
}

/* compact / normal */
.aside.reduced {
  max-width: 110px;
}

/*/ Logo */
.logo {
  width: 120px;
  margin-bottom: 2rem;
}

.logo.reduce {
  width: fit-content;
  height: auto;
  margin-bottom: 2rem;
}

.logo-img {
  width: 100%;
  height: auto;
  visibility: visible;
  pointer-events: all;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logo-img-reduced {
  max-width: 0;
  max-height: auto;
  visibility: hidden;
  pointer-events: none;
  cursor: none;
  transition: all 0.3s ease;
}

.aside.reduced .logo-img {
  max-width: 0;
  max-height: auto;
  visibility: hidden;
  pointer-events: none;
  cursor: none;
}

.aside.reduced .logo-img-reduced {
  max-width: 40px;
  visibility: visible;
  pointer-events: all;
  cursor: pointer;
  width: 100%;
  height: auto;
}

/* icons + scale */
.aside.reduced .nav_link .link_icon,
.aside.reduced .dropdown_link .link_icon {
  transform: scale(1.2);
}


/* Structure générale */
.navbar {
  width: 100%;
  display: block;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.nav_item {
  position: relative;
}

.nav_link,
.dropdown_toggle {
  min-width: 50px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  color: var(--color-secondary);
  background: none;
  transition: all .3s ease, color 0.3s ease;
}

.nav_link:hover,
.dropdown_toggle:hover,
.nav_link.active,
.dropdown_toggle.active {
  background: var(--color-primary);
  color: var(--color-white);
  padding: .5rem;
}

/* Dropdown arrow */
.dropdown_toggle::after {
  display: inline-block;
  margin-left: auto;
  margin-top: -2px;
  content: "\f054";
  /* Unicode for Font Awesome chevron-right */
  font-family: "Font Awesome 6 Free";
  /* Ensure Font Awesome is loaded */
  font-weight: 900;
  /* Use the solid style */
  transition: transform 0.3s ease;
  position: absolute;
  right: 1rem;
}

.dropdown_toggle.reduced::after {
  position: absolute;
  right: 0rem;

}


/* Menu caché */
.dropdown_menu {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-white);
  transition: max-height 0.5s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  margin-top: 5px;
}

.dropdown_menu li {
  width: 100%;
}

.dropdown_link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  transition: background 0.3s ease, color 0.3s ease;
  color: var(--color-secondary);
}

.dropdown_link:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.dropdown_link.active {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Quand on ajoute .open sur le LI */
.nav_item.dropdown.open>.dropdown_menu {
  max-height: 350px;
  /* doit être > hauteur totale du menu */
}

.nav_item.dropdown.open>.dropdown_toggle::after {
  transform: rotate(90deg);
}

.link_icon.reduced {
  margin-right: 0;
  display: block;
  text-align: center;
}

.link_icon {
  font-size: 1rem;
  color: var(--color-secondary);
  transition: all 0.3s ease;
}

.link_text {
  display: inline-block;
  max-width: fit-content;
  min-width: 50px;
  font-size: 1rem;
  color: var(--color-secondary);
  transition: all 0.3s ease;
  overflow-x: hidden;
}

.link_text.reduced {
  display: none;
}

.nav_link:hover .link_text,
.nav_link.active .link_text,
.nav_link:focus .link_text,
.dropdown_link.active .link_text,
.dropdown_link:hover .link_text,
.nav_link:hover .link_icon,
.nav_link.active .link_icon,
.dropdown_link:hover .link_icon,
.dropdown_link.active .link_icon,
.dropdown_toggle:hover .link_icon,
.dropdown_toggle.active .link_icon,
.dropdown_toggle:hover .link_text,
.dropdown_toggle.active .link_text {
  color: var(--color-white);
}

/* ---------- Aside Toogle button start ---------- */
/* Toggle button */
.aside_toggle {
  display: block;
  border: none;
  background: rgba(255, 255, 255, 0);
  color: var(--color-secondary);
  font-size: 1.5rem;
  position: absolute;
  top: 1rem;
  right: -2.25rem;
  cursor: pointer;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  transition: all 0.3s ease;
  z-index: 1000;
}

.aside_toggle::before {
  content: '\f0c9';
  /* Font Awesome icon */
}

.aside_toggle.open::before {
  content: '\f00d';
  color: var(--color-primary);
  /* Font Awesome icon */
}

/* ---------- Aside Toogle button end ---------- */

/* ---------- Aside Reduce button start ---------- */
.aside_reduce {
  display: block;
  border: none;
  background-color: transparent;
  color: var(--color-primary);
  font-size: 1.5rem;
  position: absolute;
  top: 1rem;
  right: .5rem;
  cursor: pointer;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  transition: all 0.3s ease;
}

.aside_reduce::before {
  content: '\f053';
  /* Font Awesome icon */
}

.aside_reduce.open::before {
  content: '\f054';
  /* Font Awesome icon */
  color: var(--color-secondary);


}

/* ---------- Aside Reduce button end ---------- */

/* ---------- Aside End ---------- */


/* ---------- Conetainer Start ---------- */

.version-text {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-secondary);
  font-family: var(--font-family);
}

/* Container */
.container {
  min-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem 3rem;
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.features-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.select-container {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 0px 1px 1px rgba(0, 0, 0, 0.1);
  background-color: var(--color-gray);
}

.select-header {
  border: none;
  outline: none;
  background-color: var(--color-gray);
  font-size: 1rem;
}

.select-header:focus {
  border: none;
  outline: none;
}

.select-container span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-secondary);
}

/* ---------- Container End ---------- */

/* ---------- Header right start ---------- */
.header_right {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}
/* ---------- Account start ---------- */
.account-container {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  margin-left: auto;
  gap: 0.5rem;

}

.init-name {
  font-size: 0.6rem;
  border: 1px solid var(--color-secondary);
  padding: 8px 5px;
  border-radius: 50%;
}

.init-btn {
  font-size: 1rem;
  border: none;
  background-color: white;
  transition: all 0.3s ease;
  color: var(--color-secondary);
}

/* même style que :hover */
.init-btn.rotate,
.init-btn:hover {
  background-color: var(--color-primary);
  color: white;
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 8px;
  padding: 5px 10px;
}

.account_dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 10;
  background-color: var(--color-white);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.account_dropdown.open {
  min-width: 200px;
  max-height: 200px;
  /* ajuster selon nombre d’items */
}



.account_list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 1rem;
}

.account_item {
  border-radius: 8px;
  padding: 5px 10px;
}

ul .account_link:hover {
  background-color: var(--color-primary);
  color: white;
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 8px;
  padding: 5px 10px;
}




/* *****  Custom Dropdown  ******   */
.custom_dropdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1);
  background-color: var(--color-gray);
  cursor: pointer;
  user-select: none;
}

/* Header: label + flèche */
.dropdown_header {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropdown_label {
  color: var(--color-secondary);
  font-size: 1rem;
}

.dropdown_arrow {
  transition: transform 0.3s ease;
}

/* Liste cachée par défaut */
.dropdown_list {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-white);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  z-index: 10;
}

/* Items */
.dropdown_item {
  padding: 0.75rem 1rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.dropdown_item:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.dropdown_item.selected {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Ouverture */
.custom_dropdown.open .dropdown_list {
  max-height: 200px;
  /* ajuster selon nombre d’items */
}

.custom_dropdown.open .dropdown_arrow {
  transform: rotate(-180deg);
}

/* Flat picker */
.date-range-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1);
  background-color: var(--color-gray);
  gap: 0.5rem;
}

.date-range-container label {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.date-range-container input {
  margin-top: -5px;
  color: var(--color-secondary);
  border: none;
  font-size: var(--small-size);
  cursor: pointer;
  background-color: var(--color-gray);
}

.date-range-container input:focus {
  outline: none;
}

/* ----- Main content start ----- */
.main {
  width: 100%;
  padding-block: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex: 1;
}


/* ----- Main content end ----- */

/* Footer start */
.footer {
  margin-top: auto;
  width: 100%;
  text-align: center;
  padding: 1rem;
}

/* Footer end */



/* ---------- Les Elements réutilisables ---------- */
.color-primary {
  color: var(--color-primary);
}

.capitalize {
  text-transform: capitalize;
}

/* ---------- 🎨 Styles Select2 ---------- */

/* Styles généraux du champ Select2 */
.select2-container .select2-selection {
  border: 1px solid var(--color-violet, #ced4da); /* Violet si défini, sinon gris Bootstrap */
  border-radius: 0.5rem;
  background-color: #fff;
  height: auto;
  padding: 4px 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Apparence lors de l'ouverture */
.select2-container--open .select2-selection {
  border: 2px solid #007bff;
}

/* Styles des tags/choix sélectionnés */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--color-rose, #f8d7da);
  border: none;
  color: var(--color-secondary, #333);
  padding: 5px 15px;
  margin-top: 4px;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Focus / Active state : effet Bootstrap */
.select2-container--default .select2-selection--multiple:focus,
.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--multiple:active,
.select2-container--default .select2-selection--single:active {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}


/* === ALERTS DROPDOWN STYLE === */

.alerts-container {
  position: relative;
  display: flex;
  align-items: center;
}

/* Bouton cloche */
.alert-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-dark, #333);
  font-size: 1.3rem;
  transition: color 0.2s ease;
}

.alert-btn:hover {
  color: var(--color-primary, #38726c);
}

/* Pastille de notification */
.alert-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background-color: var(--color-rose, #e74c3c);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 5px;
  min-width: 16px;
  height: 16px;
  line-height: 12px;
  text-align: center;
  display: inline-block;
}

/* Dropdown principal */
.alert-dropdown {
  position: absolute;
  right: 0;
  top: 120%;
  width: 320px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 100;
  animation: fadeIn 0.2s ease-in-out;
}

.alert-dropdown.hidden {
  display: none;
}

/* Header du dropdown */
.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-primary, #38726c);
  color: white;
  padding: 10px 15px;
  font-size: 0.95rem;
}

.mark-read-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.mark-read-btn:hover {
  opacity: 1;
}

/* Liste d’alertes */
#alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

/* Élément d’alerte */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}

.alert-item:hover {
  background: #f9f9f9;
}

/* Icône de type */
.alert-icon {
  font-size: 1.2rem;
  color: var(--color-secondary, #ffa500);
  flex-shrink: 0;
}

/* Contenu de l’alerte */
.alert-content {
  flex: 1;
}

.alert-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  margin: 0 0 3px 0;
}

.alert-date {
  font-size: 0.75rem;
  color: #888;
}

/* Différence visuelle entre lue/non lue */
.alert-item.unread {
  background: #eef9f6;
  border-left: 4px solid var(--color-primary, #38726c);
}

.alert-item.unread .alert-title {
  font-weight: 600;
}

/* Pied du dropdown */
.alert-footer {
  text-align: center;
  padding: 10px;
  background: #fafafa;
}

.alert-footer a {
  color: var(--color-primary, #38726c);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.alert-footer a:hover {
  text-decoration: underline;
}

/* Animation d’apparition */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar stylée */
#alert-list::-webkit-scrollbar {
  width: 6px;
}

#alert-list::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

#alert-list::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* === COULEURS PAR TYPE D’ALERTE === */

/* Documents (factures, fichiers, etc.) */
.alert-item[data-type="document"] .alert-icon {
  color: #4CAF50; /* vert */
}
.alert-item[data-type="document"].unread {
  border-left-color: #4CAF50;
  background: #f3faf3;
}

/* Visites (trafic, stats, visiteurs) */
.alert-item[data-type="visite"] .alert-icon {
  color: #3498DB; /* bleu */
}
.alert-item[data-type="visite"].unread {
  border-left-color: #3498DB;
  background: #f2f8fd;
}

/* Messages (formulaire de contact, support, etc.) */
.alert-item[data-type="message"] .alert-icon {
  color: #FF9800; /* orange */
}
.alert-item[data-type="message"].unread {
  border-left-color: #FF9800;
  background: #fff8ef;
}

/* Notifications administratives ou système */
.alert-item[data-type="system"] .alert-icon {
  color: #9C27B0; /* violet */
}
.alert-item[data-type="system"].unread {
  border-left-color: #9C27B0;
  background: #f8f2fc;
}

/* Autres / par défaut */
.alert-item[data-type="autre"] .alert-icon {
  color: #777; /* gris */
}
.alert-item[data-type="autre"].unread {
  border-left-color: #777;
  background: #f9f9f9;
}
