/* =============================================
   NI-RA-DIGITAL — Feuille de styles
   Thème : Institutionnel sombre, sobre & fiable
   Typographie : Syne + DM Sans
   ============================================= */

:root {
    --bg:        #0d1117;
    --bg2:       #161b22;
    --bg3:       #1e252e;
    --border:    #2a3340;
    --border2:   #38444f;
    --gold:      #c9a84c;
    --gold2:     #e8c96e;
    --text:      #e6edf3;
    --text2:     #8b949e;
    --text3:     #6e7882;
    --green:     #3fb950;
    --orange:    #d29922;
    --red:       #f85149;
    --blue:      #58a6ff;
    --radius:    10px;
    --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── BACKGROUND ── */
.bg-pattern {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(201,168,76,.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 85% 110%, rgba(201,168,76,.05) 0%, transparent 50%);
}

/* ── HEADER ── */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(13,17,23,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 860px; margin: 0 auto;
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo-block { display: flex; align-items: center; gap: 12px; }
.logo-emblem {
    width: 38px; height: 38px; border-radius: 8px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif; font-weight: 800; font-size: .9rem;
    color: #0d1117; flex-shrink: 0;
}
.logo-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: .95rem; color: var(--text); }
.logo-sub  { font-size: .72rem; color: var(--text3); margin-top: 1px; }

.btn-track-link {
    display: flex; align-items: center; gap: 7px;
    font-size: .8rem; color: var(--gold); text-decoration: none;
    border: 1px solid rgba(201,168,76,.3); border-radius: 20px;
    padding: 6px 14px; transition: all .2s;
}
.btn-track-link:hover { background: rgba(201,168,76,.1); border-color: var(--gold); }

/* ── HERO ── */
.hero {
    position: relative; z-index: 1;
    padding: 52px 24px 44px;
    border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 860px; margin: 0 auto; }

.badge-ra {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .72rem; font-weight: 500; letter-spacing: .06em;
    color: var(--green); background: rgba(63,185,80,.1);
    border: 1px solid rgba(63,185,80,.25);
    border-radius: 20px; padding: 4px 12px;
    margin-bottom: 20px; text-transform: uppercase;
}

.hero h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.9rem, 5vw, 2.8rem);
    font-weight: 800; line-height: 1.15;
    color: var(--text);
    margin-bottom: 16px;
}

.hero-desc {
    font-size: .95rem; color: var(--text2);
    max-width: 600px; line-height: 1.7;
}

/* ── CONTAINER ── */
.container {
    max-width: 860px; margin: 0 auto;
    padding: 32px 24px 60px;
    position: relative; z-index: 1;
}

/* ── NOTICE CONFIDENTIALITÉ ── */
.notice-confidential {
    display: flex; gap: 16px; align-items: flex-start;
    background: rgba(201,168,76,.07);
    border: 1px solid rgba(201,168,76,.2);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 36px;
}
.notice-icon {
    color: var(--gold); flex-shrink: 0; margin-top: 2px;
}
.notice-confidential strong { font-family: 'Syne', sans-serif; font-size: .9rem; display: block; margin-bottom: 6px; color: var(--gold2); }
.notice-confidential p { font-size: .82rem; color: var(--text2); line-height: 1.65; }

/* ── FORM SECTIONS ── */
.form-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 28px 32px;
    margin-bottom: 20px;
    transition: border-color .2s;
}
.form-section:focus-within { border-color: var(--border2); }

.section-header {
    display: flex; align-items: flex-start; gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.section-num {
    font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800;
    color: var(--gold); opacity: .5; line-height: 1;
    flex-shrink: 0; margin-top: 2px;
}
.section-header h2 {
    font-family: 'Syne', sans-serif; font-size: 1.05rem; font-weight: 700;
    color: var(--text); margin-bottom: 4px;
}
.section-header p { font-size: .8rem; color: var(--text3); }

/* ── ANONYMAT TOGGLE ── */
.anon-toggle {
    margin-bottom: 22px;
    padding: 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.toggle-label {
    display: flex; align-items: center; gap: 14px; cursor: pointer;
}
.toggle-label input[type="checkbox"] { display: none; }

.toggle-switch {
    width: 44px; height: 24px; border-radius: 12px;
    background: var(--border2); position: relative;
    flex-shrink: 0; transition: background .25s;
}
.toggle-switch::after {
    content: ''; position: absolute;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px;
    transition: transform .25s;
}
input[type="checkbox"]:checked + .toggle-switch {
    background: var(--gold);
}
input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(20px);
}

.toggle-text strong { display: block; font-size: .88rem; color: var(--text); margin-bottom: 2px; }
.toggle-text small { font-size: .75rem; color: var(--text3); }

/* ── IDENTITY FIELDS ANIMATION ── */
.identity-fields {
    overflow: hidden;
    transition: max-height .4s ease, opacity .4s ease;
    max-height: 400px; opacity: 1;
}
.identity-fields.hidden { max-height: 0; opacity: 0; pointer-events: none; }

/* ── FORM FIELDS ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 580px) { .form-row { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }

label {
    display: block; font-size: .8rem; font-weight: 500;
    color: var(--text2); margin-bottom: 7px; letter-spacing: .02em;
}
.opt { color: var(--text3); font-weight: 400; font-style: italic; margin-left: 4px; }
.req { color: var(--orange); font-weight: 500; margin-left: 4px; font-size: .75rem; }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
select, textarea {
    width: 100%; padding: 11px 14px;
    background: var(--bg3); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font-family: 'DM Sans', sans-serif; font-size: .88rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,.12);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
select { cursor: pointer; }
select option { background: var(--bg2); }
textarea { resize: vertical; min-height: 140px; }

.field-error {
    display: none; font-size: .75rem; color: var(--red);
    margin-top: 5px;
}
.field-error.show { display: block; }

.char-counter { font-size: .72rem; color: var(--text3); margin-top: 5px; text-align: right; }

/* ── URGENCE ── */
.urgence-group { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
@media (max-width: 580px) { .urgence-group { grid-template-columns: 1fr; } }

.urgence-card {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 16px 12px; border-radius: var(--radius);
    border: 2px solid var(--border); background: var(--bg3);
    cursor: pointer; transition: all .2s;
}
.urgence-card input { display: none; }
.urgence-icon { font-size: 1.2rem; margin-bottom: 6px; }
.urgence-label { font-family: 'Syne', sans-serif; font-size: .82rem; font-weight: 700; margin-bottom: 4px; }
.urgence-desc { font-size: .7rem; color: var(--text3); line-height: 1.4; }

.urgence-normal:has(input:checked)   { border-color: var(--green); background: rgba(63,185,80,.08); }
.urgence-urgent:has(input:checked)   { border-color: var(--orange); background: rgba(210,153,34,.08); }
.urgence-tres-urgent:has(input:checked) { border-color: var(--red); background: rgba(248,81,73,.08); }

.urgence-normal .urgence-icon   { color: var(--green); }
.urgence-urgent .urgence-icon   { color: var(--orange); }
.urgence-tres-urgent .urgence-icon { color: var(--red); }

/* ── UPLOAD ZONE ── */
.upload-zone {
    border: 2px dashed var(--border2); border-radius: var(--radius);
    background: var(--bg3);
    transition: border-color .2s, background .2s;
    overflow: hidden;
}
.upload-zone.dragover { border-color: var(--gold); background: rgba(201,168,76,.05); }
.upload-content { padding: 28px; text-align: center; cursor: pointer; }
.upload-content svg { color: var(--text3); margin-bottom: 12px; }
.upload-content p { font-size: .85rem; color: var(--text2); margin-bottom: 6px; }
.upload-content p strong { color: var(--text); }
.upload-content button {
    background: none; border: none; color: var(--gold);
    cursor: pointer; font-size: .85rem; font-family: inherit;
    text-decoration: underline;
}
.upload-content small { font-size: .72rem; color: var(--text3); }

.file-list { padding: 0 16px; }
.file-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    font-size: .8rem; color: var(--text2);
}
.file-item svg { color: var(--gold); flex-shrink: 0; }
.file-item span { flex: 1; }
.file-remove {
    background: none; border: none; color: var(--text3);
    cursor: pointer; padding: 2px 6px; font-size: 1rem; line-height: 1;
    transition: color .15s;
}
.file-remove:hover { color: var(--red); }

/* ── SUBMIT AREA ── */
.form-submit-area {
    margin-top: 28px;
}
.submit-notice {
    display: flex; align-items: center; gap: 8px;
    font-size: .8rem; color: var(--text2);
    background: rgba(88,166,255,.07);
    border: 1px solid rgba(88,166,255,.2);
    border-radius: var(--radius); padding: 12px 16px;
    margin-bottom: 20px;
}
.submit-notice svg { color: var(--blue); flex-shrink: 0; }

.btn-submit {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #0d1117; border: none; border-radius: var(--radius);
    font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: all .2s;
    letter-spacing: .04em;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(201,168,76,.3); }
.btn-submit:active { transform: translateY(0); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FOOTER ── */
.site-footer {
    position: relative; z-index: 1;
    text-align: center; padding: 28px 24px;
    border-top: 1px solid var(--border);
    font-size: .75rem; color: var(--text3);
    line-height: 1.8;
}
.site-footer strong { color: var(--text2); }

/* ── PAGE SUCCESS ── */
.success-card {
    background: var(--bg2); border: 1px solid var(--green);
    border-radius: 16px; padding: 40px; text-align: center;
    margin: 40px auto; max-width: 540px;
}
.success-icon { font-size: 3rem; margin-bottom: 16px; }
.success-card h2 { font-family: 'Syne', sans-serif; font-size: 1.4rem; color: var(--green); margin-bottom: 12px; }
.success-card p { font-size: .88rem; color: var(--text2); margin-bottom: 8px; }

.token-display {
    background: var(--bg3); border: 2px solid var(--gold);
    border-radius: var(--radius); padding: 18px;
    margin: 24px 0; letter-spacing: .15em;
    font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800;
    color: var(--gold); cursor: pointer;
}
.token-hint { font-size: .75rem; color: var(--text3); margin-bottom: 24px; }

/* ── PAGE SUIVI ── */
.track-form-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 36px;
    max-width: 500px; margin: 40px auto;
}
.track-form-card h2 { font-family: 'Syne', sans-serif; margin-bottom: 8px; }
.track-form-card p { color: var(--text2); font-size: .85rem; margin-bottom: 24px; }
.track-input {
    text-align: center; letter-spacing: .15em;
    font-family: 'Syne', sans-serif; font-size: 1.2rem;
    text-transform: uppercase;
}
.btn-secondary {
    width: 100%; padding: 13px;
    background: transparent; border: 2px solid var(--gold);
    color: var(--gold); border-radius: var(--radius);
    font-family: 'Syne', sans-serif; font-size: .95rem; font-weight: 700;
    cursor: pointer; margin-top: 14px; transition: all .2s;
    letter-spacing: .04em;
}
.btn-secondary:hover { background: rgba(201,168,76,.1); }

.plainte-detail {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 32px;
    max-width: 680px; margin: 32px auto;
}
.detail-header { margin-bottom: 24px; }
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .78rem; font-weight: 600; padding: 4px 12px;
    border-radius: 20px; margin-bottom: 12px;
}
.status-attente { background: rgba(210,153,34,.15); color: var(--orange); }
.status-encours { background: rgba(88,166,255,.15); color: var(--blue); }
.status-resolu  { background: rgba(63,185,80,.15); color: var(--green); }
.status-rejete  { background: rgba(248,81,73,.15); color: var(--red); }

.detail-grid { display: grid; gap: 14px; }
.detail-row {
    display: grid; grid-template-columns: 160px 1fr;
    font-size: .84rem; gap: 8px;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.detail-label { color: var(--text3); font-size: .78rem; }
.detail-value { color: var(--text); }

.reponse-box {
    margin-top: 24px; padding: 20px;
    background: rgba(63,185,80,.06);
    border: 1px solid rgba(63,185,80,.2); border-radius: var(--radius);
}
.reponse-box h4 { color: var(--green); font-family: 'Syne', sans-serif; margin-bottom: 10px; font-size: .88rem; }
.reponse-box p { font-size: .85rem; color: var(--text2); line-height: 1.7; white-space: pre-wrap; }

.pending-box {
    margin-top: 24px; padding: 20px;
    background: rgba(210,153,34,.06);
    border: 1px solid rgba(210,153,34,.2); border-radius: var(--radius);
    font-size: .84rem; color: var(--text2); text-align: center;
}

/* ── ADMIN ── */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.admin-header h1 { font-family: 'Syne', sans-serif; font-size: 1.3rem; }

.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 32px; }
@media (max-width: 800px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }

.stat-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}
.stat-card .stat-num {
    font-family: 'Syne', sans-serif; font-size: 2rem;
    font-weight: 800; color: var(--gold);
}
.stat-card .stat-label { font-size: .72rem; color: var(--text3); margin-top: 4px; }
.stat-urgent .stat-num { color: var(--red); }
.stat-green .stat-num  { color: var(--green); }

.filter-bar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
    width: auto; padding: 8px 12px; font-size: .82rem;
}

.plaintes-table {
    width: 100%; border-collapse: collapse;
    font-size: .82rem;
}
.plaintes-table th {
    text-align: left; padding: 10px 14px;
    background: var(--bg3); color: var(--text3);
    font-size: .72rem; letter-spacing: .05em; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.plaintes-table td {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.plaintes-table tr:hover td { background: var(--bg3); }

.urgence-pill {
    display: inline-flex; padding: 2px 10px;
    border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.urgence-nu   { background: rgba(139,148,158,.12); color: var(--text3); }
.urgence-u    { background: rgba(210,153,34,.15); color: var(--orange); }
.urgence-tu   { background: rgba(248,81,73,.15); color: var(--red); }

.btn-sm {
    padding: 5px 12px; border-radius: 6px;
    font-size: .75rem; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg3); color: var(--text);
    text-decoration: none; display: inline-block; transition: all .15s;
}
.btn-sm:hover { border-color: var(--gold); color: var(--gold); }

.admin-login-wrap {
    max-width: 380px; margin: 80px auto;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 36px;
}
.admin-login-wrap h2 { font-family: 'Syne', sans-serif; text-align: center; margin-bottom: 6px; }
.admin-login-wrap p  { text-align: center; color: var(--text3); font-size: .82rem; margin-bottom: 28px; }
.btn-login {
    width: 100%; padding: 13px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #0d1117; border: none; border-radius: var(--radius);
    font-family: 'Syne', sans-serif; font-size: .95rem; font-weight: 700;
    cursor: pointer; margin-top: 4px;
}
.alert { padding: 12px 16px; border-radius: 8px; font-size: .82rem; margin-bottom: 16px; }
.alert-error { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.3); color: var(--red); }
.alert-success { background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.3); color: var(--green); }

.respond-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 32px;
    max-width: 720px; margin: 0 auto;
}
.respond-card h2 { font-family: 'Syne', sans-serif; margin-bottom: 24px; font-size: 1.1rem; }

.btn-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text2); text-decoration: none; font-size: .82rem;
    margin-bottom: 24px;
    transition: color .15s;
}
.btn-back:hover { color: var(--gold); }

textarea.admin-textarea { min-height: 180px; }

select.status-select { max-width: 260px; margin-bottom: 16px; }

.btn-primary {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #0d1117; border: none; border-radius: var(--radius);
    font-family: 'Syne', sans-serif; font-size: .9rem; font-weight: 700;
    cursor: pointer; transition: all .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(201,168,76,.25); }

.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text3); font-size: .9rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

.pagination {
    display: flex; gap: 6px; justify-content: center;
    margin-top: 24px;
}
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 6px;
    font-size: .8rem; text-decoration: none;
    border: 1px solid var(--border); color: var(--text2);
    transition: all .15s;
}
.pagination a:hover { border-color: var(--gold); color: var(--gold); }
.pagination .active { background: var(--gold); color: #0d1117; border-color: var(--gold); font-weight: 700; }

@media (max-width: 600px) {
    .form-section { padding: 20px 16px 24px; }
    .admin-wrap { padding: 16px; }
    .plaintes-table { font-size: .75rem; }
    .plaintes-table th, .plaintes-table td { padding: 8px 10px; }
}
