/* ==========================================================================
   Variables Globales & Thème "War Room"
   ========================================================================== */
:root {
    --bg-dark: #060b14;
    --bg-card: rgba(13, 22, 43, 0.7);
    --bg-card-hover: rgba(18, 30, 58, 0.85);
    
    --text-main: #eef6ff;
    --text-muted: rgba(238, 246, 255, 0.65);
    
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-glow: rgba(59, 130, 246, 0.4);
    
    --alert-critical: #ef4444;
    --alert-critical-bg: rgba(239, 68, 68, 0.15);
    --alert-high: #f97316;
    --alert-high-bg: rgba(249, 115, 22, 0.15);
    
    --border-light: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(59, 130, 246, 0.5);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Force le masquage des éléments cachés par JS (Écrase les propriétés display comme grid ou flex) */
[hidden] {
    display: none !important;
}

body.theme-dark {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.05), transparent 25%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, .brand-logo, .kpi-value, .tab-btn {
    font-family: 'Oxanium', system-ui, sans-serif;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-cyan);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==========================================================================
   En-tête (Navigation)
   ========================================================================== */
.top-nav {
    background: rgba(6, 11, 20, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.brand-accent {
    color: var(--accent-cyan);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-return {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.btn-return:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    color: var(--text-main);
}

/* ==========================================================================
   Hero Section & KPIs
   ========================================================================== */
.hero {
    padding: 4rem 1.5rem 2rem;
    text-align: center;
}

.hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-cyan);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.kpi-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kpi-cta {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.1), rgba(6, 182, 212, 0.05));
    border-color: var(--border-focus);
}

.kpi-text {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.btn-audit {
    background: var(--accent-blue);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-audit:hover {
    background: #2563eb;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

/* ==========================================================================
   Espace de travail & Onglets
   ========================================================================== */
.workspace {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
    flex: 1;
    width: 100%;
}

.tabs-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Barre d'outils (Recherche & Filtres)
   ========================================================================== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.search-box {
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-box svg {
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.75rem 0;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group select {
    appearance: none;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23eef6ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: var(--transition);
}

.filter-group select:focus {
    border-color: var(--border-focus);
}

.filter-group select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

/* ==========================================================================
   États d'affichage (Chargement, Vide, Erreur)
   ========================================================================== */
.state-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.state-message svg {
    margin-bottom: 1rem;
    opacity: 0.8;
}

.state-message p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-main);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-cyan);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Cartes de Données (CTI & OSINT)
   ========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.alert-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--border-light);
}

.alert-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Couleurs dynamiques selon la criticité */
.alert-card[data-severity="critique"]::before { background: var(--alert-critical); }
.alert-card[data-severity="eleve"]::before { background: var(--alert-high); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-cve {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.badge-severity {
    background: rgba(255, 255, 255, 0.1);
}

.badge-critique {
    background: var(--alert-critical-bg);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-eleve {
    background: var(--alert-high-bg);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.card-impact {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    margin-top: auto;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--alert-critical);
    color: #fff;
    border-color: var(--alert-critical);
}

.btn-readmore {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-readmore:hover {
    color: var(--text-main);
}

/* Styles spécifiques pour les cartes OSINT (Fuites) */
.card-osint .card-impact {
    -webkit-line-clamp: unset;
}

.osint-data-list {
    margin-top: 0.5rem;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.osint-data-item {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==========================================================================
   Modale (Détails)
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out forwards;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.modal-content {
    padding: 2rem;
}

.modal-content .card-title {
    font-size: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.modal-content .impact-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.modal-content h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-main);
    line-height: 1.6;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.cyber-footer {
    border-top: 1px solid var(--border-light);
    padding: 2rem 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.footer-links a {
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--text-main);
}

.sep {
    opacity: 0.3;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .nav-container { flex-direction: column; gap: 1rem; }
    
    .tabs-container { flex-direction: column; }
    .tab-btn { justify-content: center; }
    
    .toolbar { flex-direction: column; }
    .search-box { width: 100%; }
    .filters { width: 100%; }
    .filter-group { flex: 1; min-width: 140px; }
    .filter-group select { width: 100%; }
    
    .cards-grid { grid-template-columns: 1fr; }
    
    .modal-content { padding: 1.5rem; }
}