/* === Variables globales === */
:root {
  --bg-main: #0f1113;
  --bg-sidebar: #161718;
  --color-primary: #3b82f6;
  --color-accent: #bb86fc;
  --color-text: #e0e0e0;
  --color-muted: #9ea3a6;
  --color-surface: #1b1c1d;
  --color-danger: #cf6679;
  --color-success: #03dac6;
  --color-warning: #fbc02d;
  --color-hover: #2a2a2a;
  --color-tech: #2e7d32;
  --color-appli: #f57c00;
  --color-count: #a3c2d4;
  --font-main: "Inter", sans-serif;
  --font-logo: "Orbitron", cursive;
  --font-alt: "Roboto", sans-serif;
  --radius:12px;
}

/* ============ */
/* === Base === */
/* ============ */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* empêche le scroll global */
}

body {
	padding:0;
	font-family: var(--font-main);
	background:var(--bg-main);
	color:var(--color-text);
	-webkit-font-smoothing:antialiased;
}

/* === Titres uniformisés === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  margin: 0;
}



/* ========================== */
/* === Barre de recherche === */
/* ========================== */
.search-bar {
  display: flex;
  justify-content: center;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
}

.search-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: none;
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.8rem;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 1.2rem;
}


/* =============================== */
/* === home et pages similaires == */
/* =============================== */
.logo-text {
  font-size: 3rem;
  font-family: var(--font-logo);
}

.home-logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;  
}

.home-logo img {
  max-width: 60px;
  border-radius: 50%;
}

/* === Home centré === */
.home-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 2rem;
  overflow: hidden;
}

/* === Grille des cards principales === */
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 800px;
}

.home-cards .card {
  padding: 2rem 1rem;
}

.home-cards .card span {
  font-size: 2.2rem;
}

.home-cards h2 {
	font-size: 0.9rem;
}


/* ===================================== */
/* === Pages génériques avec sidebar === */
/* ===================================== */
.layout {
	display:flex;
	gap:24px;
	height:100vh;
	padding:1.5rem;
	box-sizing:border-box;
	overflow: hidden;
}

.main-content {
  flex-grow: 1;
  padding: 0.1rem 0.6rem 0.1rem 0.1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
}

/* === Sidebar === */
.sidebar{
	width:300px;
	flex:0 0 300px;
	background:var(--bg-sidebar);
	border-radius:var(--radius);
	padding:18px;
	box-shadow:0 6px 18px rgba(0,0,0,0.6);
	display:flex;
	flex-direction:column;
	gap:14px;
	overflow-y: auto;
	overflow-x: hidden;
	
}

/* logo de la side bar */
.logo-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.logo-block img {
  max-width: 25px;
  border-radius: 50%;
}

.logo-block .logo-text {
  font-family: var(--font-logo);
  font-size: 1.5rem;
  color: var(--color-text);
}

/* Bloc utilisateur */
.user-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg,var(--color-primary),var(--color-accent));
  color: white;
  font-weight: bold;
  font-size: 1.3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
}

.username-link {
  text-decoration: none;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}

.username-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.username {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text);
  padding: 4px 8px;
  display: inline-block;
}

.role-badge {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius);
  color: white;
  width: fit-content;
}

.role-badge.user{
	background-color: var(--color-primary);
}

.role-badge.admin{
	background-color: var(--color-danger);
}


/* === Sidebar toggle === */
.sidebar-toggle {
  display: none; /* caché en desktop */
  position: fixed;
  top: 1.5rem;
  left: auto;
  right: 1.5rem;
  background-color: var(--color-primary); 
  border: none;
  border-radius: 50%;   
  width: 48px;          
  height: 48px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
  z-index: 2000; /* au-dessus de la sidebar */
}

/* === Liste des sites === */
.site-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding-right: 8px;
  max-height: calc(100vh - 300px); /* ajuste selon la hauteur du logo + user */
  overflow-y: auto;
  overflow-x: hidden;
}

.site-list::-webkit-scrollbar {
  width: 8px;
  background-color: transparent;
}

.site-list::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.site-list::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 4px;
}

.site-list::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}

.site-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.site-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.site-list li {
  margin-bottom: 0.4rem;
}

.site-toggle {
  width: 100%;
  background-color: transparent;
  color: var(--color-text);
  border: none;
  padding: 0.6rem 0rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}

.site-toggle:hover,
.site-toggle:focus,
.site-toggle.active {
  background-color: var(--color-hover);
}

.site-list li a {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  justify-content: space-between;
  width: 100%;
  padding: 0.3rem 0.1rem;
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.site-list li a:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.dept-circle {
  background-color: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 400;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 0.1rem;
}

.site-name {
  font-size: 0.9rem;
  font-weight: 400;
  flex-grow: 1;
  padding-left: 0.3rem;
}



/* ======================== */
/* === Scrollbar sombre === */
/* ======================== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}


/* =================== */
/* === Inputs & Co === */
/* =================== */
input, textarea {
  width: 100%;
  font-size: 1rem;
  padding: 0.4rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.2);
  background-color: var(--bg-sidebar);
  color: var(--color-text);
  box-sizing: border-box;
}

select{
	width: 100%;
	  font-size: 1rem;
	  padding: 0.4rem;
	  border: none;
	  background-color: var(--bg-main);
	  color: var(--color-text);
}

/* === Groupes input avec icône === */
/* === dans login et formulaire === */
.input-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--bg-main);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}

.input-group span {
  color: var(--color-muted);
  font-size: 1.2rem;
}

.input-group input {
  flex-grow: 1;
  border: none;
  background: transparent;
  outline: none;
}

.input-group:focus-within {
  border: 1px solid var(--color-muted);
  box-shadow: 0 0 0 1px var(--color-muted);
}

/* =============== */
/* === Boutons === */
/* =============== */
.btn {
  background-color: var(--color-surface);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease;
}

.btn.success { color: var(--color-success); }
.btn.cancel { color: var(--color-danger); }

.btn.primary { /* bouton bleu comme celui du login */
  background-color: var(--color-primary);
  font-weight: 700;
  color: white;
}

.btn.primary:hover {
  background-color: #2563eb;
}

/* Bouton de logout dans les card et task-bar*/
.logout-form {
  all: unset;
  display: contents;
}

button.card {
  all: unset;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 0 0 1px #2c2c2c;
  text-decoration: none;
  color: var(--color-text);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

button.card:hover {
  transform: translateY(-4px);
  background-color: var(--color-hover);
}

/* === Bouton d'actions dans les cards (changelog edit/delet, ... ) === */
.actions-icons {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-end; /* ✅ aligné à droite */
  gap: 0.6rem;
}

.action-btn {
  background-color: var(--color-surface);
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  padding: 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.action-btn span.material-symbols-outlined {
  font-size: 1.2rem;
}

.action-btn.edit span {
  color: var(--color-text); 
}

.action-btn.delete span {
  color: var(--color-danger); 
}

.action-btn:hover {
  background-color: var(--color-hover);
}

.delete-form {
  all: unset;
  display: inline-block;
}



/* ============= */
/* === Cards === */
/* ============= */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 0 0 1px #2c2c2c;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  background-color: var(--color-hover);
}





/* ================ */
/* === Task-bar === */
/* ================ */
.task-bar {
  display: flex;
  background-color: var(--color-surface);
  border-radius: var(--radius);
  
}

/* Par défaut : version longue */
.task-bar .task-item .label-short { display: none; }

.task-bar ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
}

.task-bar .task-item a,
.task-bar .task-item button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: none;      /* neutralise le style natif du bouton */
  cursor: pointer;
}

.task-bar .task-item a:hover,
.task-bar .task-item button:hover {
  background-color: var(--color-hover);
}

.task-bar .task-item button {
  font: inherit;
  margin: 0;
  line-height: normal;
}

.task-icon-back {
  color: var(--color-danger);
}

.task-icon-add {
  color: var(--color-success);
}


/* =================================================== */
/* === Tableaux génériques (Sites, Serveurs, etc.) === */
/* =================================================== */
.table-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  background-color: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px #2c2c2c;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  color: var(--color-text);
}

thead {
  background-color: var(--bg-sidebar);
}

thead th {
  text-align: left;
  padding: 0.8rem 1rem;
  font-weight: 500;
  color: var(--color-count);
}

tbody tr {
  border-bottom: 1px solid #2c2c2c;
}

tbody tr:hover {
  background-color: var(--color-hover);
}

td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
}

/* === Actions dans les tableaux === */
.table-actions {
  display: flex;
  gap: 0.6rem;
}

/* Neutraliser le style natif des liens et boutons */
.action-icon {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.action-icon:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Couleurs spécifiques par action */
.action-icon.edit span {
  color: var(--color-text);   /* blanc pour édition */
}

.action-icon.delete span {
  color: var(--color-danger);   /* rouge pour suppression */
}

.action-icon.add span {
  color: var(--color-success);  /* vert pour visualisation */
}


/* ==================================================================== */
/* === Formulaires génériques (login ,site-form, server-form, etc.) === */
/* ==================================================================== */

.page-stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 2rem;
	padding: 2rem;
}


.form-container {
  margin: 2rem auto;
  width: 420px;
  background-color: var(--color-surface);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px #2c2c2c, 0 6px 16px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-container input-group{
	padding: 0.6rem 0.8rem;	
}

.form-container h2 {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}

.form-actions .btn {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  text-decoration: none; 
}




/* ========================= */
/* === Responsive commun === */
/* ========================= */
/*@media (max-width: 1024px) {
  .task-bar ul { flex-wrap: wrap; gap: 0.8rem; }
}

@media (max-width: 600px) {
  .task-bar ul { flex-wrap: wrap; gap: 0.6rem; }
  .task-bar .task-item a {
      font-size: 0.8rem;          
      gap: 0.3rem;                
      padding: 0.3rem 0.6rem;     
    }
  .btn { width: 100%; }
  .card { padding: 1.5rem 1rem; }
  
  .form-container {
    width: 95%;
    max-width: 340px;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
  }

  .form-container h2 {
    font-size: 1.2rem;
  }
  
  .task-bar .task-item .label-full { display: none; }
  .task-bar .task-item .label-short { display: inline; }
  
} */




/* === Responsive mobile (≤600px) === */
@media (max-width: 1024px) {
  .main-content {
    padding: 0.8rem;
    gap: 1rem;
  }
  
  .home-stage {
    padding: 1rem;
    gap: 1rem;
  }

  .home-cards {
    gap: 1rem;
    padding: 0 1rem;
    max-width: 100%;
  }
  
  .form-container {
    width: 95%;
    max-width: 340px;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
  }

  .form-container h2 {
    font-size: 1.2rem;
  }

  .task-bar ul {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .task-bar .task-item a,
  .task-bar .task-item button {
	flex-direction: column;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }
  
  .task-bar .task-item .label-full { display: none; }
  .task-bar .task-item .label-short { display: inline; }
  
  .card {
    padding: 1.5rem 1rem;
  }

  .card span.material-symbols-outlined {
    font-size: 1.8rem;
  }

  .card h2 {
    font-size: 0.8rem;
  }
  
  .sidebar-toggle {
    display: flex; /* bouton visible uniquement ici */
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1500;
    transform: translateX(-100%); /* cachée par défaut */
    transition: transform 0.3s ease;
  }

  .sidebar.hidden {
    transform: translateX(-100%);
  }

  .sidebar:not(.hidden) {
    transform: translateX(0);
  }

}


/* === Tables responsives === */
@media (max-width: 768px) {
  table {
    font-size: 0.75rem;
    min-width: 600px;
  }

  .table-container {
    border-radius: var(--radius);
    box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
  }
}