/* Styles complémentaires à Tailwind (classes réutilisées dans plusieurs templates) */

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    color: #475569;
    transition: background-color .15s, color .15s;
}
.nav-link:hover { background: #ecfeff; color: #0e7490; }
.nav-link.nav-active { background: #22d3ee; color: #fff; font-weight: 500; }

.card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

/* Vue Code Source : numéros de ligne alignés sur le code */
.code-wrap {
    display: flex;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.5rem;
}
.code-gutter {
    flex: none;
    padding: 1rem 0.75rem;
    text-align: right;
    color: #94a3b8;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    user-select: none;
}
.code-gutter span { display: block; }
.code-gutter .ligne-erreur { background: #fee2e2; color: #b91c1c; font-weight: 700; margin: 0 -0.75rem; padding: 0 0.75rem; }
.code-wrap pre { margin: 0; flex: 1; overflow-x: auto; }
.code-wrap pre code.hljs { padding: 1rem; background: #fff; line-height: 1.5rem; }

/* Zone de dépôt */
.dropzone.dragover { border-color: #22d3ee; background: #ecfeff; }

.stat-icon {
    position: relative;
    display: flex;
    height: 3.5rem;
    width: 3.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: #22d3ee;
    color: #fff;
}

/* Éditeur XML (CodeMirror) */
.CodeMirror { border: 1px solid #e2e8f0; border-radius: 0.5rem; font-size: 0.85rem; line-height: 1.5; }
.CodeMirror-gutters { background: #f8fafc; border-right: 1px solid #e2e8f0; }
.CodeMirror-focused { border-color: #22d3ee; }
.cm-ligne-erreur { background: #fee2e2; }

/* Protections anti-triche (pages étudiant) */
#filigrane { position: fixed; inset: 0; z-index: 40; pointer-events: none; background-repeat: repeat; }
#masque-protection {
    display: none; position: fixed; inset: 0; z-index: 60; align-items: center; justify-content: center;
    background: #f1f5f9; color: #334155; font-size: 1.1rem; font-weight: 500; cursor: pointer;
}
.protection-masquee #masque-protection { display: flex; }
#alerte-protection {
    position: fixed; bottom: 1.5rem; left: 50%; z-index: 70; transform: translate(-50%, 1rem);
    max-width: 90vw; padding: 0.75rem 1.25rem; border-radius: 0.75rem; background: #1e293b; color: #fff;
    font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#alerte-protection.visible { opacity: 1; transform: translate(-50%, 0); }
/* Texte non sélectionnable (sauf champs de saisie et éditeur) */
.protection-active main :not(input):not(textarea):not(select):not(.CodeMirror *) { user-select: none; -webkit-user-select: none; }
/* Impression bloquée */
@media print {
    .protection-active body > * { display: none !important; }
    .protection-active body::after { content: "Impression désactivée sur XML Exchange."; display: block; padding: 2rem; }
}

/* Alerte « nouveau sujet » */
.alerte-nouveau-sujet {
    position: fixed; top: 5.5rem; right: 1.5rem; z-index: 70; max-width: 24rem;
    padding: 0.9rem 1.1rem; border-radius: 0.75rem; background: #0891b2; color: #fff;
    font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 25px rgba(8, 145, 178, .35);
    animation: arrivee-alerte .3s ease-out;
}
@keyframes arrivee-alerte { from { opacity: 0; transform: translateY(-0.5rem); } }
.cloche-animee svg { animation: cloche 0.5s ease-in-out 3; transform-origin: top center; }
@keyframes cloche { 25% { transform: rotate(14deg); } 75% { transform: rotate(-14deg); } }

/* Compte à rebours d'un sujet */
.minuteur { font-variant-numeric: tabular-nums; }
.minuteur.alerte { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.minuteur.critique { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; animation: clignote 1s steps(2) infinite; }
@keyframes clignote { 50% { opacity: .55; } }

/* Double vue : code source XML (thème sombre) */
.source-xml { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.8rem; line-height: 1.45rem; color: #e2e8f0; }
.src-ligne { display: flex; white-space: pre; padding-right: 1rem; border-left: 3px solid transparent; transition: background-color .12s; }
.src-num { flex: none; width: 3.25rem; padding-right: 1rem; text-align: right; color: #64748b; user-select: none; }
.src-code { flex: 1; }
.src-ligne.src-active { background: rgba(34, 211, 238, .16); border-left-color: #22d3ee; }
.src-ligne.src-active .src-num { color: #67e8f9; }
.src-ligne.ligne-erreur { background: rgba(239, 68, 68, .22); border-left-color: #ef4444; }
.x-ponct { color: #94a3b8; }
.x-nom { color: #67e8f9; }
.x-attr { color: #c4b5fd; }
.x-val { color: #fcd34d; }
.x-texte { color: #f1f5f9; }
.x-entite { color: #f9a8d4; }
.x-commentaire { color: #64748b; font-style: italic; }
.x-decl { color: #a5b4fc; }
.onglet-source { border-radius: 0.375rem; padding: 0.3rem 0.7rem; font-size: 0.8rem; color: #94a3b8; }
.onglet-source:hover { color: #e2e8f0; }
.onglet-source.actif { background: #0f172a; color: #f1f5f9; }

/* Vue Métier : éléments reliés au code source */
#vue-metier [data-lignes] { transition: background-color .12s, box-shadow .12s; }
#vue-metier .vm-champ:hover, #vue-metier td[data-lignes]:hover { background: #ecfeff; }
#vue-metier .vm-ligne:hover { background: #f8fafc; }
.vm-section[open] > summary .vm-chevron { transform: rotate(90deg); }
.vm-section > summary { list-style: none; }
.vm-section > summary::-webkit-details-marker { display: none; }
.vm-deplier.ouvert svg { transform: rotate(90deg); }

/* Commentaires : éléments ciblables */
.commentaire-cible[data-lignes] { cursor: pointer; }
.commentaire-cible[data-lignes]:hover { background: #cffafe; }
#src-document.commentable .src-ligne { cursor: pointer; }
#src-document.commentable .src-ligne:hover { background: rgba(148, 163, 184, .12); }
