@import url("ROOT.css");
/* --------------------------------------------------------------- */
/* ----------------------- SIDEBAR ------------------------------- */
/* --------------------------------------------------------------- */
.doc-sidebar {
    width: 300px;
    background: var(--surface);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
}
.doc-sidebar h3 {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    color: var(--primary);
}
.doc-sidebar ul {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    justify-content: space-between;
}
.doc-sidebar ul li {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 5px; /* Marges plus fines comme sur l'image */
    background: var(--bg-dark); /* Fond très sombre */
    border: none; /* Retrait de la bordure */
    border-radius: var(--radius, 6px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between; /* Aligne le texte à gauche et la corbeille à droite */
    align-items: center;
    color: var(--text-muted); /* Texte gris clair */
}

.doc-sidebar ul li:hover {
    background: #475569;
}
.doc-sidebar ul li .delBtn {
    background: #ef4444; /* Rouge vif comme sur l'image */
    color: black; /* Icône noire sur l'image */
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.doc-sidebar .doc-search {
    padding: 10px;
    border-radius: var(--radius, 6px);
    border: none; /* Pas de bordure visible sur l'image */
    background: var(--bg-dark); /* Fond blanc */
    color: var(--doc-text); /* Texte noir */
    margin-bottom: 15px;
    width: 100%;
    outline: none;
}

/* --------------------------------------------------------------- */
/* ----------------- SIDEBAR FOOTER ------------------------------ */
/* --------------------------------------------------------------- */
.doc-sidebar-footer {
  margin-top: 8px;
  padding: 10px 7px 0 7px;
  border-top: 1px solid var(--border);
}
.doc-sidebar-footer .doc-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border-radius: 6px;
    background: transparent; /* Fond transparent/sombre */
    border: 1px solid #333; /* Bordure discrète */
    color: #a0a0a0; /* Texte gris clair */
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
}
.doc-sidebar-footer .doc-btn:hover {
  background: var(--primary-hover);
  background-color: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--primary);
}
.doc-sidebar-footer .doc-btn-add:hover { 
    background: transparent;
    color: var(--success); 
    border-color: var(--success); 
}
/* --------------------------------------------------------------- */
/* -------------------- DOCUMENT SEARCH -------------------------- */
/* --------------------------------------------------------------- */
.doc-search {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}
.doc-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.doc-search::placeholder {
    color: var(--text-muted);
}
/* --------------------------------------------------------------- */
/* --------------------- PAGINATION ------------------------------ */
/* --------------------------------------------------------------- */
.doc-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}
.doc-pagination button {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--doc-text);
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}
.doc-pagination button:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}
.doc-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.doc-pagination .page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0 10px;
}
/* --------------------------------------------------------------- */
/* ----------------- DOCUMENT LAYOUT ----------------------------- */
/* --------------------------------------------------------------- */
.doc-container {
    flex: 1;
    margin-left: 240px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.doc-content-wrapper {
    width: 100%;
    max-width: 1000px;
    background: #e2e8f0; /* Le gris clair/argenté de ton image */
    color: var(--doc-text); /* Le texte devient noir pour être lisible sur le gris */
    border: none; /* Pas de bordure sur l'image */
    border-radius: 8px;
    padding: 40px;
    min-height: 90vh; /* Pour qu'il descende bien jusqu'en bas */
}
/* --------------------------------------------------------------- */
/* ----------------- DOCUMENT HEADER ----------------------------- */
/* --------------------------------------------------------------- */
.doc-header {
    position: relative; /* Permet de positionner la date en absolu par rapport à cet en-tête */
    display: flex;
    justify-content: center; /* Centre parfaitement le titre */
    align-items: flex-start;
    margin-bottom: 45px;
    width: 100%;
}
.doc-header h1, #viewTitle {
    margin: 0;
    font-size: 1.8rem;
    color: #4b88ff; /* Bleu clair */
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
    max-width: 70%; /* Empêche un titre très long de passer par dessus la date */
}
.doc-details {
    position: absolute;
    top: 0;
    right: 0;
    text-align: right;
    font-size: 0.70rem;
    color: #444444; 
    display: flex;
    flex-direction: column; /* Superpose les infos (Créé le : / Modifié le :) */
}
.doc-details .info, 
.doc-details .value {
    background: transparent;
    color: inherit;
    padding: 0;
    margin: 0;
}
/* --------------------------------------------------------------- */
/* -------------- LA GRILLE D'INFORMATIONS (HAUT) ---------------- */
/* --------------------------------------------------------------- */
.doc-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Crée 2 ou 3 colonnes automatiquement */
    gap: 20px;
    background: #f8fafc; /* Un blanc très très légèrement bleuté pour contraster avec la feuille */
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.meta-block h2 {
    font-size: 0.9rem !important; /* Plus petit, plus pro */
    text-transform: uppercase;
    color: #64748b; /* Gris-bleu discret pour les labels */
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    font-weight: bold;
}
.meta-block ul {
    list-style: none; /* On retire les puces noires moches */
    padding: 0;
    margin: 0;
    color: #0f172a; /* Noir doux */
    font-size: 1rem;
    font-weight: 500;
}
.meta-block ul li {
    padding-bottom: 5px;
}
/* --------------------------------------------------------------- */
/* -------------------- DOCUMENT AVATARS ------------------------- */
/* --------------------------------------------------------------- */
.doc-avatar {
    width: 80px;
    height: 80px;
    border-radius: 30%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
    margin: 0 auto;
}
.doc-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 30%;
    background-color: var(--bg-dark);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: bold;
    margin: 0 auto;
}
/* --------------------------------------------------------------- */
/* -------------------- DOCUMENT DETAILS ------------------------- */
/* --------------------------------------------------------------- */

/* --------------------------------------------------------------- */
/* -------------------- DOCUMENT STATUS -------------------------- */
/* --------------------------------------------------------------- */
.doc-status {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.doc-status-item {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
}
.doc-status-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}
.doc-status-value {
    color: var(--doc-text);
    font-size: 1rem;
    font-weight: 500;
}
.doc-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}
.doc-status.pending {
    background: rgba(239, 151, 68, 0.15);
    color: var(--warning);
}
.doc-status.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
.doc-status.info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}
/* --------------------------------------------------------------- */
/* ------------------ LA ZONE DE TEXTE (RÉCIT) ------------------- */
/* --------------------------------------------------------------- */
.doc-text {
    background: #ffffff; /* Fond blanc pur pour la lecture */
    padding: 25px;
    border-radius: 6px;
    border-left: 4px solid #4b88ff; /* La petite barre bleue "Police" sur le côté */
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
.doc-text h2 {
    font-size: 1.1rem;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 800;
}
.doc-text p {
    margin: 0;
    line-height: 1.6; /* Aère le texte pour mieux lire */
    color: #334155;
    font-size: 1.05rem;
}
/* --------------------------------------------------------------- */
/* --------------- LA ZONE DES PHOTOS (PREUVES) ------------------ */
/* --------------------------------------------------------------- */
.doc-evidence {
    background: #ffffff; /* Fond blanc pur pour la lecture */
    padding: 25px;
    border-radius: 6px;
    border-left: 4px solid #4b88ff; /* La petite barre bleue "Police" sur le côté */
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
.doc-evidence h2 {
    font-size: 1.1rem;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 800;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
/* Each image wrapper must be positioned relative for the button overlay */
.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f2f2f2;
}
/* Images fill their cell */
.photo-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Bottom-right zoom button */
.zoom-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.zoom-btn:hover {
    background: rgba(0,0,0,0.8);
}
.zoom-btn::before {
    content: "🔍";
    font-size: 18px;
}
/* --------------------------------------------------------------- */
/* ----------------- DOCUMENT TOTALS ----------------------------- */
/* --------------------------------------------------------------- */
.doc-totals {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.doc-totals p {
    font-size: 1rem;
    margin: 8px 0;
    color: var(--doc-text);
}
.doc-totals .total-label {
    color: var(--text-muted);
}
.doc-totals .total-value {
    font-weight: 700;
    color: var(--primary);
}
/* --------------------------------------------------------------- */
/* ------------------- DOCUMENT ACTIONS -------------------------- */
/* --------------------------------------------------------------- */
.doc-action-btn {
    padding: 8px 12px;
    font-size: 1.2rem;
    border: none;
    margin-right: 4px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.doc-action-btn.validate {
    background: var(--saveBtn);
    color: var(--doc-btn);
}
.doc-action-btn.validate:hover {
    background: var(--saveBtn-hvr);
}
.doc-action-btn.edit {
    background: var(--editBtn);
    color: var(--doc-btn);
}
.doc-action-btn.edit:hover {
    background: var(--editBtn-hvr);
}
.doc-action-btn.add {
    background: var(--addBtn);
    color: var(--doc-btn);
}
.doc-action-btn.add:hover {
    background: var(--addBtn-hvr);
}
.doc-action-btn.view {
    background: var(--surface-hover);
    color: var(--doc-text);
    border: 1px solid var(--border);
}
.doc-action-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.doc-action-btn:last-child {
    margin-right: 0;
}
/* --------------------------------------------------------------- */
/* --------------------- DOCUMENT FORM --------------------------- */
/* --------------------------------------------------------------- */
.doc-form {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 25px;
}
.doc-form.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.doc-form input,
.doc-form select,
.doc-form textarea {
    flex: 1;
    min-width: 120px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--doc-text);
    padding: 0 12px;
    border-radius: 6px;
    outline: none;
    font-size: 0.95rem;
}
.doc-form textarea {
    height: auto;
    min-height: 100px;
    padding: 12px;
    resize: vertical;
}
.doc-form input:focus,
.doc-form select:focus,
.doc-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.doc-form button[type="submit"] {
    height: 40px;
    padding: 0 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}
.doc-form button[type="submit"]:hover {
    background: #0D9668;
}
/* --------------------------------------------------------------- */
/* ----------------- MESSAGES & NOTIFICATIONS -------------------- */
/* --------------------------------------------------------------- */
.doc-msg {
    color: #222; /* Texte foncé pour ressortir sur le gris clair */
    font-style: normal; /* Sur l'image ce n'est pas en italique */
    text-align: center;
    padding: 20px;
    font-size: 1rem;
}
.doc-msg.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}
.doc-msg.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.doc-msg.warning {
    background: rgba(239, 151, 68, 0.15);
    color: var(--warning);
    border: 1px solid var(--warning);
}
/* --------------------------------------------------------------- */
/* ----------------- DOCUMENT TABLE ------------------------------ */
/* --------------------------------------------------------------- */
.doc-table {
    width: 100%;
    border-collapse: collapse;
}
.doc-table thead th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
}
.doc-table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--doc-text);
    font-size: 0.95rem;
    vertical-align: middle;
}
.doc-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* WCAG AA High Contrast Focus Fix for DOJ Submissions */
.doc-form button[type="submit"]:focus {
    outline: 3px solid #FF0000 !important; /* Highly visible red outline */
    box-shadow: 0 0 10px #FF0000 !important;
    background: var(--success); /* Ensure background doesn't change unintentionally */
}
/* Table row categories */
.doc-table .category-row td,
.doc-table .group-row td {
    background: rgba(59, 130, 246, 0.07);
    color: var(--primary);
    font-weight: 700;
    text-align: center;
    padding: 10px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}
/* --------------------------------------------------------------- */
/* -------------------- RESPONSIVE ------------------------------- */
/* --------------------------------------------------------------- */
@media (max-width: 768px) {
    .doc-container {
        padding: 20px;
        padding-top: 60px;
    }
    .doc-content-wrapper {
        padding: 15px;
    }
    .doc-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .doc-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .doc-search {
        width: 100%;
    }
    .doc-table thead th,
    .doc-table tbody td {
        padding: 8px;
        font-size: 0.85rem;
    }
    .doc-avatar,
    .doc-avatar-placeholder {
        width: 50px;
        height: 50px;
    }
    .doc-details {
        grid-template-columns: 1fr;
    }
}