/*----------
Regroupe les styles globaux 
utilisées dans l'application
*-------------/


/*--------Mise en page globale---------*/

 html, body {
    font-family:  Arial, Helvetica, sans-serif;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    cursor: auto;
}

body {
  background: #eee;
}

body > main {
  flex: 1;
  padding: 1%;
}

/*----- Pour empêcher le scroll quand un formulaire est ouvert -----*/
.no-scroll {
  overflow: hidden;
  height: 100vh;
}

@media (max-width: 600px), (max-height: 700px) {
  .no-scroll {
    overflow: auto;
    height: auto;
  }
}

/*-----Responsive ----*/

@media all and (max-width: 991px) {
  body > main {
    padding: 5%; 
  }
}

.wrap-container {
  display: flex;
  flex: 1;
  justify-content: center;
  margin-top: 5%;
}

.app-backdrop {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 99;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
}

/*-------- Header -------- */

header{
        background-color: var(--color-primary);
        position: sticky;
        top : 0;
        display: block;
        width: auto;
        height: auto;
        color: whitesmoke;
        z-index: 40;
    }

.header-line{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7.5rem;
    padding: 10px 0;
}

.header-line h1{
    font-size: 2.5rem;
    margin: 0;
    padding: 0;
    font-weight: bolder;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.header-line h1 span{
    font-size: 3rem;
    color: var(--color-nav);
}

@media screen and (min-width: 768px) and (max-width: 992px) {
  .header-line{
      gap: 5rem;
  }

  .header-line h1{
      font-size: 2rem;
  }
  
  .header-line h1 span{
      font-size: 2.5rem;
  }
}

@media screen and (max-width: 768px) {
  .header-line{
      gap: 2rem;
  }

  .header-line h1{
      font-size: 1.5rem;   
  }
  
  .header-line h1 span{
      font-size: 2rem;
  }
}




img{
    height: 110px;
    width: 110px;
    object-fit: contain;
}

/*--------Menu de navigation ---------*/

nav{
    font-size: 1.2rem;
    margin: 2px auto;
    width: 100%;
    padding: 0 2%;
    background: transparent;
}

.link-nav{ 
    text-decoration: none;       
    color: whitesmoke;
    position: relative;
    padding: 0.2rem 0;
    margin-left: 1%;
    margin-right: 1%;
}

.link-deconnect {
  margin-left: auto;
  margin-right: 0;
}


@media all and (min-width: 768px) {
  nav .nav-list{
    list-style: none;
    display: flex;
    justify-content: start; 
    width: 100%;
    padding-left: 100px;
    font-size: 1.05rem;     
  }
  /* Animation uniquement sur hover des liens non-actifs */
  .link-nav:not(.active):hover::after {
      transform: scaleX(1);
  }

  /* État permanent pour le lien actif */
  .link-nav.active::after {
      transform: scaleX(1);
      transition: none; /* Pas d'animation pour l'état actif */
  }
  .link-nav::after {
    content: '';
    position: absolute;
    bottom: -0.4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-nav);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease;
  }

  .link-deconnect {
  text-decoration: none;
  color: whitesmoke;
  padding: 0.2rem 0.5rem;
  }
  .link-deconnect:hover {
  background-color: var(--color-secondary);
  opacity: 0.6;
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
  }
}



.label-nav, #toogle {
  display: none;
}

/*-------------Menu de navigation reponsive ------- */

@media all and (max-width: 767px) {

  header{
    height: 80px;
  }

  

  nav .nav-list svg {
    opacity: 0;
  }

  img {
    display: none;
  }

  nav ul{
    display: none;
  }

  nav{
    margin: 0;
    padding: 0;
    background: transparent;
  }

  nav .nav-list {
    display: none;
    flex-direction: column;
    background-color: var(--color-primary);
    height: 150px;
    margin: 0;
    overflow-y: scroll;
    overflow-x: hidden;
  }

  nav .nav-list::-webkit-scrollbar {
    width: 8px;
    border-radius: 4px;
  }
  nav .nav-list::-webkit-scrollbar-thumb {
    background-color:var(--color-secondary);
    border-radius: 8px;
  }

  nav .nav-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-nav);
  }


  nav .nav-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,1);
    
  }

  nav .nav-list a {
    width: 100%;
    padding-top: 2%;
    padding-bottom: 2%;
    padding-left: 4%;
  }

  nav .nav-list a:hover {
    background-color: var(--color-secondary);
    text-decoration: none;
  }

  .link-nav {
    margin-left: 0;
  }

  .label-nav {
    width: 100%;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-primary);
    font-size: 30px;
    cursor: pointer;
    color: #fff;
    margin: 0 auto;
  }

  .link-deconnect {
    margin-left: 0;
    text-decoration: none;
    color: #fff;
  }

  #toogle:checked + .nav-list {
    display: flex;
  }

}


/*-------- Footer -------- */

footer {
    background-color: black;
    display: block;
    width: 100%;
    margin-top: 2%;
}

.version {
    color: whitesmoke;
    text-align: center;
    font-style: italic;
}

.sources {
  color: whitesmoke;
  text-align: center;
  font-style: italic;
}


/*-------- Notifications ---------*/

.alert-box{
  position: fixed;
  right: 1rem;
  bottom: -4rem;
  z-index: 41;
  min-width: 400px;
  text-align: justify;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.alert {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: translate 0.5s forwards;
}

@keyframes translate {
  from {
    bottom: -5rem;
  }
  to {
    bottom: 5rem;
  }
}

@keyframes fadeOutUp {
  from {
    bottom: 5rem;
  }
  to {
    bottom: -5rem;
  }
}

.alert.fade-out {
  animation: fadeOutUp 0.5s ease forwards;
}

/*--------- Tableau de données ---------*/

.custom-table{
  table-layout: fixed;
  width: 100%;
  margin: auto;
  margin-top: 2px;
  border-collapse: collapse;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  transition: opacity 60ms ease-in-out, filter 60ms ease-in-out;
}

.custom-table.loading {
  opacity: 0;
  pointer-events: none;
}

.custom-table thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(to top, var(--color-primary-rgba), var(--color-secondary-rgba));
  color: #fff;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

tr:nth-child(even){
  background-color: #e7e7e7;
}

tr {
  text-align: center;
  padding: 1px;
  height: 40px;
}

td {
  word-wrap: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

.custom-table td,
.custom-table th {
  padding: 0.5rem;
  text-align: center;
}

thead {
  font-weight: bold;
  font-size: medium;
  text-align: center;
  vertical-align: center;
}

tbody tr:hover{
  background-color: #d0e0f0;
  transition: background-color 0.3s ease;
}

/*---------Tableau de données résponsive------------- */

@media (max-width: 1200px) {
  .custom-table thead {
    display: none;
  }

  .custom-table, .custom-table tbody, .custom-table tr, .custom-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
    box-shadow: none;
  }

  .custom-table tr {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .custom-table td {
    text-align: left;
    padding: 0.5rem 1rem;
    min-height: 40px;
    border: none;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    word-break: break-word;
  }

  .custom-table td:last-child {
    border-bottom: none;
  }

  .custom-table td::before {
    content: attr(data-label);
    font-weight: bold;
    color: var(--color-primary);
    min-width: max-content;
    margin-right: 1rem;
  }

  .custom-table td {
    transition: all 0.3s ease;
  }

  /* Ajustements spécifiques pour les actions */
  .action-cell {
    justify-content: flex-start;
  }

  .action {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .edit-ent-btn,
  .del-entreprise-btn,
  .filter-action,
  .del-machine-btn,
  .upt-machine-btn,
  .service-machine-btn,
  .recover-machine-btn {
    width: 1.3rem;
    height: 1.3rem;
  }

  .tooltip-text {
    font-size: 0.7rem;
    width: 120px;
  }
}



/*--------- Styles globaux pour les forumlaires -------- */

.form-wrapper {
  position: absolute;
  display: none;
  top: 10%;
  left: 20%;
  width: 60%;
  height: auto;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  z-index: 100;
}

.form-header {
  color: white;
  background-color: var(--color-primary);
  display: flex;
  border-bottom: 1px solid #fff;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  justify-content: center;
  vertical-align: center;
  align-items: center;
}

.close-form {
  border: none;
  background-color: var(--color-primary);
  border-top-right-radius: 12px;
  font-weight: 100;
  font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
  color: #fff;
  font-size: 1.5rem;
}

.fields-required {
  font-style: italic;
}

.custom-form{
  background: #fff;
  width: 100%;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}


.close-form:hover {
  color: rgb(224, 222, 222);
}

.custom-btn , .custom-btn-2 {
  width: auto;
  border: none;
  background-color: var(--color-primary);
  margin-bottom: 10px;
  border-radius: 8px;
  color: #fffefe;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  font-size: 1.5rem;
  padding: 4px 8px;
}

.custom-btn:disabled {
  background-color: var(--color-disabled);
  opacity: 0.6;
}

.custom-btn:disabled:hover {
  background-color: var(--color-disabled);
  cursor: not-allowed;
}


.require-fields{
  font-style: italic;
}

.custom-btn:hover, .custom-btn-2:hover{
  background-color: var(--color-secondary);

}

.form-footer{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 2%;
}

.form-footer-2{
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 5px;
}

/*-------- Infobulles -------- */

.tooltip-wrapper{
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  font-weight: bolder;
  width: 150px;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-primary);
  color: #fff;
  box-shadow: 2px 4px 2px rgba(0, 0, 0, 0.2);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 2;
  font-weight: 800;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tooltip-delete {
  background-color: var(--color-danger);
  font-weight: 800;
}

.tooltip-info {
  background-color: var(--color-info);
  font-weight: 800;
}

.warning-text, .danger-text, .info-text {
  visibility: hidden;
  font-weight: bolder;
  width: 150px;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  box-shadow: 2px 4px 2px rgba(0, 0, 0, 0.2);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 2;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.warning-text{
  background-color: var(--color-warning);
}

.info-text{
  background-color: var(--color-info);
}

.danger-text{
  background-color: var(--color-danger);
}

.tooltip-wrapper:hover .tooltip-text {
  visibility: visible;
  opacity: 0.85;
}

td[data-value="0"] .tooltip-wrapper:hover .warning-text,
.cell-service .tooltip-wrapper:hover .warning-text {
  visibility: visible;
  opacity: 0.85;
}

td[data-value="2"] .tooltip-wrapper:hover .info-text {
  visibility: visible;
  opacity: 0.85;
}

td[data-value="-1"] .tooltip-wrapper:hover .danger-text{
  visibility: visible;
  opacity: 0.85;
}


/********Pagination**************/

.pagination-container{
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top : 10px;
  min-width: 200px;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.pagination-container.hidden {
  display: none;
}

#prev-page, #next-page {
  background-color: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 1px 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-left: 2px;
  margin-right: 2px;
}

#prev-page:hover, #next-page:hover {
  background-color: var(--color-secondary);
}

#prev-page:disabled, #next-page:disabled {
  background-color: #ccc;
  opacity: 0.7;
}

#prev-page:disabled:hover, #next-page:disabled:hover {
  background-color: #ccc;
  opacity: 1;
  cursor: not-allowed;
}



.page-numbers{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.2rem 0.7rem;
  flex-wrap: wrap;
  min-width: fit-content;
}

.page-number {
  background-color: var(--color-primary);
  min-width: 32px;
  height: 32px;
  padding: 2px 8px;
  color: #fff;
  text-align: center;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.page-number:hover{
  background-color: var(--color-secondary);
}

.page-number.active{
  background-color: var(--color-secondary);
}

.ellipsis {
  color: var(--color-primary);
  padding: 0 0.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  font-size: 1.2rem;
}

/* Responsive pour pagination sur petits écrans */
@media (max-width: 576px) {
  .page-numbers {
    gap: 0.2rem;
    padding: 0.2rem 0.3rem;
  }
  
  .page-number {
    min-width: 28px;
    height: 28px;
    padding: 1px 6px;
    font-size: 0.8rem;
  }
  
  .ellipsis {
    padding: 0 0.3rem;
    font-size: 1rem;
  }
}


.form-header h2 {
  font-size: 1.8rem;
  margin: 0 auto;
  text-align: center;
  flex-grow: 1;
}

/*---------------Loader global-----------------------------------------------------*/

.table-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
  height: 50%;
  font-size: 1.5rem;
  color: var(--color-primary)
}

.table-loader.hidden {
  display: none;
}

#loading-row td {
  text-align: center;
  height: 50px;
  color: #555;
  vertical-align: middle;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.star {
  color: var(--color-danger);
  font-weight: bold;
}


/*---------------Responsive Design-----------------------------------------------------*/

@media (width < 767px) {
  .form-wrapper {
    width: 90%;
    top: 10%;
    left: 5%;
    right: 5%;
  }
}

@media (width > 767px) and (width < 991px) {
  .form-wrapper {
    width: 80%;
    top: 10%;
    left: 10%;
    right: 10%;
  }
}


@media (width > 991px) and  (width < 1500px) {
  .custom-table thead {
    font-size: smaller;
    font-weight: normal;
  }
}
