@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500&family=Bebas+Neue&display=swap');

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

/* ── Variables ────────────────────────────────────────── */
:root {
    --bg:        #000;
    --bg2:       #0c0c0c;
    --bg3:       #161616;
    --border:    rgba(255,255,255,0.09);
    --border2:   rgba(255,255,255,0.04);
    --text:      rgba(255,255,255,0.5);
    --text-hi:   #fff;
    --text-dim:  rgba(255,255,255,0.13);
    --accent:    #fff;
    --glow:      0 0 16px rgba(255,255,255,0.55);
    --red:       #ff2525;
    --mono:      'JetBrains Mono', monospace;
    --display:   'Bebas Neue', sans-serif;
}

[data-theme="day"] {
    --bg:        #f0ede6;
    --bg2:       #e8e4dc;
    --bg3:       #ddd8cf;
    --border:    rgba(0,0,0,0.12);
    --border2:   rgba(0,0,0,0.05);
    --text:      rgba(0,0,0,0.5);
    --text-hi:   #0a0a0a;
    --text-dim:  rgba(0,0,0,0.18);
    --accent:    #0a0a0a;
    --glow:      0 0 14px rgba(0,0,0,0.4);
}

html, body {
    width: 100%; min-height: 100%;
    background: var(--bg); color: var(--text);
    font-family: var(--mono); font-size: 13px;
    overflow-x: hidden;
    transition: background .35s, color .35s;
}
a { color: inherit; text-decoration: none; }

/* ── Keyframes ────────────────────────────────────────── */
@keyframes reveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink   { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes scanmov { from{top:-4px} to{top:100vh} }
@keyframes pulse-border {
    0%,100% { border-color: rgba(255,255,255,0.09); }
    50%      { border-color: rgba(255,255,255,0.22); }
}
@keyframes disk-pulse {
    0%,100% { box-shadow: 0 0 6px var(--red), 0 0 14px rgba(255,37,37,.3); }
    50%      { box-shadow: 0 0 14px var(--red), 0 0 30px rgba(255,37,37,.55); }
}

/* ── Loader ───────────────────────────────────────────── */
#top-loader {
    position: fixed; top: 0; left: 0; height: 1px; width: 0;
    background: var(--accent); z-index: 9999;
    box-shadow: var(--glow);
    transition: width 1.8s cubic-bezier(.1,.8,.3,1);
    display: none;
}
#top-loader.done { transition: opacity .4s; opacity: 0; }

/* ── Toggle ───────────────────────────────────────────── */
.theme-toggle {
    position: fixed; top: 12px; right: 16px; z-index: 9000;
    background: transparent; border: 1px solid var(--border);
    color: var(--text-dim); font-size: 15px;
    width: 32px; height: 32px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; font-family: var(--mono);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--text-hi); }
.theme-toggle.small { position: static; }

/* ── Logo navbar (image) ──────────────────────────────── */
.t-nav-logo-link { display: flex; align-items: center; }
.t-nav-logo-img  {
    height: 26px; width: auto;
    filter: drop-shadow(0 0 8px rgba(255,255,255,.3));
    transition: filter .3s;
    object-fit: contain;
}
[data-theme="day"] .t-nav-logo-img { filter: drop-shadow(0 0 6px rgba(0,0,0,.2)); }
.t-nav-logo-img:hover { filter: drop-shadow(0 0 14px rgba(255,255,255,.6)); }

/* ── Tooltip souris ───────────────────────────────────── */
#mouse-tooltip {
    position: fixed; z-index: 9999; display: none;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); font-family: var(--mono); font-size: 10px;
    letter-spacing: .5px; padding: 6px 10px; pointer-events: none;
    max-width: 220px; line-height: 1.5;
}

/* ── Navbar ───────────────────────────────────────────── */
.t-nav {
    position: fixed; top: 0; left: 0; width: 100%; height: 44px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px; z-index: 900;
}
.t-nav-logo {
    font-family: var(--display);
    font-size: 22px; letter-spacing: 5px;
    color: var(--text-hi); text-shadow: var(--glow);
}
.t-nav-links { display: flex; gap: 28px; }
.t-nav-link  { font-size: 10px; letter-spacing: 2.5px; color: var(--text-dim); transition: color .2s; }
.t-nav-link:hover, .t-nav-link.active { color: var(--text-hi); }

/* ══════════════════════════════════════════════
   HOME
   ══════════════════════════════════════════════ */
body.page-home { display: flex; align-items: center; justify-content: center;
                 min-height: 100vh; overflow: hidden; }

#mouse-canvas  { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* Fond image */
.home-bg {
    position: fixed; inset: 0; z-index: 0;
    background-size: cover; background-position: center;
    opacity: .15; pointer-events: none;
    transition: opacity .4s;
}
[data-theme="day"] .home-bg { opacity: .1; }

/* Grain overlay */
.home-grain {
    position: fixed; inset: 0; z-index: 2; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
    opacity: .45;
}
[data-theme="day"] .home-grain { opacity: .2; }

/* Horizontal scan line */
.home-scanline {
    position: fixed; left: 0; width: 100%; height: 2px; z-index: 3;
    background: linear-gradient(90deg,transparent,rgba(255,255,255,.05),transparent);
    animation: scanmov 10s linear infinite;
    pointer-events: none;
}
[data-theme="day"] .home-scanline {
    background: linear-gradient(90deg,transparent,rgba(0,0,0,.04),transparent);
}

/* Corner bracket accent line */
.home-accent-line {
    position: fixed; top: 50%; left: 0; right: 0;
    height: 1px; background: var(--border2); z-index: 2;
    pointer-events: none;
    transform: translateY(-50%);
}

.home-wrap {
    position: relative; z-index: 10;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 32px; padding: 40px 20px; width: 100%;
}

/* Animations d'entrée échelonnées */
.home-logo-wrap  { animation: reveal .7s cubic-bezier(.22,1,.36,1) both; animation-delay: .05s; }
.home-sub        { animation: reveal .7s cubic-bezier(.22,1,.36,1) both; animation-delay: .18s; }
.home-tagline    { animation: reveal .7s cubic-bezier(.22,1,.36,1) both; animation-delay: .32s; }
.home-modules    { animation: reveal .7s cubic-bezier(.22,1,.36,1) both; animation-delay: .48s; }
.home-footer     { animation: reveal .7s cubic-bezier(.22,1,.36,1) both; animation-delay: .65s; }

.home-logo-img {
    max-width: 300px; max-height: 90px; width: auto; height: auto;
    filter: drop-shadow(0 0 20px rgba(255,255,255,.5));
    transition: filter .4s;
}
[data-theme="day"] .home-logo-img { filter: drop-shadow(0 0 8px rgba(0,0,0,.35)); }

.home-sub { font-size: 9px; letter-spacing: 5px; color: var(--text-dim); }

.home-tagline {
    font-size: 11px; letter-spacing: 2px; color: var(--text-hi);
    text-shadow: var(--glow); animation: reveal .7s cubic-bezier(.22,1,.36,1) both .32s, blink 1.1s step-end infinite .32s;
}

/* Cartes modules — coins angulaires */
.home-modules { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }

.module-card {
    width: 265px; padding: 30px 26px;
    background: var(--bg2);
    position: relative; cursor: pointer;
    transform-style: preserve-3d; will-change: transform;
    transition: box-shadow .3s;
    /* Pas de border full — coins seulement */
    border: none;
}
/* Coin supérieur gauche */
.module-card::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 18px; height: 18px;
    border-top: 1px solid var(--accent);
    border-left: 1px solid var(--accent);
    transition: width .3s, height .3s;
}
/* Coin inférieur droit */
.module-card::after {
    content: '';
    position: absolute; bottom: 0; right: 0;
    width: 18px; height: 18px;
    border-bottom: 1px solid var(--accent);
    border-right: 1px solid var(--accent);
    transition: width .3s, height .3s;
}
.module-card:hover { box-shadow: 0 0 28px rgba(255,255,255,.06); }
.module-card:hover::before,
.module-card:hover::after { width: 40px; height: 40px; }

.module-icon { color: var(--text-hi); opacity: .6; margin-bottom: 4px; }
.module-icon svg { width: 32px; height: 32px; }

.module-label {
    font-family: var(--display);
    font-size: 22px; letter-spacing: 4px;
    color: var(--text-hi); text-shadow: var(--glow);
}
.module-desc { font-size: 10px; color: var(--text-dim); line-height: 2; margin-top: 4px; }
.module-tag  {
    font-size: 9px; letter-spacing: 3px; color: var(--text-dim);
    border: 1px solid var(--border2); padding: 2px 8px;
    display: inline-block; align-self: flex-start; margin-top: 6px;
}

.home-footer { font-size: 9px; letter-spacing: 2px; color: var(--text-dim); }

/* ══════════════════════════════════════════════
   DATABASE
   ══════════════════════════════════════════════ */
body.page-db { padding-top: 44px; }

.db-search-area {
    display: flex; flex-direction: column; align-items: center;
    padding: 44px 20px 16px;
    position: sticky; top: 44px; background: var(--bg); z-index: 100;
    animation: reveal .5s cubic-bezier(.22,1,.36,1) both .1s;
}

/* Prompt command style */
.db-search-row {
    display: flex; align-items: stretch;
    width: 100%; max-width: 660px;
    border-bottom: 1px solid var(--text-dim);
    background: transparent;
}
.db-prompt { color: var(--text-dim); font-size: 14px; padding: 12px 10px 12px 0; white-space: nowrap; }
.db-search-row input {
    flex: 1; background: transparent; border: none; outline: none;
    color: #fff; font-family: var(--mono); font-size: 13px;
    padding: 12px 4px; letter-spacing: .4px; caret-color: #fff;
}
[data-theme="day"] .db-search-row input {
    color: var(--text-hi); caret-color: var(--accent);
}

.db-search-row input::placeholder { color: var(--text-dim); }
#btn-search {
    background: transparent; border: none;
    color: var(--text-dim); font-size: 18px;
    padding: 0 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s;
}
#btn-search:hover { color: var(--text-hi); }

/* Refine */
.db-refine-row {
    display: flex; align-items: center; gap: 10px;
    margin-top: 12px; width: 100%; max-width: 660px;
}
.refine-label { font-size: 10px; color: var(--text-dim); white-space: nowrap; letter-spacing: 1px; }
.db-refine-row input {
    flex: 1; background: transparent; border: none;
    border-bottom: 1px solid var(--border); outline: none;
    color: var(--text); font-family: var(--mono); font-size: 11px; padding: 5px 2px;
}
.db-refine-row button {
    background: transparent; border: 1px solid var(--border);
    color: var(--text); font-family: var(--mono); font-size: 10px;
    letter-spacing: 1px; padding: 4px 12px; cursor: pointer; transition: all .15s;
}
.db-refine-row button:hover { border-color: var(--accent); color: var(--text-hi); }

.db-stats { font-size: 10px; color: var(--text-dim); margin-top: 10px; text-align: center; min-height: 14px; }
.stat-max { color: var(--text-hi); font-weight: 500; }
.refine-toggle { color: var(--text); cursor: pointer; text-decoration: underline; margin-left: 8px; }

/* ── Source filter cards ─────────────────────────────── */
.source-filter-area {
    padding: 14px 28px 0;
    max-width: 900px; margin: 0 auto;
}
.source-label { font-size: 9px; letter-spacing: 3px; color: var(--text-dim); margin-bottom: 10px; }
.source-cards { display: flex; gap: 8px; flex-wrap: wrap; }

.source-card {
    padding: 6px 12px; cursor: pointer;
    border: 1px solid var(--border2);
    transition: border-color .2s;
    display: flex; align-items: baseline; gap: 6px;
}
.source-card:hover  { border-color: var(--border); }
.source-card.active { border-color: var(--accent); }
.sc-label { font-size: 9px; color: var(--text-dim); letter-spacing: .5px; }
.sc-count { font-size: 11px; color: var(--text-hi); font-family: var(--display); }
.source-card.active .sc-label { color: var(--text); }
.source-all-link { font-size: 9px; color: var(--text-dim); letter-spacing: 1px;
                   cursor: pointer; margin-left: 4px; transition: color .15s; }
.source-all-link:hover { color: var(--text-hi); }

/* ── Barre navigation N ───────────────────────────────── */
.result-nav-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 28px 0;
    max-width: 900px; margin: 0 auto;
}
.nav-label { font-size: 9px; letter-spacing: 2px; color: var(--text-dim); }
.result-nav-bar input[type=number] {
    width: 60px; background: var(--bg2); border: 1px solid var(--border);
    color: var(--text-hi); font-family: var(--mono); font-size: 11px;
    padding: 4px 8px; outline: none;
}
.result-nav-bar button {
    background: transparent; border: 1px solid var(--border);
    color: var(--text); font-family: var(--mono); font-size: 9px;
    letter-spacing: 1px; padding: 4px 10px; cursor: pointer; transition: all .15s;
}
.result-nav-bar button:hover { border-color: var(--accent); color: var(--text-hi); }
.nav-preview {
    font-size: 10px; color: var(--text-dim);
    max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.db-results { padding: 0 28px 80px; max-width: 900px; margin: 0 auto; }

.db-empty { font-size: 11px; color: var(--text-dim); margin-top: 60px; text-align: center; }

/* ── Résultats : source sur chaque item ──────────────────── */
.result-item {
    margin-bottom: 14px;
    animation: reveal .35s cubic-bezier(.22,1,.36,1) both;
}
.result-item-src {
    font-size: 9px; letter-spacing: 2px;
    color: var(--text-hi);
    text-shadow: 0 0 8px rgba(255,255,255,.4);
    margin-bottom: 3px;
    padding-left: 10px;
}
[data-theme="day"] .result-item-src { text-shadow: none; opacity: .65; }

.result-row {
    font-size: 11px;
    color: var(--text);
    line-height: 1.8;
    padding: 6px 10px;
    border-left: 1px solid var(--border2);
    word-break: break-all;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.result-row:hover {
    border-left-color: rgba(255,255,255,.3);
    color: var(--text-hi);
    background: rgba(255,255,255,.03);
}
[data-theme="day"] .result-row:hover { background: rgba(0,0,0,.04); }

/* Surlignage rouge des termes recherchés */
mark.hit {
    background: none; color: #ff2525;
    text-shadow: 0 0 6px rgba(255,37,37,.8), 0 0 14px rgba(255,37,37,.4);
    font-style: normal;
}

/* ── Accès restreint : overlay pixelisé style TV ─────────────── */
.restricted-wrap { position: relative; overflow: hidden; min-height: 360px; }
.restricted-content { filter: blur(9px); pointer-events: none; user-select: none; }
.restricted-overlay {
    position: absolute; inset: 0; z-index: 2;
    backdrop-filter: blur(6px);
    background-color: rgba(0, 0, 0, .35);
    background-image:
        repeating-linear-gradient(0deg,   rgba(0,0,0,.25) 0, rgba(0,0,0,.25) 1px, transparent 1px, transparent 10px),
        repeating-linear-gradient(90deg,  rgba(0,0,0,.25) 0, rgba(0,0,0,.25) 1px, transparent 1px, transparent 10px);
}
[data-theme="day"] .restricted-overlay {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, .65);
    background-image: none;
}
.restricted-label {
    position: absolute; inset: 0; z-index: 3;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; letter-spacing: 3px; color: rgba(255,255,255,.3);
    pointer-events: none;
}
[data-theme="day"] .restricted-label { color: rgba(0,0,0,.2); }


/* ── Nombre de résultats rouge glow ──────────────────────────── */
.stat-restricted {
    color: #ff2525;
    text-shadow: 0 0 8px rgba(255,37,37,.9), 0 0 22px rgba(255,37,37,.4);
}
.stat-hint {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 8px; color: rgba(255,255,255,.25);
    border: 1px solid rgba(255,255,255,.1);
    width: 13px; height: 13px; border-radius: 50%;
    cursor: help; margin-left: 5px; vertical-align: middle;
    position: relative;
}
.stat-hint::after {
    content: attr(data-tip);
    position: absolute; left: 18px; top: -5px;
    background: #080808; border: 1px solid rgba(255,255,255,.07);
    padding: 6px 12px; font-size: 9px; white-space: nowrap;
    color: rgba(255,255,255,.35); letter-spacing: 1px;
    z-index: 999; pointer-events: none;
    opacity: 0; transition: opacity .2s;
}
.stat-hint:hover::after { opacity: 1; }


/* ══════════════════════════════════════════════
   GEOPING
   ══════════════════════════════════════════════ */
body.page-geo { overflow: hidden; }

#map { position: fixed; top: 44px; left: 0; width: 100%; height: calc(100% - 44px); z-index: 1; }

.city-search-box {
    position: fixed; top: 58px; left: 14px; z-index: 1000;
    display: flex; align-items: center;
    background: rgba(0,0,0,.82); border: 1px solid rgba(255,255,255,.12);
    padding: 0 12px; height: 34px;
    animation: reveal .5s cubic-bezier(.22,1,.36,1) both .2s;
}
/* Variante droite (GeoPing — évite conflit zoom) */
.city-search-right {
    left: auto; right: 14px;
}
.city-search-box input {
    background: transparent; border: none; color: #fff; outline: none;
    font-family: var(--mono); font-size: 11px; width: 270px; letter-spacing: .5px;
}
.city-search-box input::placeholder { color: rgba(255,255,255,.15); }
#search-btn { background: transparent; border: none; color: rgba(255,255,255,.25);
              font-size: 16px; cursor: pointer; padding: 0 4px; transition: color .15s; }
#search-btn:hover { color: #fff; }

#status-bar {
    position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(0,0,0,.82); border-top: 1px solid rgba(255,255,255,.07);
    padding: 6px 18px; display: flex; justify-content: space-between;
    font-size: 10px; letter-spacing: .5px;
}
#status-text { color: rgba(255,255,255,.8); }
#coords-text { color: rgba(255,255,255,.2); }

.leak-disk {
    background: var(--red) !important; border-radius: 50%;
    width: 14px !important; height: 14px !important;
    animation: disk-pulse 2.5s ease-in-out infinite;
}

/* Holographic popup */
.holo-popup .leaflet-popup-content-wrapper {
    background: transparent !important; border: none !important;
    border-radius: 0 !important; box-shadow: none !important; padding: 0 !important;
}
.holo-popup .leaflet-popup-tip-container { display: none !important; }
.holo-popup .leaflet-popup-close-button {
    color: rgba(255,255,255,.4) !important; font-size: 14px !important;
    top: 4px !important; right: 6px !important;
}
.holo-popup .leaflet-popup-content { margin: 0 !important; }

.holo-container {
    font-family: var(--mono); font-size: 11px; line-height: 1.8;
    color: #fff;
    background: rgba(0,0,0,.88);
    border: 1px solid rgba(255,255,255,.1);
    padding: 12px 16px;
    max-height: 55vh; overflow-y: auto; width: 420px;
    scrollbar-width: thin; scrollbar-color: #222 transparent;
}
.holo-header  { font-family: var(--display); font-size: 15px; letter-spacing: 2px;
                color: #fff; text-shadow: 0 0 12px rgba(255,255,255,.5);
                margin-bottom: 8px; }
.holo-divider { color: rgba(255,255,255,.15); font-size: 10px; margin: 10px 0 3px; letter-spacing: 4px; }
.holo-key     { color: rgba(255,255,255,.3); display: inline-block; min-width: 40px; font-size: 10px; }
.holo-field   { word-break: break-all; overflow: hidden; }
.holo-raw     { color: rgba(200,200,200,.35); font-size: 10px;
                border-left: 1px solid rgba(255,255,255,.07);
                padding: 2px 0 2px 8px; margin: 3px 0; word-break: break-all; overflow: hidden; }

.leaflet-control-zoom {
    border: 1px solid rgba(255,255,255,.1) !important;
    background: rgba(0,0,0,.75) !important;
}
.leaflet-control-zoom a { color: #fff !important; background: transparent !important;
                          border-bottom: 1px solid rgba(255,255,255,.05) !important; font-size: 14px !important; }
.leaflet-control-zoom a:hover { background: rgba(255,255,255,.06) !important; }
