/* ═══════════════════════════════════════════════════════════════════════════
   Omega Kube — Dashboard : socle commun

   Réutilise les polices et l'identité du site principal via ../../../assets/,
   sans duplication : le dossier dashboard/ est destiné à vivre à la racine du
   site. Les variables sont redéclarées ici pour que le dashboard reste
   autonome — il peut être servi seul, le temps du développement.

   Contraintes du site respectées :
     · aucun style inline ni handler inline (CSP sans 'unsafe-inline')
     · aucune ressource externe (pas de CDN, pas de Google Fonts)
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'OmegaLarge';
    src: url('../../../assets/fonts/custom_font_large.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'OmegaSmall';
    src: url('../../../assets/fonts/custom_font_small.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat-Bold';
    src: url('../../../assets/fonts/Montserrat/static/Montserrat-Bold.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'MontserratVar';
    src: url('../../../assets/fonts/Montserrat/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: 'MontserratVar';
    src: url('../../../assets/fonts/Montserrat/Montserrat-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --bg-deep: #1a0f1f;
    --bg-secondary: #251528;
    --bg-tertiary: #2d1b33;
    --accent-primary: #8b3a62;
    --accent-secondary: #a64d79;
    --accent-light: #c77daa;
    --accent-glow: #d4a5c9;
    --text-primary: #ffffff;
    --text-secondary: #c9b8d0;
    --text-muted: #8a7a91;
    --glass-bg: rgba(45, 27, 51, 0.7);
    --glass-border: rgba(167, 77, 121, 0.3);
    --card-bg: rgba(37, 21, 40, 0.8);
    --input-bg: #1a0f1f;

    /* Couleurs de statut : indépendantes du thème, elles portent un sens. */
    --ok: #2ecc71;
    --warn: #e0a13c;
    --danger: #e74c3c;
    --info: #5a96eb;

    /* ── Palette de section ───────────────────────────────────────────────
       Le violet reste la couleur de la marque, mais l'appliquer à TOUT rendait
       le dashboard monochrome et illisible : neuf sections identiques, rien
       pour les distinguer d'un coup d'œil.
       Chaque domaine reçoit donc sa teinte, choisie dans une gamme proche
       (bleus-violets-roses) pour ne pas dénaturer l'identité. Le violet reste
       majoritaire : il porte la navigation, les boutons et les accents. */
    --c-securite:    #e05a6d;   /* rouge-rose : protection, alerte */
    --c-moderation:  #d4874a;   /* ambre : sanction */
    --c-accueil:     #4aa8c9;   /* bleu clair : arrivée */
    --c-tickets:     #5b8ee0;   /* bleu : support */
    --c-whitelist:   #45b391;   /* vert-bleu : validation */
    --c-absence:     #8b7dd8;   /* indigo : indisponibilité */
    --c-convocation: #cf6bab;   /* rose : notification */
    --c-taches:      #4fb0a5;   /* turquoise : suivi */
    --c-general:     #a64d79;   /* accent de marque */

    --shape-color: rgba(255, 255, 255, 0.08);
    --shape-border: rgba(255, 255, 255, 0.15);

    --radius: 14px;
    --radius-sm: 9px;
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 68px;
    --header-h: 64px;
}

[data-theme="light"] {
    --bg-deep: #faf7fb;
    --bg-secondary: #f3edf5;
    --bg-tertiary: #ece3ef;
    --text-primary: #1a0f1f;
    --text-secondary: #4a3a52;
    --text-muted: #7a6a82;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(139, 58, 98, 0.22);
    --card-bg: rgba(255, 255, 255, 0.95);
    --input-bg: #ffffff;
    --shape-color: rgba(139, 58, 98, 0.07);
    --shape-border: rgba(139, 58, 98, 0.14);
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100dvh;
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Montserrat-Bold', 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    /* clip et non hidden : `hidden` sur html/body casse tous les position:sticky */
    overflow-x: clip;

    /* Scrollbar sombre — partout sur le dashboard */
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

body::-webkit-scrollbar { width: 5px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 5px;
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.3;
}

/* Les titres de section reprennent la police d'affichage du site. */
.dsh-display {
    font-family: 'OmegaLarge', sans-serif;
    letter-spacing: 0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    /* Sans ces deux lignes, le navigateur applique son fond et sa couleur
       natifs — un gris clair sur lequel le texte blanc devient illisible. */
    background: transparent;
    color: inherit;
    border: none;
    cursor: pointer;
}

/* Tous les <select> natifs : fond sombre, texte clair, pas de barre blanche */
select {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    scrollbar-width: none;
}

select::-webkit-scrollbar { display: none; }

:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}

/* ── Fond animé ─────────────────────────────────────────────────────────────
   Repris tel quel du site principal (assets/css/main.css) : mêmes formes
   géométriques flottantes, même grille de points, même dégradé. Le dashboard
   doit ressembler au site, pas à une application à part.

   Le balisage correspondant est dans app.html et index.html — identique à
   components/background.html du site. */

.geo-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
}

.grid-pattern {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(circle, var(--shape-border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.5;
}

.geo-shapes {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    opacity: 0.6;
    animation: floatShape 20s ease-in-out infinite;
}

.shape-triangle {
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 52px solid var(--shape-color);
}

.shape-triangle-outline {
    width: 60px;
    height: 52px;
    background: transparent;
    border: 2px solid var(--shape-border);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.shape-square {
    width: 40px;
    height: 40px;
    background: var(--shape-color);
}

.shape-square-outline {
    width: 50px;
    height: 50px;
    background: transparent;
    border: 2px solid var(--shape-border);
}

.shape-rect {
    width: 80px;
    height: 30px;
    background: var(--shape-color);
}

.shape-diamond {
    width: 40px;
    height: 40px;
    background: var(--shape-color);
    transform: rotate(45deg);
}

.shape-dots {
    display: grid;
    grid-template-columns: repeat(4, 8px);
    grid-template-rows: repeat(4, 8px);
    gap: 6px;
}

.shape-dots span {
    width: 4px;
    height: 4px;
    background: var(--shape-border);
    border-radius: 50%;
}

.shape:nth-child(1)  { top: 10%; left: 5%;   animation-delay: 0s; }
.shape:nth-child(2)  { top: 20%; right: 10%; animation-delay: -3s; }
.shape:nth-child(3)  { top: 60%; left: 8%;   animation-delay: -6s; }
.shape:nth-child(4)  { top: 75%; right: 5%;  animation-delay: -9s; }
.shape:nth-child(5)  { top: 40%; left: 3%;   animation-delay: -12s; }
.shape:nth-child(6)  { top: 85%; left: 15%;  animation-delay: -15s; }
.shape:nth-child(7)  { top: 15%; right: 20%; animation-delay: -4s; }
.shape:nth-child(8)  { top: 50%; right: 3%;  animation-delay: -8s; }
.shape:nth-child(9)  { top: 30%; left: 12%;  animation-delay: -11s; }
.shape:nth-child(10) { top: 90%; right: 15%; animation-delay: -14s; }

@keyframes floatShape {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25%      { transform: translateY(-20px) rotate(5deg); }
    50%      { transform: translateY(-10px) rotate(-3deg); }
    75%      { transform: translateY(-25px) rotate(3deg); }
}

/* Les formes sont décoratives : sous la barre latérale et l'en-tête, elles
   n'apportent rien et alourdissent le rendu. On les laisse au fond, le contenu
   passe par-dessus. */

/* ── Boutons ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.8rem 1.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.25s ease,
                border-color 0.25s ease, background-color 0.25s ease, opacity 0.2s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 4px 16px rgba(139, 58, 98, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 22px rgba(139, 58, 98, 0.45);
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.btn-ghost {
    color: var(--text-secondary);
    padding: 0.55rem 0.9rem;
}

.btn-ghost:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.btn[disabled],
.btn.is-loading {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    width: 100%;
}

/* ── Cartes ─────────────────────────────────────────────────────────────── */

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.98rem;
    font-weight: 600;
}

.card-title svg {
    width: 17px;
    height: 17px;
    color: var(--accent-light);
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-light);
    transition: gap 0.2s ease;
}

.card-link svg {
    width: 14px;
    height: 14px;
}

.card-link:hover {
    gap: 0.6rem;
}

/* ── Pastilles d'état ───────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
    white-space: nowrap;
}

.pill svg {
    width: 12px;
    height: 12px;
}

.pill--ok {
    background: rgba(46, 204, 113, 0.14);
    color: var(--ok);
    border-color: rgba(46, 204, 113, 0.34);
}

.pill--warn {
    background: rgba(230, 160, 60, 0.14);
    color: var(--warn);
    border-color: rgba(230, 160, 60, 0.34);
}

.pill--danger {
    background: rgba(231, 76, 60, 0.14);
    color: var(--danger);
    border-color: rgba(231, 76, 60, 0.34);
}

.pill--info {
    background: rgba(90, 150, 235, 0.14);
    color: var(--info);
    border-color: rgba(90, 150, 235, 0.34);
}

.pill--muted {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--glass-border);
}

/* Point clignotant pour un état « en direct ». */
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.dot--live {
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.82); }
}

/* ── Utilitaires ────────────────────────────────────────────────────────── */

.u-muted { color: var(--text-muted); }
.u-center { text-align: center; }
[hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Rendu Markdown : police à graisse variable ─────────────────────────
   Le body utilise Montserrat-Bold (poids 700). Sans surcharge, <strong>
   et les titres sont invisibles car tout le texte est déjà en gras.
   On utilise ici la variable font en poids normal (400) pour que le gras
   (<strong> → 800) et les titres soient visuellement distincts. */

.note-texte,
.md-preview-inner,
.md-preview-inner p,
.md-preview-inner li,
.note-texte p,
.note-texte li {
    font-family: 'MontserratVar', 'Segoe UI', system-ui, sans-serif;
    font-weight: 400;
}

.note-texte strong,
.md-preview-inner strong {
    font-weight: 700;
}

.note-texte em,
.md-preview-inner em {
    font-style: italic;
}

.note-texte del,
.md-preview-inner del {
    text-decoration: line-through;
    opacity: 0.7;
}

.note-texte .md-heading,
.md-preview-inner .md-heading {
    font-weight: 700;
    margin: 0.6em 0 0.25em;
}

.note-texte .md-h1,
.md-preview-inner .md-h1 {
    font-size: 1.4em;
}

.note-texte .md-h2,
.md-preview-inner .md-h2 {
    font-size: 1.2em;
}

.note-texte .md-h3,
.md-preview-inner .md-h3 {
    font-size: 1.08em;
}

.note-texte .md-blockquote,
.md-preview-inner .md-blockquote {
    border-left: 3px solid var(--accent-primary);
    margin: 0.4em 0;
    padding: 0.15em 0.65em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border-radius: 0 4px 4px 0;
}

.note-texte .md-list,
.md-preview-inner .md-list {
    margin: 0.3em 0;
    padding-left: 1.4em;
}

.note-texte .md-inline-code,
.md-preview-inner .md-inline-code {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.88em;
    color: #e8a0bf;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
