/* ===============================================================
   🧱 SPLIT VIEW (Clients / Artistes)
   Liste à gauche + Fiche à droite
   =============================================================== */
/* === Layout global === */
.split-view {
  display: grid;
  grid-template-columns: 1fr 0;
  transition: grid-template-columns 0.3s ease;
  height: 100%;
  position: relative; /* permet z-index correct */
}

.split-view .page-left {
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* ✅ le scroll reste sur la liste */
}

.split-view .detail-panel {
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    width: min(420px, 90vw);
    z-index: 5;
    position: relative;
    padding-left: 20px;
}

/* ✅ Fiche visible */
.split-view.show-detail {
  grid-template-columns: 1fr min(420px, 90vw);
}

.split-view.show-detail .detail-panel {
  transform: translateX(0);
}



/* ===============================================================
   🧭 En-tête
   =============================================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header-left h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header-left h1 .lucide {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.count-badge {
  background: var(--card-2);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--muted);
}

/* === Actions (search + filtres + bouton) === */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}




/* ===============================================================
   📋 Liste horizontale — style tableau moderne
   =============================================================== */



.list-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-cards li.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  
  padding: 10px 14px;
  transition: background 0.2s ease;
  cursor: pointer;
  border-radius: 0%;
}
 
.list-cards > li.card-item:first-child {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}
.list-cards > li.card-item:last-child {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}




.list-cards li.card-item:hover {
  background: color-mix(in srgb, var(--panel) 85%, var(--accent) 10%);
}

/* --- Partie gauche : Avatar + infos --- */
.card-main {
  display: flex;
  align-items: flex-start;
  flex: 1;
  gap: 12px;
  min-width: 0;
}

.card-title {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height:1.2;
}

.card-title strong {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title span.meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  line-height: 1.2rem;
  gap: 5px;
    align-items: center;
}





/* --- Animation --- */
.fade-in {
  animation: fadeIn 0.25s ease both;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive --- */
@media (max-width: 700px) {

  .card-title {
    width: 100%;
  }
  .list-cards {
    padding: 0 10px;

}

}


/* ===============================================================
   🧍 Panneau de Détail (fiche)
   =============================================================== */

.detail-panel {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.detail-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: var(--card-2);
}

.fiche-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.fiche-block h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fiche-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fiche-actions .btn-secondary {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.home-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--card-2);
  margin-top: 10px;
}

/* ===============================================================
   💻 Responsive
   =============================================================== */

@media (max-width: 900px) {
  .split-view {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    z-index: 40;
  }

  .detail-header {
    border-bottom: 1px solid var(--border);
  }

  .page-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .searchbar {
    flex: 1;
  }
}



/* ===============================================================
   📱 Fiche latérale plein écran + animation fond (mobile)
   =============================================================== */
@media (max-width: 900px) {
  .split-view {
    grid-template-columns: 1fr;
    overflow: visible;
    position: relative;
  }

  /* --- Effet zoom/fade du fond quand la fiche est ouverte --- */
  .split-view .page-left {
    transition: transform 0.35s ease, filter 0.35s ease, opacity 0.35s ease;
    transform-origin: left center;
  }

  .split-view.show-detail .page-left {
    transform: scale(0.94);
    filter: blur(2px) brightness(0.7);
    opacity: 0.8;
  }

  /* --- Panneau fiche : plein écran mobile --- */
  .split-view .detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 1000;
    background: var(--bg);
    border-left: none;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.35s ease, box-shadow 0.3s ease;
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }

  .split-view.show-detail .detail-panel {
    transform: translateX(0);
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.4);
  }

  /* --- Header fixe + bouton retour --- */
  .detail-header {
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 10;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .detail-header h2 {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    text-align: center;
  }

  .detail-header .btn-icon {
    flex-shrink: 0;
    background: var(--card-2);
    border: 1px solid var(--border);
    transition: background 0.2s ease;
  }

  .detail-header .btn-icon:hover {
    background: color-mix(in srgb, var(--accent) 20%, var(--card-2));
  }

  /* --- Corps de la fiche --- */
  .detail-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    background: var(--card-2);
  }

  /* --- Overlay fondu (assombrit le fond) --- */
  .split-view::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .split-view.show-detail::before {
    opacity: 1;
    pointer-events: all;
  }

  /* --- Animation d’apparition du panneau --- */
  @keyframes slideInFull {
    from {
      transform: translateX(100%);
    }
    to {
      transform: translateX(0);
    }
  }

  .split-view.show-detail .detail-panel {
    animation: slideInFull 0.35s ease forwards;
  }
}






/* ===========================================================
   DEVIS LIST — mobile first : carte
   =========================================================== */
.devis-item,
.projet-item,
.client-item,
.artiste-item,
.facture-item {
  padding: 1rem;
  background: var(--panel);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  display: block !important;
}

.devis-item:hover,
.client-item:hover,
.projet-item:hover,
.artiste-item:hover,
.facture-item:hover  {
  background: var(--panel-hover);
}

.devis-item .devis-row,
.client-item .client-row,
.projet-item .projet-row,
.artiste-item .artiste-row,
.facture-item .facture-row  {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  position: relative;
}

/* Avatar + ID côte à côte */
.devis-row .avatar-col,
.devis-row  .col,
.artiste-row .avatar-col,
.artiste-row  .col,
.projet-row .projet-col,
.projet-row  .col,
.client-row .avatar-col,
.client-row  .col,
.facture-row .avatar-col,
.facture-row  .col {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size:1rem;
  color: var(--textNeg)
}


.montant-col {
  justify-content: flex-end;
}
.statut-col {
  justify-content: center;
}

.projet-col {
  display:flex;
}
.projet-col div {
    display: flex;
    gap: 10px;
    background: var(--bg);
    border-radius: 99px;
    padding-right: 20px;
    border: 1px solid var(--bg);
}
.projet-col div:hover {
    border: 1px solid var(--hover);
}


.tabs-right-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: -5px;
}




/* ================================
   COLONNE DATE — ERP STYLE
   ================================ */

.devis-row .date-col,
.artiste-row .date-col,
.projet-row .date-col,
.client-row .date-col,
.facture-row .date-col {
  opacity: .8;
  font-size: .82rem;
  justify-content: end;
}

.devis-row .date-col .date,
.projet-row .date-col .date,
.artiste-row .date-col .date,
.client-row .date-col .date,
.facture-row .date-col .date {
  white-space: nowrap;
}

/* Mobile : la date passe sous le montant ou disparaît */
@media (max-width: 1100px) {


  .tabs-right-tools {
    display: none;
  }

.devis-tabs, .tabs-bar-factures {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.1));
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    background: var(--panel);
}


  .col {
    min-height: auto;
}




    /* Avatar + ID côte à côte */
  .devis-row .avatar-col,
  .devis-row  .col,
  .projet-row .avatar-col,
  .projet-row  .col,
  .facture-row .avatar-col,
  .facture-row  .col {
    display: flex;
    align-items: start;
  }

  .montant-col {
      justify-content: flex-end;
      position: absolute;
      top: 0;
      right: 35px;
  }
  .statut-col {
      justify-content: center;
      position: absolute;
      right: 0px;
      top: 30px;
  }
  .actions-col {
    position: absolute;
    top: -7px;
    right: 0;
  }

  .date-col {
    position: absolute;
    bottom: 5px;
    right: 0;
  }

  .avatar-col {
    position: absolute;
    top: 66px;
    right: 0;
  }

  

}

 .client-email,
 .artiste-email,
 .client-location-text,
 .artiste-location-text,
 .client-name,
  .artiste-name,
  .projet-name   {
    font-size: .80rem;
  }







/* ===========================================================
   DESKTOP — affichage en colonnes (tableau)
   =========================================================== */


@media (min-width: 1100px) {
  .devis-item .devis-row {
    display: grid;
    grid-template-columns:
 
      150px     /* id */
      100px     /* montant */
      150px     /* statut */
      100px       /* Artiste */
      1fr       /* client */
      1fr       /* projet */
      100px;     /* date */

    align-items: center;
    gap: 1rem;
  }

    .projet-item .projet-row {
    display: grid;
    grid-template-columns:
 
      300px       /* intitulé */   
      100px     /* budget*/      
      200px     /* statut*/     
      1fr     /* client*/        
      200px;

    align-items: center;
    gap: 1rem;
  }

  .facture-item .facture-row  {
    display: grid;
    grid-template-columns:
        180px         /* id */
        100px          /* type */
        100px         /* montant */
        150px         /* statut */
        100px         /* artiste */
        minmax(0, 1fr)  /* client → réductible */
        minmax(0, 1fr)  /* projet/intitulé → réductible */
        100px  ;       /* date */
        

    align-items: center;
    gap: 1rem;
  }


/* ============================================ */
/* 🔹 LISTE CLIENTS — grille type "tableau"      */
/* ============================================ */

.client-item .client-row {
  display: grid;
  grid-template-columns:
      250px/* Nom */     
      250px/* Email */     
      1fr/* CP + Ville */      
      260px;     
  align-items: center;
  gap: 1rem;
  width: 100%;
}


/* Texte ellipsé */
.client-name-text,
.client-email,
.client-location-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================ */
/* 🎨 LISTE ARTISTES — grille type "tableau"     */
/* ============================================ */

.artiste-item .artiste-row {
  display: grid;
  grid-template-columns:
     150px/* Nom */     
      200px/* Email */  
      200px  /* CP + Ville */   
      1fr/* Rôle */
      400px;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* Colonnes */
.artiste-name-col,
.artiste-email-col,
.artiste-ville-col,
.artiste-role-col,
.artiste-stats-col,
.artiste-actions-col {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Texte ellipsé */
.artiste-name-text,
.artiste-email,
.artiste-location-text,
.artiste-role-pill {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



.projet-col {
  min-width: 0; /* indispensable en grid */
}

.projet-col .projet-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

  .devis-id,
  .facture-id,
  .artiste-id,
  .client-id  {
    font-size: 0.85rem;
  }

 



  .actions-col {
    text-align: right;
  }
}

.col.artiste-col .lucide {
    width: 22px;
    height: 22px;
    color: var(--textNeg);
    background: var(--accent);
    border-radius: 20px;
    padding: 2px;
}



/* ========================================================= */
/* 🎨 PILL STATS — style moderne, compact et élégant          */
/* ========================================================= */

.client-stats-col,
.artiste-stats-col {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}


/* --- Style de base shared --- */
.client-stat-pill,
.artiste-stat-pill {
  padding: 0.35rem 0.65rem;
  border-radius: 0.55rem;
  background: var(--hover);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  line-height: 1;
  transition: all 0.18s ease-out;
}



/* ========================================================= */
/* 🎨 ACCENTS SPÉCIAUX                                      */
/* ========================================================= */

/* CA pour artistes = accent plus fort */
.artiste-ca-pill {
  border-color: var(--accent);
  color: var(--accent,);
  font-weight: 600;
}


/* ========================================================= */
/* 📱 Responsive (mobile ≤ 600px)                            */
/* ========================================================= */
@media (max-width: 600px) {

  .client-stats-col,
  .artiste-stats-col {
    gap: 0.35rem;
  }

  .client-stat-pill,
  .artiste-stat-pill {
    font-size: 0.74rem;
    padding: 0.28rem 0.5rem;
  }

  .artiste-ca-pill {
    font-size: 0.78rem;
    padding: 0.32rem 0.55rem;
  }
}



/* ===================================================================
   🏷️ BADGES STATUT DEVIS — ERP DESIGN
   =================================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  padding: .32rem .55rem;
  border-radius: 2rem;
  line-height: 1;
  white-space: nowrap;
  color: var(--textNeg);
  width: max-content;
}

.status-badge .ico {
  width: 14px;
  height: 14px;
}


/* ---- Couleurs ---- */
.badge-muted {
  background: #c3cbda;
}
.badge-indigo {
  background: #65c2da;
}
.badge-or {
  background: #e9ae0a;  /* Finalisé */
}
.badge-blue {
  background: #4b8ceeff;  /* Envoyé */
}
.badge-purple {
  background: #7477f7;  /* Envoyé */
}
.badge-green {
  background: #30ac55;  /* Accepté */
}
.badge-red {
  background: #EF4444;  /* Refusé */
}
.badge-orange {
  background: #F97316;  /* Expiré */
}
.badge-gray {
  background: #4B5563;
}




.factures-filters-advanced {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto; /* pousse les filtres à droite */
}

.filter-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color:var(--muted);
  display: flex;
  gap: 6px;
}

.filter-popover-wrap {
  position: relative;
}

.filter-popover {
  position: absolute;
  top: 110%;
  right: 0;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
  box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
}

.filter-popover.visible {
  display: flex;
}

.filter-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.filter-popover label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
}

.apply-btn {
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  background: var(--accent);
  color: white;
  border: none;
}

.filter-date-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
}

.tabs-bar-factures {
  max-width: 1800px;
  margin: 0 auto;
  padding: 8px 20px 0px 40px;
  border-bottom: 1px solid var(--hover);
  display: flex; 
  align-items: center;
  gap: 10px;
}

/* Trois zones flexibles */
.tabs-left,
.tabs-center {
  display: flex;
  align-items: center;
}



.filter-btn .ico {
  width: 16px;
  height: 16px;
  opacity: .8;
}

/* Pour que ta zone filtres reste compacte */
.factures-filters-advanced {
  display: flex;
  align-items: center;
  gap: .5rem;
}
