@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root { 
    /* THEME SHERIFF BCSO (SANDY SHORES) */
    --bcso-green: #5d7042;
    --bcso-brown: #a67c52;
    --bcso-gold: #d4af37;
    
    --bg-base: #181715;
    --bg-panel: rgba(33, 31, 29, 0.95); 
    --bg-input: rgba(15, 14, 12, 0.8);
    --bg-hover: rgba(255, 255, 255, 0.05);
    
    --border-dim: rgba(255, 255, 255, 0.1);
    --border-bright: rgba(93, 112, 66, 0.5);
    
    --text-main: #F3F0E9;
    --text-muted: #A6A196; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-base);
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 30px 30px;
    color: var(--text-main); 
    margin: 0; 
    padding: 30px; 
    overflow-x: hidden;
}

h1, h2, h3, h4, .sec-header label { font-family: 'Rajdhani', sans-serif; letter-spacing: 0.5px; }

/* === LAYOUT PRINCIPAL === */
.main-layout { display: flex; gap: 20px; max-width: 1800px; margin: 0 auto; align-items: flex-start; transition: gap 0.4s ease; position: relative; }

.left-panel { 
    flex: 1; 
    background: var(--bg-panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); 
    padding: 35px; border-radius: 8px; border: 1px solid var(--border-dim); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.03); 
    min-width: 0; transition: all 0.4s ease; 
}

/* LA LIGNE QUI FAIT DISPARAITRE LES BLOCS QUAND L'AUDIO EST OUVERT */
.main-layout.audio-mode-active .audio-hidden { display: none !important; }

/* === PANNEAU DROIT === */
.right-panel {
    width: 45%; max-width: 800px; height: calc(100vh - 60px); display: flex; flex-direction: column;
    background: var(--bg-panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); 
    padding: 30px; border-radius: 8px; border: 1px solid var(--border-dim); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.03); 
    flex-shrink: 0; position: sticky; top: 30px; overflow: hidden; 
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease, margin 0.4s ease, border 0.4s ease;
}

.right-panel-header { display: flex; align-items: center; gap: 15px; margin-bottom: 25px; transition: margin 0.3s ease; }

.right-panel.hidden { width: 60px !important; padding: 30px 10px !important; cursor: pointer; border-left: 2px solid var(--bcso-green); }
.right-panel.hidden:hover { background: rgba(93, 112, 66, 0.1); border-color: rgba(93, 112, 66, 0.3); }

.right-panel.hidden .right-panel-header { justify-content: center; margin-bottom: 0; }
.right-panel.hidden #right-panel-title { display: none !important; }
.right-panel.hidden .right-panel-content { opacity: 0; visibility: hidden; position: absolute; pointer-events: none; display: none !important; }
.right-panel-content { display: flex; flex-direction: column; flex: 1; opacity: 1; transition: opacity 0.3s ease; overflow: hidden; }

/* === EN-TÊTE === */
h1 { color: var(--text-main); display: flex; align-items: center; gap: 15px; margin-top: 0; margin-bottom: 25px; font-size: 2.2rem; text-transform: uppercase; }
h1 .material-symbols-outlined { color: var(--bcso-green); font-size: 2.5rem; text-shadow: 0 0 15px rgba(93, 112, 66, 0.4); }

.floating-bar { display: flex; gap: 10px; align-items: center; background: rgba(20, 18, 15, 0.8); padding: 12px 20px; border-radius: 6px; border: 1px solid var(--border-dim); margin-bottom: 30px; position: sticky; top: 20px; z-index: 100; backdrop-filter: blur(10px); flex-wrap: wrap; }

.btn-focus-mode {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-dim); color: var(--text-main);
    border-radius: 6px; transition: 0.2s; flex-shrink: 0; display: flex; justify-content: center; align-items: center;
    width: 38px; height: 38px; padding: 0; cursor: pointer; outline: none;
}
.btn-focus-mode:hover { background: rgba(93, 112, 66, 0.15); color: var(--bcso-green); border-color: var(--bcso-green); }
.right-panel.hidden .btn-focus-mode { border-color: transparent; background: transparent; }
.right-panel.hidden:hover .btn-focus-mode { color: var(--bcso-green); }

/* === SECTIONS === */
section { margin-bottom: 20px; }
.sec-header { background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, transparent 100%); padding: 12px 20px; border-left: 3px solid var(--bcso-brown); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s; border-radius: 0 6px 6px 0; }
.sec-header:hover { background: rgba(255,255,255,0.06); border-left-color: var(--bcso-green); }
.sec-header h2 { margin: 0; font-size: 1.2rem; color: var(--text-main); display: flex; align-items: center; gap: 10px; text-transform: uppercase; }
.sec-content { padding: 20px 5px 10px 5px; }
.collapsed .sec-content { display: none; }
.collapsed .chevron { transform: rotate(-90deg); }

/* === GRILLES COMPACTES INTELLIGENTES ET RESPONSIVES === */
/* Grâce à "auto-fit" et "minmax", les blocs passent à la ligne automatiquement si l'écran rétrécit */
.grid { display: grid; gap: 15px; align-items: start; width: 100%; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.grid-3 { display: grid; gap: 15px; align-items: start; width: 100%; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.citoyen-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 15px; align-items: start; width: 100%; margin-top: 15px; }
.grid > *, .grid-3 > *, .citoyen-actions-grid > * { min-width: 0; }

/* DÉFINITION GLOBALE DES INPUTS */
input[type="text"], input[type="date"], input[type="time"], textarea, select {
    width: 100%; padding: 10px 12px !important; background: var(--bg-input) !important; border: 1px solid var(--border-dim) !important; color: #ffffff !important; border-radius: 4px !important; box-sizing: border-box; font-size: 0.95rem !important; font-family: 'Inter', sans-serif !important; outline: none; transition: 0.2s !important; margin: 0 !important;
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.3) !important; }
input:focus, textarea:focus, select:focus { border-color: var(--bcso-green) !important; box-shadow: 0 0 8px rgba(93, 112, 66, 0.3) !important; }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; margin-top: 5px !important; }
label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; font-family: 'Rajdhani', sans-serif; }

.citoyen-box { background: rgba(255,255,255,0.02); padding: 15px; border-radius: 6px; border: 1px solid var(--border-dim); display: flex; flex-direction: column; justify-content: flex-start; height: 100%; box-sizing: border-box; min-width: 0; }

/* === PASTILLES & TAGS === */
.tag-input-wrapper { display: flex; flex-wrap: wrap; gap: 5px; background: var(--bg-input); border: 1px solid var(--border-dim); padding: 6px 12px; border-radius: 4px; min-height: 41px; box-sizing: border-box; cursor: text; transition: 0.2s; align-items: center; margin: 0; }
.tag-input-wrapper:focus-within { border-color: var(--bcso-green); box-shadow: 0 0 8px rgba(93, 112, 66, 0.3); }

.pastille { background: rgba(93, 112, 66, 0.15); color: var(--bcso-green); border: 1px solid rgba(93, 112, 66, 0.4); padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; white-space: nowrap; margin-right: 2px; }
.pastille-del { cursor: pointer; font-size: 1rem; opacity: 0.7; transition: 0.2s; }
.pastille-del:hover { opacity: 1; color: #ef4444; }

input[type="text"].fake-tag-input { 
    border: none !important; background: transparent !important; color: white !important; outline: none !important; 
    flex: 1 1 80px !important; min-width: 80px !important; width: auto !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; height: auto !important; 
}

/* === BOUTONS === */
.btn { padding: 10px 15px; border: 1px solid transparent; border-radius: 4px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.85rem; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.5px; font-family: 'Rajdhani', sans-serif; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.btn-add { background: transparent !important; color: var(--bcso-green) !important; border: 1px dashed var(--bcso-green) !important; width: 100%; margin-top: 15px; }
.btn-add:hover { background: rgba(93, 112, 66, 0.15) !important; }
.btn-del { background: transparent !important; color: #ef4444 !important; border: 1px solid rgba(239, 68, 68, 0.4) !important; }
.btn-del:hover { background: rgba(239, 68, 68, 0.15) !important; border-color: #ef4444 !important; }

.citoyen-row, .audition-row, .preuve-row { background: rgba(0, 0, 0, 0.2) !important; border: 1px solid var(--border-dim) !important; border-radius: 6px !important; padding: 25px !important; margin-bottom: 20px !important; }
.audition-header { background: rgba(255,255,255,0.02) !important; border-bottom: 1px solid var(--border-dim) !important; }

/* === TERMINAL AUDIO === */
.audio-btns { display: flex; gap: 10px; margin-bottom: 20px; margin-top: 15px;}
.btn-start { background: transparent; color: #10b981; border: 1px solid #10b981; flex: 1; padding: 12px; }
.btn-start:hover { background: rgba(16, 185, 129, 0.15); box-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
.btn-stop { background: transparent; color: #ef4444; border: 1px solid #ef4444; flex: 1; padding: 12px; display: none; }
.btn-stop:hover { background: rgba(239, 68, 68, 0.15); box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }

.transcript-zone { 
    background: rgba(15, 14, 12, 0.8); border: 1px solid var(--border-dim); border-radius: 6px; 
    padding: 15px; overflow-y: auto; margin-bottom: 20px; 
    color: #fff; font-family: 'Inter', sans-serif; font-size: 0.95rem; line-height: 1.4; 
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 10px; 
    flex: 1; min-height: 200px;
}

.t-block { display: flex; flex-direction: column; margin-bottom: 8px; width: 100%; }
.q-mode { align-items: flex-end; }
.r-mode { align-items: flex-start; }
.prefix { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; font-family: 'Rajdhani', sans-serif; cursor: pointer; transition: 0.2s; }
.prefix:hover { color: var(--text-main); }
.timecode { font-size: 0.75rem; color: var(--text-muted); margin-left: 5px; font-style: italic; }
.content { padding: 10px 14px; border-radius: 8px; max-width: 85%; font-size: 0.95rem; line-height: 1.4; color: #fff; word-wrap: break-word; outline: none; }
.q-mode .content { background: rgba(93, 112, 66, 0.2); border: 1px solid rgba(93, 112, 66, 0.5); border-bottom-right-radius: 2px; }
.r-mode .content { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15); border-bottom-left-radius: 2px; }
.interim-bubble { opacity:0.7; border-style:dashed; padding: 10px 14px; border-radius: 8px; display: inline-block; }

.scrollable-list { max-height: 25vh; overflow-y: auto; padding-right: 10px; display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }

/* MODALS */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); z-index: 10000; justify-content: center; align-items: center; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { background: var(--bg-panel); padding: 35px; border-radius: 8px; width: 90%; max-width: 600px; position: relative; border: 1px solid var(--border-dim); border-top: 3px solid var(--bcso-green); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8); animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close { position: absolute; top: 15px; right: 15px; cursor: pointer; color: var(--text-muted); transition: 0.2s; background: rgba(255,255,255,0.05); border-radius: 4px; padding: 5px; border: 1px solid transparent; }
.modal-close:hover { color: #ef4444; background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); }

.loader { border: 2px solid rgba(255, 255, 255, 0.2); border-top: 2px solid var(--bcso-green); border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite; display: none; vertical-align: middle; margin-left: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; border: 1px solid rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:hover { background: rgba(93, 112, 66, 0.5); }

/* ========================================================================= */
/* RESPONSIVITÉ MOBILE & TABLETTES                                           */
/* ========================================================================= */

/* Pour les écrans moyens (Laptop/Tablette) */
@media (max-width: 1300px) {
    .main-layout { flex-direction: column; align-items: stretch; }
    .right-panel { width: 100% !important; max-width: 100%; height: auto; min-height: 500px; position: static; }
    
    .right-panel.hidden { 
        height: auto; width: 100% !important; border-left: 1px solid var(--border-dim); 
        border-top: 2px solid var(--bcso-green); padding: 15px 30px !important;
    }
    .right-panel.hidden .right-panel-header { margin-bottom: 0; justify-content: space-between; flex-direction: row-reverse; }
    .right-panel.hidden #right-panel-title { display: flex !important; }
    #btn-delete-dossier { position: static; width: 100%; margin-top: 20px; }
}

/* Pour les téléphones */
@media (max-width: 768px) {
    body { padding: 15px; }
    h1 { font-size: 1.6rem; flex-direction: column; align-items: flex-start; gap: 5px; }
    .floating-bar { flex-direction: column; align-items: stretch; }
    #top-bar-title { text-align: center !important; margin-bottom: 10px; }
    .grid, .grid-3, .citoyen-actions-grid { grid-template-columns: 1fr; }
    .btn { width: 100%; justify-content: center; }
    .modal-content { padding: 20px; }
}