/* =====================================================================
   🎨 1. VARIABLES GLOBALES ET RESET
===================================================================== */
:root {
    --primary-color: #E84E0F;
    --primary-light: #E84E0F;
    --primary-hover: #cf430b;   /* hover un peu plus foncé */
    --text-color: #333;
    --light-gray: #f9f9f9;
    --border-color: #ddd;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --header-height: 80px;
    --footer-height: 50px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f5f5f5;
    color: var(--text-color);
    line-height: 1.6;
}

/* =====================================================================
   🧩 2. STRUCTURE GLOBALE / LAYOUT
===================================================================== */
.main-container {
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    min-height: calc(100vh - (var(--header-height) + var(--footer-height)));
    padding: 2rem;
}

/* =====================================================================
   🔝 3. HEADER ET NAVIGATION
===================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: all 0.3s ease;
}

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

.header-logo img {
    height: 80px;
    width: auto;
    display: block;
    margin-right: 1rem;
    transition: transform 0.3s ease;
}
.header-logo img:hover {
    transform: scale(1.05);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}
header h1 span {
    font-weight: 300;
    font-style: italic;
}

nav {
    display: flex;
    gap: 1rem;
}

nav a,
.header-right a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}
nav a:hover,
.header-right a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn,
.header-right .logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.logout-btn:hover,
.header-right .logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

header.scrolled {
    padding: 0.5rem 2rem;
    height: 60px;
}

/* =====================================================================
   📦 4. CONTENEURS ET CARTES
===================================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* =====================================================================
   📊 5. TABLEAUX ET BADGES
===================================================================== */
.data-table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
    margin-bottom: 3rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--primary-light);
    color: white;
    font-weight: 600;
}
.data-table thead th {
    background-color: #ffe2cc !important; /* orange doux */
    color: #333 !important; /* meilleur contraste */
    border-bottom: 2px solid #ff8a3d;
}

.table-footer {
    text-align: right;
    font-size: 0.9em;
    color: #555;
    margin-top: 0.8rem;
    padding-right: 0.5rem;
}


.status-badge {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    text-transform: capitalize;
}
.status-badge.open { background: #ffebee; color: #d32f2f; }
.status-badge.pending { background: #fff3e0; color: #f57c00; }
.status-badge.resolved { background: #e8f5e9; color: #2e7d32; }

.status-badge.nouveau { background: #ff0000; color: #fff; }
.status-badge.en-cours { background: orange; color: #fff4cc; }
.status-badge.resolu { background: #1a9a03; color: #d9e8ff; }
.status-badge.clos { background: #e1e1e1; color: black; }

/* =====================================================================
   📝 6. FORMULAIRES ET BOUTONS
===================================================================== */
.form-container {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.2);
}
.form-group textarea {
    min-height: 120px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px; /* 10px vertical, 20px horizontal */
}

.filter-form .form-group {
    margin-bottom: 0; /* Évite l'espace sous les champs */
}

.form-actions {
    flex-basis: 100%;
    display: flex;
    gap: 10px;
    margin-top: 5px; /* place juste un petit espace */
}


/* Conteneur d'une question */
#subcategory-questions-container .form-group {
    margin-bottom: 12px;
}

/* Réduit l'espace entre le label et le champ */
#subcategory-questions-container .form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

/* Champ classique : text, number, textarea, select */
#subcategory-questions-container .form-group input,
#subcategory-questions-container .form-group select,
#subcategory-questions-container .form-group textarea {
    margin-top: 0;
}

/* Radio Oui/Non : alignement horizontal */
.yesno-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.yesno-wrapper label {
    margin: 0 !important;
}

#question-form-container {
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 25px;
}
#question-form-container .form-group {
    margin-bottom: 12px;
}
#question-form-container label {
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}


.btn-edit-title,
.btn-save-title {
    background: #ffc997;
    color: #333;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s ease;
}

.btn-edit-title:hover,
.btn-save-title:hover {
    background: #ffb766;
}

.ticket-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editing-title {
    background: #fff3cd;
    border: 1px dashed #ff9800;
    padding: 4px 6px;
    border-radius: 5px;
}

.description-body {
    color: #333 !important;   /* gris foncé */
    font-size: 15px;
    line-height: 1.55;
}


.btn-edit-title:hover,
.btn-save-title:hover {
    background: #ffb766;
}


.btn-primary,
.submit-btn {
    text-decoration: none;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.1s ease;
}

.btn-primary:hover,
.submit-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.03);
}

.btn-secondary {
  min-width: 100px;
  text-decoration: none;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  margin: 2px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.1s ease;
}

.btn-secondary:hover {
  background-color: var(--primary-hover);
  transform: scale(1.03);
}

.small-btn {
    font-size: 13px;
    padding: 0.35rem 0.8rem;
    min-width: 100px;
}



/* =====================================================================
   📎 7. ZONE DE DÉPÔT DE FICHIERS
===================================================================== */
.file-drop-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
}
.file-drop-area:hover {
    border-color: var(--primary-color);
    background: rgba(255, 102, 0, 0.05);
}
.file-drop-area.locked-block {
  cursor: not-allowed;
}

.file-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.remove-file {
    background: #ff4d4d;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.remove-file:hover {
    background: #e60000;
    transform: scale(1.1);
}

/* =====================================================================
   👥 8. CONTACTS ASSOCIÉS / RECHERCHE
===================================================================== */
.selected-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.created-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.contact-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #e7f3ff;
  border: 1px solid #b3d7ff;
  border-radius: 50px;
  padding: 0.4rem 0.8rem;
  color: #004080;
  font-size: 0.95rem;
  font-weight: 500;
}
.contact-tag:hover {
  background: #d9ebff;
  transform: scale(1.02);
}
.contact-tag .tag-email {
  font-size: 0.85rem;
  color: #666;
}
.contact-tag .remove-tag {
  background: #ff5b5b;
  border: none;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.contact-tag .remove-tag:hover {
  background: #d22;
}
.contact-search {
  position: relative;
}
.contact-search-input {
  padding: 0.6rem 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 100%;
}
.search-results {
  position: absolute;
  top: 105%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: none;
  max-height: 220px;
  overflow-y: auto;
  z-index: 1000;
}
.search-result-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.search-result-item:hover {
  background-color: #f0f7ff;
}
.search-result-item .user-avatar {
  background: #cfeaff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #004080;
  margin-right: 0.6rem;
}
.search-result-item .user-info {
  display: flex;
  flex-direction: column;
}
.search-result-item .user-name {
  font-weight: 600;
  color: #333;
}
.search-result-item .user-email {
  font-size: 0.85rem;
  color: #666;
}

.simple-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.simple-contact-input {
    flex: 1;
    font-size: 0.95rem;
}

.remove-simple-contact {
    background: none;
    border: none;
    color: #d93025;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
}
.remove-simple-contact:hover {
    color: #ff4b3e;
    transform: scale(1.1);
}

.manual-email-input {
    transition: border-color 0.2s ease;
}


/* =====================================================================
   🎫 9. TICKETS ET MÉTADONNÉES
===================================================================== */
/* Style clair, lisible et sobre pour les sélecteurs *//* ===== HEADER PRINCIPAL DU TICKET ===== */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    padding: 20px 25px;
    margin-bottom: 20px;
}

/* Colonne gauche : titre */
.ticket-header-left h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

/* Colonne droite : meta */
.ticket-meta-card.compact {
    flex: 1;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* Ajustements spécifiques */
.ticket-meta-card .meta-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.ticket-meta-card .meta-body {
    background: #f9fafc;
    border-radius: 8px;
    padding: 10px 15px;
}

/* Grille interne */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 6px;
}

.meta-item {
    flex: 1;
    min-width: 200px;
}

.meta-item strong {
    color: #333;
    font-weight: 600;
    display: block;
    margin-bottom: 3px;
}

.meta-item span, .meta-item a {
    color: #444;
    text-decoration: none;
}

.meta-item a:hover {
    color: #007bff;
}

/* Badge statut */
.status-badge {
    background: #f0ad4e;
    color: white;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.status-badge.resolu { background: #28a745; }
.status-badge.clos { background: #6c757d; }

/* Sélecteurs catégorie */
.category-selects {
    display: flex;
    gap: 10px;
}

.styled-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

.styled-select:focus {
    border-color: #007bff;
    outline: none;
}



/* =====================================================================
   💬 10. MESSAGES ET DISCUSSION
===================================================================== */
.messages-container {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 80%;
    padding: 1rem;
    border-radius: 8px;
}
.message.sent {
    margin-left: auto;
    background-color:#CFEAFF;
    color: black;
}
.message.received {
    margin-right: auto;
    background: #f5f5f5;
}
.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.message-header strong {
    color: var(--primary-color);
}

/* =====================================================================
   🧭 11. FILTRES ET OUTILS
===================================================================== */
.filter-section {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.compact-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #fff;
    padding: 0.6rem 1rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
    align-items: center;
    justify-content: space-between;
}

.compact-filters input,
.compact-filters select {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 14px;
    background: #fafafa;
    min-width: 130px;
}

.compact-filters input[type="text"] {
    flex: 1;
    min-width: 180px;
}

@media (max-width: 800px) {
    .hide-md{ display:none; }
    .compact-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .compact-filters input,
    .compact-filters select,
    .compact-filters button,
    .compact-filters a {
        width: 100%;
    }
}

/* =====================================================================
   ⚙️ 12. FOOTER
===================================================================== */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #333;
    color: white;
    padding: 1rem 2rem;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* =====================================================================
   🚨 13. ALERTES ET NOTIFICATIONS
===================================================================== */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
}
.alert-error {
    background: #ffebee;
    color: #d32f2f;
    border: 1px solid #ef9a9a;
}
.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* =====================================================================
   📱 14. RESPONSIVE DESIGN
===================================================================== */
@media (max-width: 768px) {
    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .ticket-meta {
        align-items: flex-start;
        text-align: left;
        min-width: auto;
    }
}

/* =====================================================================
   💾 15. LISTE DES PIÈCES JOINTES DANS LES MESSAGES
===================================================================== */

/* Supprime les puces de base */
.message-attachments ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

/* Chaque fichier affiché avec une icône disquette */
.message-attachments li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    color: #333;
}

/* Icône 💾 à gauche */
.message-attachments li::before {
    content: "💾";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1rem;
    color: var(--primary-color);
}

/* Style du lien du fichier */
.message-attachments a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

.message-attachments a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* =====================================================================
   🗑️ 16. BOUTON DE SUPPRESSION DES FICHIERS
===================================================================== */

.remove-file {
    background: #ff4d4d;
    border: none;
    color: white;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Icône de corbeille à la place du “x” */
.remove-file::before {
    content: "🗑️"; /* ou "🗑" selon la préférence */
    font-size: 1.1rem;
    line-height: 1;
}

/* Effet visuel au survol */
.remove-file:hover {
    background: #e60000;
    transform: scale(1.1);
}

/* =====================================================================
   🗑️ 17. BOUTON DE SUPPRESSION DES FICHIERS (CRÉATION)
===================================================================== */
.remove-file-btn {
    background: #ff4d4d;
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.remove-file-btn i {
    font-size: 1.1rem;
    pointer-events: none;
}

.remove-file-btn:hover {
    background: #e60000;
    transform: scale(1.1);
}


.contact-group {
  margin-bottom: 1.2rem;
}

.contact-group-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.3rem;
  border-left: 3px solid var(--primary-color, #ff6600);
  padding-left: 8px;
}

.selected-contacts,
.manual-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}


.contact-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.contact-tag[data-type="auto"] {
  background: #eaf5ff;
  border: 1px solid #b6dafc;
}

.contact-tag[data-type="manual"] {
  background: #fff3e6;
  border: 1px solid #ffd8b3;
}

.contact-tag:hover {
  background: #f2f2f2;
}

.contact-tag .remove-tag {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1rem;
}

.contact-tag .remove-tag:hover {
  color: red;
}

.manual-email-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.manual-email-input {
  width: 350px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.remove-manual-email {
  background: none;
  border: none;
  color: red;
  font-size: 1.2rem;
  cursor: pointer;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

/* Nouveau wrapper pour isoler le positionnement */
.contact-search-wrapper {
  position: relative;
  width: 350px;
}

.contact-search-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}



.search-results {
  position: absolute;
  top: 100%; /* directement sous l'input */
  left: 0;
  z-index: 9999;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  margin-top: 2px;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: #f3f6ff;
}

.user-avatar {
  background: var(--primary-color, #007bff);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  margin-right: 8px;
}

.user-info {
  display: flex;
  flex-direction: column;
}
.invalid-email {
  border-color: red !important;
  background-color: #ffe6e6;
  box-shadow: 0 0 4px rgba(255, 0, 0, 0.4);
}

.invalid-email:focus {
  outline: none;
  box-shadow: 0 0 6px rgba(255, 0, 0, 0.6);
}

/* =====================================================================
   🧾 Correction largeur du ticket
===================================================================== */
.ticket-header-card {
  width: 100%;
  max-width: none;
  padding: 0;
  background: none;
  box-shadow: none;
  border: none;
}

.ticket-header {
  width: 100%;
  box-sizing: border-box;
}

/* Si tu veux que tout le ticket (y compris messages, contacts, etc.) s’aligne parfaitement */
.ticket-details-card,
.messages-card {
  width: 100%;
  box-sizing: border-box;
}
/* === Statut sous le titre === */
.status-below-title {
  margin-top: 8px;
}

.status-below-title .status-badge {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
}

/* === Alignement uniforme des zones === */
.ticket-header,
.ticket-details-card,
.messages-card {
  max-width: 1400px;   /* même largeur que .container */
  margin: 0 auto 20px auto;
  width: 100%;
  box-sizing: border-box;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.meta-item strong {
  display: block;
  margin-bottom: 4px;
  color: #222;
}

.meta-item span {
  display: block;
  color: #444;
  font-size: 0.95rem;
}

.full-width {
  flex: 1 1 100%;
}

.category-selects {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.status-below-title {
  margin-top: 8px;
}


.attachment-preview {
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    max-width: 500px;
    width: 100%;      /* évite que ça dépasse sur mobile */
    margin: 8px 0;    /* marge verticale */
    border-radius: 10px;
}

.attachment-thumb {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.attachment-thumb.icon {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    color: #888;
}

.attachment-info {
    flex: 1;
}

.attachment-filename {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 15px;
}

.attachment-size {
    font-size: 13px;
    color: #777;
}

.attachment-actions a {
    font-size: 24px;
    color: #555;
    text-decoration: none;
}

.attachment-actions a:hover {
    color: #000;
}

.attachment-list,
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.messages-container .message {
    width: 75% !important; /* largeur fixe de 75% */
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-radius: 12px;
}

/* Alignement des messages */
.messages-container .message.received {
    align-self: flex-start;
    background-color: #f2f2f2;
    border: 1px solid #ddd;
}

.messages-container .message.sent {
    align-self: flex-end;
    background-color: #e8f5ff;
    border: 1px solid #c9e7ff;
}

/* Responsive : sur mobile, réduire à 95% */
@media (max-width: 800px) {
    .messages-container .message {
        width: 95% !important;
    }
}

/* USERS */
.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    width:150px;
    text-align:center;
}

/* Couleurs par rôle */
.role-badge.user {
    background-color: #6c757d;   /* gris */
}

.role-badge.manager {
    background-color: #91afc9;   /* gris */
}

.role-badge.moderator {
    background-color: #0074d9;   /* bleu */
}

.role-badge.admin {
    background-color: #d9534f;   /* rouge */
}

.role-badge.super-moderator {
    background-color: #5f13a1;   /* violet */
}


.user-form-container {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.user-picker-wrapper { position: relative; }

#user_picker{
    width: 100%;
    padding: .5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.user-picker-results{
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow);
}

.user-picker-item{
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,.04);
}
.user-picker-item:hover{
    background: #f3f3f3;
}
.user-picker-item.empty{
    cursor: default;
    opacity: .7;
}

.club-search-wrapper { position: relative; }

.club-search-results {
    position: absolute;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: var(--shadow);
    margin-top: 4px;
}

.club-suggestion-item {
    padding: 8px;
    cursor: pointer;
}
.club-suggestion-item:hover { background: #f3f3f3; }

.selected-clubs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}


.club-tag{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid #ddd;
  border-radius:999px;
  background:#f7f7f7;
  font-size:.9em;
}
.club-tag button{
  border:none;
  background:transparent;
  cursor:pointer;
  font-size:1em;
  line-height:1;
}

.club-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 6px 10px;
    background: #fafafa;
    font-size: 0.92em;
}

.club-tag-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font-size: 0.95em;
    line-height: 1;
    opacity: .75;
}
.club-tag-remove:hover { opacity: 1; }

.clubs-badge{
    display:inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f5f7;
    border: 1px solid #e2e6ea;
    font-size: .85rem;
    line-height: 1.1;
    color: #333;
}

.clubs-tooltip{
    cursor: help;
    text-decoration: underline dotted;
    position: relative;
    display: inline-block;
}

.clubs-tooltip:hover::after{
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    min-width: 240px;
    max-width: 420px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #111;
    color: #fff;
    white-space: pre-line; /* ✅ respecte les \n => 1 ligne par club */
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
    z-index: 9999;
}

.clubs-tooltip:hover::before{
    content: "";
    position: absolute;
    left: 18px;
    top: calc(100% + 2px);
    border: 6px solid transparent;
    border-bottom-color: #111;
    z-index: 9999;
}

.has-tooltip{
    cursor: help;
    position: relative;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.has-tooltip:hover::after{
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: calc(100% + 8px);

    min-width: 260px;
    max-width: 420px;

    background: #111;
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.22);

    white-space: pre-line; /* ✅ respecte les \n */
    font-size: .85rem;
    line-height: 1.25;
    z-index: 999;
}

.has-tooltip:hover::before{
    content: "";
    position: absolute;
    left: 18px;
    top: calc(100% + 2px);
    border: 7px solid transparent;
    border-bottom-color: #111;
    z-index: 999;
}

/* IMPORTANT : éviter que le conteneur/table coupe le tooltip */
.data-table-container { overflow-x: auto; overflow-y: visible !important; }
.data-table, .data-table tr, .data-table td, .data-table th { overflow: visible; }

.data-table td:nth-child(7) {
    position: relative;
    overflow: visible;
}

/* Bouton "membres" avec tooltip */
.members-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Tooltip */
.members-btn.has-tooltip::after{
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 9999;

  /* look */
  background: #111;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0,0,0,.25);

  /* ✅ multi-lignes */
  white-space: pre-line;       /* interprète les \n */
  line-height: 1.35;
  font-size: 0.9rem;

  /* taille */
  min-width: 220px;
  max-width: 340px;

  /* comportement */
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

/* Petite flèche */
.members-btn.has-tooltip::before{
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #111;
  opacity: 0;
  transition: opacity .12s ease;
}

.members-btn.has-tooltip:hover::after,
.members-btn.has-tooltip:hover::before{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.has-nice-tooltip{ position: relative; }

.has-nice-tooltip:hover::after{
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 10px);

    background: rgba(20, 20, 20, .92);
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(0,0,0,.22);
    z-index: 9999;

    white-space: pre-line; /* ✅ retours à la ligne */
    text-align: left;
    min-width: 240px;
    max-width: 360px;

    /* ✅ si beaucoup de membres */
    max-height: 260px;
    overflow: auto;

    font-size: .9rem;
    line-height: 1.25rem;
}

.has-nice-tooltip:hover::before{
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 4px);
    border: 7px solid transparent;
    border-top-color: rgba(20, 20, 20, .92);
    z-index: 9999;
}

/* Conteneur : moins d’air */
.data-table-container{
  padding: 6px 8px;
}

/* Table compacte */
.data-table.compact{
  font-size: 12.5px;
  line-height: 1.2;
}

/* Cellules compactes */
.data-table.compact th,
.data-table.compact td{
  padding: 6px 8px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Titres : un peu plus serrés */
.data-table.compact thead th{
  padding-top: 7px;
  padding-bottom: 7px;
}

/* Pour éviter les colonnes énormes : ellipsis */
.data-table.compact td{
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colonne Titre : autorise un peu plus, mais toujours contrôlée */
.data-table.compact td.col-title{
  max-width: 340px;
}

/* Boutons plus petits */
.btn-small, .data-table .btn-small{
  padding: 4px 8px;
  font-size: 12px;
}

/* Badge statut plus discret */
.status-badge{
  padding: 3px 7px;
  font-size: 12px;
}

.last-intervenant-blue{
  background: #1e66ff;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
}

.history-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    padding: 10px 14px;
    border-left: 4px solid #3498db;
    background: #f9fafc;
    border-radius: 6px;
}

.history-header {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.history-body {
    font-size: 14px;
}

.history-label {
    font-weight: 600;
}

.history-details {
    margin-top: 4px;
    opacity: 0.8;
}

.history-change {
    margin-top: 4px;
    font-size: 13px;
}

.old-value {
    color: #c0392b;
}

.new-value {
    color: #27ae60;
}















/* ===== Mise en page générale gauche / droite ===== */
.ticket-page-layout{
  display: grid;
  grid-template-columns: 560px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.ticket-left-column,
.ticket-right-column{
  min-width: 0;
}

/* ===== Carte résumé ticket (gauche) ===== */
.ticket-summary-card{
  padding: 24px 26px 18px;
  border-radius: 22px;
  background: #fff;
}

.ticket-summary-card .ticket-header-left h1{
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
  color: #111;
}

.ticket-summary-card .status-below-title{
  margin-top: 14px;
  margin-bottom: 10px;
}

.ticket-summary-card .status-below-title .status-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
}

/* Couleurs statut proches de la capture */
.ticket-summary-card .status-badge.nouveau{
  background: #ff160d;
  color: #fff;
}
.ticket-summary-card .status-badge.en-cours{
  background: #f7a600;
  color: #fff;
}
.ticket-summary-card .status-badge.resolu,
.ticket-summary-card .status-badge.résolu{
  background: #1f9d39;
  color: #fff;
}
.ticket-summary-card .status-badge.clos{
  background: #bdbdbd;
  color: #222;
}

/* ===== Bloc gris interne ===== */
.ticket-summary-card .ticket-meta-card.compact{
  margin-top: 8px;
}

.ticket-summary-card .ticket-meta-card .meta-body{
  background: #f7f7fa;
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: none;
}

/* Ligne avec infos à gauche et selects à droite */
.ticket-summary-card .meta-row-summary{
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 22px;
  align-items: start;
  margin: 0;
}

.ticket-summary-card .meta-item{
  min-width: 0;
}

.ticket-summary-card .meta-item-infos strong{
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 700;
  color: #2a2a2a;
}

.ticket-summary-card .meta-item-infos span{
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: #4a4a4a;
}

.ticket-summary-card .meta-item-infos br{
  display: block;
  content: "";
  margin-top: 14px;
}

.ticket-summary-card .meta-item-infos #club-preview-name {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.45;
  color: #4a4a4a;
  word-break: break-word;
}

/* ===== Selects à droite ===== */
.ticket-summary-card .meta-item-taxonomy{
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.ticket-summary-card .category-selects-vertical{
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 0;
}

.ticket-summary-card .category-selects-vertical .styled-select,
.ticket-summary-card .category-selects-vertical .styled-input {
  width: 100%;
  min-width: 0 !important;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #d8d8dd;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;   /* au lieu de 14px */
  color: #333;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.ticket-summary-card .category-selects-vertical .styled-input,
.ticket-summary-card .club-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #d8d8dd;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #333;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* ===== Bouton enregistrer ===== */
.ticket-summary-card .taxonomy-actions{
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.ticket-summary-card .taxonomy-actions .btn-secondary,
.ticket-summary-card .taxonomy-actions button{
  min-width: 230px;
  height: 32px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
  box-shadow: none;
}

.ticket-summary-card .taxonomy-actions .btn-secondary:hover,
.ticket-summary-card .taxonomy-actions button:hover{
  background: var(--primary-hover);
  transform: none;
}

/* ===== Version lecture seule ===== */
.ticket-summary-card .taxonomy-readonly{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-summary-card .taxonomy-readonly span{
  display: block;
  padding: 9px 12px;
  border: 1px solid #d8d8dd;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: #333;
}

.problem-description {
  margin-top: 10px;
}

.description-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.description-header h3 {
  margin: 0;
  color: var(--primary-color);
}

.create-description-body {
  padding: 0;
  background: transparent;
}

.create-description-body textarea,
#description {
  display: block;
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  border: 1px solid #d8d8dd;
  border-radius: 10px;
  background: #fff;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}


/* ===== Responsive ===== */
@media (max-width: 1100px){
  .ticket-page-layout{
    grid-template-columns: 1fr;
  }

  .ticket-summary-card .meta-row-summary{
    grid-template-columns: 1fr;
  }

  .ticket-summary-card .meta-item-taxonomy{
    margin-top: 6px;
  }

  .ticket-summary-card .taxonomy-actions{
    justify-content: flex-start;
  }
}


.custom-toast {
    position: fixed;
    top: 100px;
    left: 30px;
    background: #fe4c4c;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .3s ease, transform .3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,.2);
}

.custom-toast.show {
    opacity: 1;
    transform: translateY(0);
}