/* DESIGN ORANGE/NOIR MÉTALLIQUE RESPONSIVE */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #0f0f0f 100%);
    color: #f0f0f0;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    padding: clamp(20px, 5vw, 35px);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 0 0 1px rgba(255,165,0,0.2);
    border: 1px solid rgba(255,165,0,0.3);
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff8c00, #ffa500, #ff4500);
    box-shadow: 0 2px 10px rgba(255,140,0,0.5);
}

.login-box {
    max-width: 420px;
    width: 90%;
    margin: clamp(40px, 15vh, 80px) auto;
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    padding: clamp(25px, 8vw, 45px);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 0 0 1px rgba(255,165,0,0.2);
    border: 1px solid rgba(255,165,0,0.3);
    text-align: center;
}

h1 { 
    background: linear-gradient(45deg, #ffa500, #ff8c00, #ff4500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: clamp(24px, 6vw, 32px);
    font-weight: 700;
    margin-bottom: clamp(20px, 5vw, 30px);
    text-shadow: 0 2px 10px rgba(255,165,0,0.3);
}

h2 { 
    color: #ffd700;
    font-size: clamp(18px, 4.5vw, 24px);
    font-weight: 600;
    margin-bottom: clamp(15px, 4vw, 20px);
}

h3 { 
    color: #ffaa00;
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 500;
    margin-bottom: 12px;
}

/* INPUTS RESPONSIFS */
input, textarea, select {
    width: 100%;
    padding: clamp(12px, 3vw, 16px) clamp(15px, 4vw, 20px);
    margin: 10px 0;
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border: 2px solid #444;
    border-radius: 12px;
    color: #f0f0f0;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

/* Les <option> d'un <select> héritent de la couleur de texte claire
   ci-dessus, mais le navigateur affiche le menu déroulant OUVERT avec son
   propre fond (souvent blanc), jamais avec le dégradé sombre défini sur
   .select lui-même — d'où un texte clair illisible sur fond clair, visible
   seulement au survol (highlight du navigateur). On fixe donc explicitement
   un fond sombre sur les options elles-mêmes. */
select option {
    background: #2a2a2a;
    color: #f0f0f0;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #ffa500;
    box-shadow: 
        0 0 0 4px rgba(255,165,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
    background: linear-gradient(145deg, #404040, #303030);
    transform: translateY(-1px);
}

textarea { 
    height: clamp(100px, 20vw, 140px); 
    resize: vertical; 
}

/* BOUTONS RESPONSIFS */
.btn {
    display: inline-block;
    padding: clamp(12px, 3vw, 16px) clamp(20px, 5vw, 32px);
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 700;
    text-decoration: none;
    border-radius: 12px;
    margin: 8px 4px;
    color: #1a1a1a;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
    min-width: clamp(120px, 25vw, 160px);
    text-align: center;
    flex: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before { left: 100%; }
.btn:hover { transform: translateY(-3px); box-shadow: 0 15px 35px rgba(0,0,0,0.6); }
.btn:active { transform: translateY(-1px); }

/* COULEURS BOUTONS */
.btn-primary { background: linear-gradient(145deg, #ffa500, #ff8c00); box-shadow: 0 8px 25px rgba(255,165,0,0.4); }
.btn-success { background: linear-gradient(145deg, #ffaa00, #ff8800); box-shadow: 0 8px 25px rgba(255,170,0,0.5); }
.btn-danger { background: linear-gradient(145deg, #ff4444, #cc0000); box-shadow: 0 8px 25px rgba(255,68,68,0.4); }
.btn-warning { background: linear-gradient(145deg, #ffd700, #ffaa00); color: #1a1a1a; box-shadow: 0 8px 25px rgba(255,215,0,0.4); }
.btn-info { background: linear-gradient(145deg, #00bfff, #0099cc); box-shadow: 0 8px 25px rgba(0,191,255,0.4); }

/* TABLE RESPONSIVE */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 25px 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
}

th {
    background: linear-gradient(90deg, #ffa500, #ff8c00, #ff4500);
    color: #1a1a1a;
    font-weight: 700;
    padding: clamp(12px, 3vw, 18px) 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: clamp(11px, 2.5vw, 13px);
}

td {
    padding: clamp(12px, 3vw, 18px) 16px;
    border-bottom: 1px solid rgba(255,165,0,0.1);
    color: #f0f0f0;
}

tr:hover td { background: rgba(255,165,0,0.1); transform: scale(1.01); }

/* MOBILE TABLE SCROLL */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        border-radius: 15px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
}

/* LISTES LONGUES : cadre à hauteur FIXE (pas seulement max-height), pour
   que le panneau soit visible même avec peu de lignes — le défilement
   vertical n'apparaît que si le contenu dépasse, mais le cadre, lui, est
   toujours là. En-tête de colonnes figé. Menus/boutons restent hors de
   ce conteneur et toujours visibles.
   Le défilement HORIZONTAL est toujours actif (overflow-x: auto) : sur
   desktop il ne se voit jamais puisque le tableau tient déjà en largeur,
   mais sur mobile/tablette, avec plusieurs colonnes + boutons d'action,
   le tableau a besoin de sa largeur naturelle (min-width ci-dessous) et
   doit pouvoir défiler horizontalement au doigt plutôt que d'écraser ses
   colonnes pour tenir de force dans l'écran. */
.list-scroll {
    height: 340px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 2px solid rgba(255,165,0,0.6);
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    margin: 25px 0;
}
.list-scroll table {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    min-width: 640px;
}
.list-scroll th {
    position: sticky;
    top: 0;
    z-index: 2;
}
/* Si la liste est courte, le cadre reste visible avec un peu d'espace
   plutôt que de s'écraser sur le contenu. */
.list-scroll table tr:last-child td { border-bottom: none; }

/* Poignée de redimensionnement (coin bas-droit), pour agrandir manuellement
   le tableau "Tous les tickets" (list_tickets.php) — demandé spécifiquement
   pour cette liste. Les autres tableaux (.list-scroll seul, sans ce
   modificateur : files.php, admin_users.php, categories.php...) restent à
   hauteur fixe. overflow étant déjà "auto" via .list-scroll, le navigateur
   affiche nativement une poignée de redimensionnement dans le coin. */
.list-scroll-resizable {
    resize: vertical;
    min-height: 200px;
    max-height: 80vh;
}

/* Indice visuel "on peut glisser latéralement", affiché seulement quand
   le tableau risque de dépasser la largeur de l'écran (en dessous de sa
   min-width de 640px, cf. .list-scroll table ci-dessus). */
.scroll-hint {
    display: none;
    font-size: 12px;
    opacity: 0.7;
    margin: -10px 0 10px 0;
}
@media (max-width: 700px) {
    .scroll-hint { display: block; }
}

/* STATS RESPONSIVES */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(15px, 4vw, 25px);
    margin: clamp(25px, 6vw, 35px) 0;
}

.stat-card {
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    padding: clamp(25px, 6vw, 35px);
    border-radius: 20px;
    text-align: center;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid rgba(255,165,0,0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card div:first-child { 
    font-size: clamp(28px, 10vw, 36px); 
    margin-bottom: 8px; 
}

/* GRILLE FORMULAIRES RESPONSIVE */
.forms { 
    display: grid; 
    grid-template-columns: 1fr;
    gap: clamp(25px, 6vw, 40px); 
    margin: clamp(25px, 6vw, 35px) 0; 
}

@media (min-width: 900px) { 
    .forms { grid-template-columns: 1fr 1fr; } 
}

/* SECTION REPLIABLE (ex: "Ajouter un utilisateur") */
.user-form-details {
    background: rgba(255,165,0,0.06);
    border: 1px solid rgba(255,165,0,0.25);
    border-radius: 12px;
    padding: 4px 22px 4px 22px;
    margin-bottom: 25px;
}
.user-form-details[open] {
    padding-bottom: 18px;
}
.user-form-details summary {
    cursor: pointer;
    padding: 16px 0;
    font-size: clamp(18px, 4vw, 22px);
    font-weight: bold;
    color: #ffa500;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}
.user-form-details summary::-webkit-details-marker { display: none; }
.user-form-details summary::before {
    content: '▶';
    font-size: 13px;
    display: inline-block;
    transition: transform 0.2s ease;
}
.user-form-details[open] summary::before {
    transform: rotate(90deg);
}
.user-form-details summary:hover {
    opacity: 0.85;
}

/* MENU BOUTONS RESPONSIF */
.menu-center {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(8px, 2vw, 15px);
    margin: clamp(25px, 6vw, 30px) 0;
    padding: clamp(15px, 4vw, 20px);
    background: rgba(255,165,0,0.05);
    border-radius: 15px;
    border: 1px solid rgba(255,165,0,0.2);
}

/* INFO GRID RESPONSIVE */
.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    border-radius: 15px;
    border: 1px solid rgba(255,165,0,0.2);
}

@media (min-width: 768px) {
    .info-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* SUIVI RESPONSIF */
.suivi {
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    padding: clamp(20px, 5vw, 30px);
    border-radius: 15px;
    white-space: pre-wrap;
    font-family: 'Consolas', monospace;
    font-size: clamp(13px, 3vw, 15px);
    border-left: 5px solid #ffa500;
    margin: 25px 0;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

/* MESSAGES RESPONSIFS */
.success, .error { 
    padding: clamp(15px, 4vw, 18px) clamp(20px, 5vw, 25px);
    border-radius: 12px;
    margin: 20px 0;
    font-weight: 600;
    font-size: clamp(14px, 3.5vw, 16px);
}

/* SMARTPHONE < 480px */
@media (max-width: 480px) {
    body { padding: 5px; }
    .container, .login-box { 
        width: 98%; 
        padding: 20px; 
        margin: 5px auto; 
        border-radius: 15px;
    }
    .btn { 
        min-width: 100%; 
        margin: 5px 0; 
        padding: 18px; 
    }
    table { font-size: 13px; }
}

/* TABLETTE 481-900px */
@media (min-width: 481px) and (max-width: 900px) {
    .container { width: 96%; padding: 25px; }
    .btn { min-width: 140px; }
}

/* PC > 900px */
@media (min-width: 901px) {
    body { padding: 20px; }
}

/* ANIMATIONS OPTIMISÉES MOBILE */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* TRI DES TABLEAUX (colonnes cliquables, tri croissant/décroissant) */
th.sortable-col {
    cursor: pointer;
    user-select: none;
}
th.sortable-col:hover {
    background: rgba(255,255,255,0.12);
}
.sort-indicator {
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.9;
}

/* BARRE D'ACTIONS DE SÉLECTION (espace fichiers) */
.files-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    margin: 15px 0 8px 0;
    background: rgba(255,165,0,0.08);
    border: 1px solid rgba(255,165,0,0.3);
    border-radius: 12px;
}
.files-toolbar-selectall {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #ffd700;
    cursor: pointer;
}
.files-toolbar-selectall input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.files-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.files-toolbar-actions .btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}
.file-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

/* POPUP D'APERÇU DE FICHIER */
.preview-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.preview-modal-box {
    background: #1a1a1a;
    border: 2px solid rgba(255,165,0,0.6);
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,165,0,0.3);
}
.preview-modal-header span.preview-modal-title {
    font-weight: bold;
    color: #ffa500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}
.preview-modal-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.preview-modal-body {
    padding: 20px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 200px;
}
.preview-modal-body img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
}
.preview-modal-body iframe {
    width: 100%;
    height: 75vh;
    border: none;
    background: #fff;
    border-radius: 8px;
}

/* MODE PLEIN ÉCRAN de la popup d'aperçu (API Fullscreen native) */
.preview-modal-box:fullscreen,
.preview-modal-box:-webkit-full-screen {
    max-width: none;
    max-height: none;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}
.preview-modal-box:fullscreen .preview-modal-body,
.preview-modal-box:-webkit-full-screen .preview-modal-body {
    height: 100%;
}
.preview-modal-box:fullscreen .preview-modal-body img,
.preview-modal-box:fullscreen .preview-modal-body iframe,
.preview-modal-box:-webkit-full-screen .preview-modal-body img,
.preview-modal-box:-webkit-full-screen .preview-modal-body iframe {
    max-height: 100%;
    height: 100%;
}

.link_retour {
  color: orange;
}