/* =============================
   GLOBAL & LAYOUT
   ============================= */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #222;
    margin: 0;
    padding: 0;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* =============================
   FILE CARD (LISTE FICHIERS)
   ============================= */
.file-item, #filesList .file-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #fff;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s, transform 0.2s;
}
.file-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
}
.file-main-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}
.file-info {
    flex: 1 1 auto;
    min-width: 200px;
}
.file-name {
    font-weight: 600;
    font-size: 1.05em;
    color: #2c3e50;
    margin-bottom: 0.2em;
}
.file-short-summary {
    font-size: 0.98em;
    color: #444;
    background: #f4f7fa;
    border-left: 3px solid #0d6efd;
    padding: 0.45em 0.8em;
    border-radius: 0.3em;
    margin: 0.4em 0 0.2em 0;
    font-style: italic;
}
.file-date {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-bottom: 0.5em;
}

/* =============================
   BUTTONS & ACTIONS
   ============================= */
.file-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    min-width: 140px;
    margin-left: 32px;
}
.file-action-btn {
    min-width: 140px;
    max-width: 100%;
    width: 140px;
    box-sizing: border-box;
    display: block;
    margin-bottom: 6px;
    font-size: 1em;
}
.file-actions button, .file-actions .btn-download {
    background: #0d6efd;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}
.file-actions button:hover, .file-actions .btn-download:hover {
    background: #084298;
}
.file-actions .btn-danger {
    background: #fff;
    color: #dc3545;
    border: 1px solid #dc3545;
}
.file-actions .btn-danger:hover {
    background: #dc3545;
    color: #fff;
}

/* =============================
   TAGS
   ============================= */
.file-tags-zone {
    margin-top: 0.8em;
    padding: 0.7em 0.7em 0.3em 0.7em;
    background: #f4f7fa;
    border-radius: 0.5em;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}
.tag, .file-tags .tag {
    display: inline-block;
    padding: 0.35em 0.8em;
    font-size: 0.88em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 1em;
    background-color: #6c757d;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    transition: background 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.tag[data-category="Genres littéraires"] { background-color: #3498db; }
.tag[data-category="Marché et distribution"] { background-color: #2ecc71; }
.tag[data-category="Métiers du livre"] { background-color: #e74c3c; }
.tag[data-category="Techniques et outils"] { background-color: #9b59b6; }
.tag[data-category="Publics cibles"] { background-color: #f1c40f; color: #333; }
.tag-checkbox input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}
.tag-checkbox {
    display: inline-block;
    margin: 0 0.2em 0.2em 0;
    position: relative;
}
.tag-checkbox .tag {
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.tag-checkbox input[type="checkbox"]:checked + .tag {
    background-color: #0d6efd;
    color: #fff;
}
.tag-checkbox input[type="checkbox"]:focus + .tag {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}
.tags-container .tag-checkbox input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}
.tags-container .tag-checkbox .tag {
    cursor: pointer;
}
.selected-tags {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    min-height: 38px;
    background: #f8f9fa;
}

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 900px) {
    .file-main-row {
        flex-direction: column;
        align-items: stretch;
    }
    .file-actions {
        flex-direction: row;
        align-items: flex-end;
        justify-content: flex-end;
        gap: 10px;
        margin-left: 0;
        margin-top: 10px;
    }
    .file-action-btn {
        min-width: 90px;
        width: 90px;
        font-size: 0.9em;
        padding: 0.4em 0.6em;
        margin-bottom: 0;
    }
}
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
}

/* =============================
   AUTRES ELEMENTS (rationalisés)
   ============================= */
.zone-status {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}
.debug-section {
    display: none;
    margin-bottom: 1rem;
}
#uploadStatus {
    margin-top: 1rem;
}
.loading {
    opacity: 0.5;
    pointer-events: none;
}
