/* ============================================================
   Thème HFP — Hidden Flag Protocol  v2
   Style : terminal cyberpunk haute intensité
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@400;600;700&family=Orbitron:wght@400;700;900&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
    --hfp-bg:        #05080d;
    --hfp-surface:   #090e15;
    --hfp-surface2:  #0d1520;
    --hfp-surface3:  #111c28;
    --hfp-border:    #1a2d40;
    --hfp-border2:   #243548;
    --hfp-accent:    #00ff88;
    --hfp-accent2:   #00c8ff;
    --hfp-accent3:   #7c3aff;
    --hfp-danger:    #ff4757;
    --hfp-warn:      #ffa502;
    --hfp-text:      #c9d8e8;
    --hfp-text2:     #8ba3b8;
    --hfp-muted:     #3d5566;
    --hfp-glow:      rgba(0,255,136,0.20);
    --hfp-glow2:     rgba(0,200,255,0.14);
    --hfp-glow3:     rgba(124,58,255,0.14);
    --hfp-scan:      rgba(0,255,136,0.025);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }

/* ── Body + fond animé ───────────────────────────────────── */
body {
    background-color: var(--hfp-bg);
    color: var(--hfp-text);
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle, rgba(0,255,136,0.07) 1px, transparent 1px),
        radial-gradient(ellipse at 15% 0%,   rgba(0,255,136,0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 100%, rgba(0,200,255,0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%,  rgba(124,58,255,0.03) 0%, transparent 70%);
    background-size: 28px 28px, 100% 100%, 100% 100%, 100% 100%;
}

/* ── Scanlines overlay ───────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        var(--hfp-scan) 2px,
        var(--hfp-scan) 4px
    );
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0%   { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--hfp-bg); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--hfp-accent), var(--hfp-accent2));
    border-radius: 3px;
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    background-color: rgba(5,8,13,0.97) !important;
    border-bottom: 1px solid var(--hfp-border);
    backdrop-filter: blur(16px) saturate(1.4);
    padding: 0.5rem 1.5rem;
    position: relative;
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--hfp-accent) 30%,
        var(--hfp-accent2) 70%,
        transparent 100%
    );
    opacity: 0.6;
}

.navbar-brand {
    font-family: 'Orbitron', monospace !important;
    color: var(--hfp-accent) !important;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow:
        0 0 10px var(--hfp-accent),
        0 0 30px rgba(0,255,136,0.3);
    position: relative;
}

.navbar-brand::before {
    content: '> ';
    color: var(--hfp-muted);
    animation: blink-cursor 1.1s step-end infinite;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.nav-link {
    color: var(--hfp-text2) !important;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.5rem 1rem !important;
    transition: color 0.4s, text-shadow 0.4s;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 1px;
    background: var(--hfp-accent);
    transition: transform 0.45s;
}

.nav-link:hover { color: var(--hfp-accent) !important; text-shadow: 0 0 8px var(--hfp-accent); }
.nav-link:hover::after { transform: translateX(-50%) scaleX(1); }

/* ── Jumbotron / hero ────────────────────────────────────── */
.jumbotron {
    background: linear-gradient(
        180deg,
        rgba(0,255,136,0.04) 0%,
        transparent 100%
    );
    border-bottom: 1px solid var(--hfp-border);
    padding: 2.5rem 0 1.8rem;
    position: relative;
    overflow: hidden;
}

.jumbotron::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hfp-accent), transparent);
    animation: scan-line-h 4s ease-in-out infinite;
}

@keyframes scan-line-h {
    0%   { left: -60%; }
    100% { left: 160%; }
}

.jumbotron h1 {
    font-family: 'Orbitron', monospace;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--hfp-text);
    text-shadow: 0 0 20px rgba(0,255,136,0.25);
    position: relative;
}

/* ── Catégories ──────────────────────────────────────────── */
.category-header {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 1.4rem;
}

.category-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: var(--hfp-accent2);
    box-shadow: 0 0 8px var(--hfp-accent2);
    border-radius: 2px;
}

.category-header h3,
#challenges-by-category h3,
.category-title {
    font-family: 'Share Tech Mono', monospace;
    color: var(--hfp-accent2);
    font-size: 0.72rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0,200,255,0.3);
    border: none;
    margin: 0;
    padding: 0;
}

/* ── Challenge buttons ───────────────────────────────────── */
.challenge-button {
    background: linear-gradient(
        135deg,
        var(--hfp-surface) 0%,
        var(--hfp-surface2) 100%
    ) !important;
    border: 1px solid var(--hfp-border) !important;
    color: var(--hfp-text) !important;
    border-radius: 8px !important;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    position: relative;
    overflow: hidden;
    min-height: 100px;
}

.challenge-button::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 0; height: 0;
    border-style: solid;
    border-width: 0 14px 14px 0;
    border-color: transparent var(--hfp-border) transparent transparent;
    transition: border-color 0.6s;
}

.challenge-button::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--hfp-accent), var(--hfp-accent2));
    opacity: 0;
    transition: opacity 0.6s;
}

.challenge-button:hover {
    border-color: rgba(0,255,136,0.5) !important;
    box-shadow:
        0 0 0 1px rgba(0,255,136,0.12),
        0 8px 32px rgba(0,0,0,0.5),
        0 0 20px rgba(0,255,136,0.08),
        inset 0 0 30px rgba(0,255,136,0.02) !important;
    transform: translateY(-3px) !important;
    background: linear-gradient(
        135deg,
        var(--hfp-surface2) 0%,
        var(--hfp-surface3) 100%
    ) !important;
}

.challenge-button:hover::before { opacity: 1; }
.challenge-button:hover::after  { border-color: transparent var(--hfp-accent) transparent transparent; }

.challenge-button.challenge-solved,
.challenge-button.solved {
    border-color: var(--hfp-accent) !important;
    background: linear-gradient(
        135deg,
        rgba(0,255,136,0.06) 0%,
        var(--hfp-surface2) 100%
    ) !important;
    box-shadow: 0 0 16px rgba(0,255,136,0.07) !important;
}

.challenge-button.challenge-solved::before,
.challenge-button.solved::before { opacity: 1; }
.challenge-button.challenge-solved::after,
.challenge-button.solved::after { border-color: transparent var(--hfp-accent) transparent transparent; }

.challenge-button .challenge-inner p {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.challenge-button .challenge-inner span,
.challenge-value {
    font-family: 'Share Tech Mono', monospace;
    color: var(--hfp-accent);
    font-size: 0.82rem;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0,255,136,0.4);
}

/* ── Cards génériques ────────────────────────────────────── */
.card {
    background: linear-gradient(135deg, var(--hfp-surface) 0%, var(--hfp-surface2) 100%);
    border: 1px solid var(--hfp-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: border-color 0.6s, box-shadow 0.6s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,255,136,0.2), transparent);
}

.card:hover {
    border-color: rgba(0,255,136,0.25);
    box-shadow: 0 8px 36px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,255,136,0.06);
}

.card-header {
    background: linear-gradient(90deg, var(--hfp-surface2), var(--hfp-surface3));
    border-bottom: 1px solid var(--hfp-border);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--hfp-accent);
    padding: 0.75rem 1.25rem;
}

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.72rem;
    border-radius: 4px;
    transition: all 0.5s;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 120%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s;
}
.btn:hover::after { left: 160%; }

.btn-primary {
    background: transparent;
    border: 1px solid var(--hfp-accent);
    color: var(--hfp-accent);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--hfp-accent);
    color: var(--hfp-bg);
    box-shadow: 0 0 20px var(--hfp-glow), 0 0 40px rgba(0,255,136,0.12);
    border-color: var(--hfp-accent);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--hfp-border2);
    color: var(--hfp-text2);
}
.btn-secondary:hover { border-color: var(--hfp-accent2); color: var(--hfp-accent2); box-shadow: 0 0 12px var(--hfp-glow2); }

.btn-danger {
    background: transparent;
    border: 1px solid var(--hfp-danger);
    color: var(--hfp-danger);
}
.btn-danger:hover { background: var(--hfp-danger); color: #fff; box-shadow: 0 0 16px rgba(255,71,87,0.3); }

.btn-success {
    background: transparent;
    border: 1px solid var(--hfp-accent);
    color: var(--hfp-accent);
}
.btn-success:hover { background: var(--hfp-accent); color: var(--hfp-bg); }

/* ── Formulaires ─────────────────────────────────────────── */
.form-control, .form-select {
    background-color: var(--hfp-surface2);
    border: 1px solid var(--hfp-border);
    color: var(--hfp-text);
    border-radius: 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.88rem;
    transition: border-color 0.4s, box-shadow 0.4s;
}

.form-control:focus, .form-select:focus {
    background-color: var(--hfp-surface3);
    border-color: var(--hfp-accent);
    color: var(--hfp-text);
    box-shadow: 0 0 0 3px rgba(0,255,136,0.08), 0 0 16px rgba(0,255,136,0.06);
    outline: none;
}

.form-control::placeholder { color: var(--hfp-muted); opacity: 0.7; }
.form-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--hfp-text2);
    margin-bottom: 0.4rem;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-content {
    background: linear-gradient(160deg, var(--hfp-surface) 0%, var(--hfp-surface2) 100%);
    border: 1px solid var(--hfp-border);
    border-radius: 10px;
    box-shadow:
        0 0 60px rgba(0,0,0,0.8),
        0 0 0 1px rgba(0,255,136,0.05),
        0 0 40px rgba(0,255,136,0.04);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--hfp-border);
    background: linear-gradient(90deg, var(--hfp-surface2), var(--hfp-surface3));
    padding: 1.1rem 1.5rem;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--hfp-accent), var(--hfp-accent2), var(--hfp-accent3));
    opacity: 0.5;
}

.modal-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--hfp-accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(0,255,136,0.5);
}

.modal-body {
    padding: 1.6rem;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--hfp-text);
}

.modal-footer {
    border-top: 1px solid var(--hfp-border);
    background: var(--hfp-surface2);
    padding: 0.9rem 1.5rem;
}

.btn-close { filter: invert(1) opacity(0.4); }
.btn-close:hover { filter: invert(1) opacity(0.9); }

/* ── Tableaux (scoreboard) ───────────────────────────────── */
.table { color: var(--hfp-text); border-color: var(--hfp-border); }

.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: var(--hfp-border);
    color: var(--hfp-text);
    padding: 0.8rem 1rem;
}

.table thead th {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--hfp-accent);
    border-bottom: 1px solid var(--hfp-accent) !important;
    text-shadow: 0 0 8px rgba(0,255,136,0.3);
}

.table tbody tr { transition: background 0.4s; }
.table tbody tr:hover > * { background: rgba(0,255,136,0.03) !important; }

.table tbody tr:first-child td { color: var(--hfp-accent); }
.table tbody tr:first-child td:first-child { font-weight: 700; text-shadow: 0 0 10px rgba(0,255,136,0.4); }
.table tbody tr:nth-child(2) td:first-child { color: var(--hfp-accent2); }
.table tbody tr:nth-child(3) td:first-child { color: var(--hfp-warn); }

/* ── Alertes ─────────────────────────────────────────────── */
.alert {
    border-radius: 6px;
    border-left-width: 3px;
    border-top: none;
    border-right: none;
    border-bottom: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.alert-success { background: rgba(0,255,136,0.07); border-color: var(--hfp-accent); color: var(--hfp-accent); }
.alert-danger  { background: rgba(255,71,87,0.07);  border-color: var(--hfp-danger); color: var(--hfp-danger); }
.alert-info    { background: rgba(0,200,255,0.07);  border-color: var(--hfp-accent2); color: var(--hfp-accent2); }
.alert-warning { background: rgba(255,165,2,0.07);  border-color: var(--hfp-warn); color: var(--hfp-warn); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1px;
    border-radius: 3px;
    padding: 0.25em 0.55em;
}

.badge.bg-success { background: rgba(0,255,136,0.15) !important; color: var(--hfp-accent) !important; border: 1px solid rgba(0,255,136,0.3); }
.badge.bg-primary { background: rgba(0,200,255,0.15) !important; color: var(--hfp-accent2) !important; border: 1px solid rgba(0,200,255,0.3); }
.badge.bg-danger  { background: rgba(255,71,87,0.15) !important;  color: var(--hfp-danger) !important;  border: 1px solid rgba(255,71,87,0.3); }

/* ── Footer ──────────────────────────────────────────────── */
footer, .footer {
    background: var(--hfp-surface) !important;
    border-top: 1px solid var(--hfp-border);
    color: var(--hfp-muted);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-align: center;
    padding: 1rem;
    position: relative;
}

footer::before, .footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hfp-border2), transparent);
}

/* ── Typographie ─────────────────────────────────────────── */
h1, h2 { font-family: 'Orbitron', monospace; font-weight: 700; letter-spacing: 2px; }
h3, h4, h5, h6 { font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: 1px; }
a { color: var(--hfp-accent2); text-decoration: none; transition: color 0.4s, text-shadow 0.4s; }
a:hover { color: var(--hfp-accent); text-shadow: 0 0 8px rgba(0,255,136,0.3); }

code, pre, .monospace {
    font-family: 'Share Tech Mono', monospace;
    color: var(--hfp-accent);
    background: var(--hfp-surface2);
    padding: 0.15em 0.5em;
    border-radius: 3px;
    font-size: 0.86em;
    border: 1px solid var(--hfp-border);
}

pre {
    padding: 1rem 1.2rem;
    overflow-x: auto;
    line-height: 1.6;
    border-left: 3px solid var(--hfp-accent);
}

hr { border-color: var(--hfp-border); opacity: 1; }

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown-menu {
    background: linear-gradient(160deg, var(--hfp-surface) 0%, var(--hfp-surface2) 100%);
    border: 1px solid var(--hfp-border);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,255,136,0.03);
    padding: 0.4rem 0;
}

.dropdown-item {
    color: var(--hfp-text2);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 1px;
    padding: 0.55rem 1.2rem;
    transition: background 0.4s, color 0.4s;
}
.dropdown-item:hover { background: rgba(0,255,136,0.07); color: var(--hfp-accent); }
.dropdown-item.bg-primary { background: rgba(0,200,255,0.12) !important; color: var(--hfp-accent2) !important; }
.dropdown-divider { border-color: var(--hfp-border); }

/* ── Pagination ──────────────────────────────────────────── */
.page-link {
    background: var(--hfp-surface);
    border-color: var(--hfp-border);
    color: var(--hfp-text2);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    transition: all 0.4s;
}
.page-link:hover { background: var(--hfp-surface2); color: var(--hfp-accent); border-color: var(--hfp-accent); }
.page-item.active .page-link { background: transparent; border-color: var(--hfp-accent); color: var(--hfp-accent); }

/* ── Tabs (challenge modal) ──────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--hfp-border); }
.nav-tabs .nav-link {
    color: var(--hfp-text2) !important;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    padding: 0.6rem 1.2rem !important;
    transition: color 0.4s, border-color 0.4s;
}
.nav-tabs .nav-link:hover { color: var(--hfp-accent) !important; }
.nav-tabs .nav-link.active {
    color: var(--hfp-accent) !important;
    background: transparent !important;
    border-bottom-color: var(--hfp-accent) !important;
    text-shadow: 0 0 10px rgba(0,255,136,0.4);
}

/* ── Toast / snackbar ────────────────────────────────────── */
.toast {
    background: var(--hfp-surface2);
    border: 1px solid var(--hfp-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.toast-header {
    background: var(--hfp-surface3);
    border-bottom: 1px solid var(--hfp-border);
    color: var(--hfp-accent);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
}
.toast-body { color: var(--hfp-text); font-size: 0.88rem; }

/* ── Animation d'apparition des cartes ───────────────────── */
@keyframes card-appear {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.col-sm-6 { animation: card-appear 0.5s ease both; }
.col-sm-6:nth-child(1) { animation-delay: 0.06s; }
.col-sm-6:nth-child(2) { animation-delay: 0.12s; }
.col-sm-6:nth-child(3) { animation-delay: 0.18s; }
.col-sm-6:nth-child(4) { animation-delay: 0.24s; }
.col-sm-6:nth-child(5) { animation-delay: 0.30s; }
.col-sm-6:nth-child(6) { animation-delay: 0.36s; }

/* ── Utilitaires HFP ─────────────────────────────────────── */
.text-accent  { color: var(--hfp-accent) !important; }
.text-accent2 { color: var(--hfp-accent2) !important; }
.glow-green   { text-shadow: 0 0 10px var(--hfp-accent); }
.glow-blue    { text-shadow: 0 0 10px var(--hfp-accent2); }
