/* 
 * SkedAC Anti-Cheat Dashboard - Dark Mode
 * Style moderne avec gradient Sked
 */

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

:root {
    --sked-pink: #f93b53;
    --sked-red: #ff3d4e;
    --sked-magenta: #dc2f6e;
    --sked-purple: #bb228b;
    --sked-gradient: linear-gradient(90deg, #f93b53, #ff3d4e 7.5%, #dc2f6e 75%, #bb228b);
    
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    
    --border-color: #2a2a2a;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px;
}

/* Header avec gradient Sked */
header {
    background: var(--sked-gradient);
    color: white;
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 8px 24px rgba(249, 59, 83, 0.3);
    position: relative;
    overflow: hidden;
}

/* header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
} */

header .logo {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

header .logo a {
    display: block;
    background-color: black;
    border-radius: 10px;
    line-height: 1em;
    padding: 10px 13px;
}

header a:hover .logo {
    transform: translateY(-3px);
    opacity: 0.9;
}

header .logo img {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    line-height: 1.2;
}

header p {
    opacity: 0.95;
    font-size: 16px;
    position: relative;
    z-index: 1;
}

/* Admin header (barre de connexion) */
.admin-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 20px 30px;
    margin: -30px -30px 30px -30px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-details {
    font-size: 13px;
    line-height: 1.6;
}

.admin-details strong {
    font-weight: 600;
    color: var(--sked-pink);
}

.admin-details .small {
    color: var(--text-secondary);
    font-size: 12px;
}

.admin-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    margin-top: 2px;
}

.admin-meta-sep {
    opacity: 0.3;
    user-select: none;
}

.admin-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-details code {
    background: rgba(249, 59, 83, 0.1);
    color: var(--sked-pink);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.logout-btn {
    padding: 10px 20px;
    background: var(--sked-gradient);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(249, 59, 83, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 59, 83, 0.4);
    color: white;
    text-decoration: none;
}

/* Stats grid */
.stats-grid {
    display: grid;
    /* 18/08/2026 — 240px (au lieu de 280px) pour que les 6 stat-cards
       (dont la carte Exceptions conditionnelle) tiennent sur une ligne */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--sked-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--sked-pink);
    box-shadow: 0 8px 24px rgba(249, 59, 83, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-card .value {
    font-size: 48px;
    font-weight: 800;
    background: var(--sked-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Cards */
.card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

.card:hover {
    border-color: rgba(249, 59, 83, 0.3);
}

.card h2 {
    font-size: 22px;
    margin-bottom: 25px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--sked-gradient);
    border-radius: 2px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* force le scroll horizontal si l'écran est trop petit */
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr {
    transition: background-color 0.2s;
}

tr:hover {
    background-color: var(--bg-card-hover);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.badge.low-risk {
    background: rgba(255, 193, 7, 0.15);
    color: var(--warning);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.badge.danger {
    background: rgba(244, 67, 54, 0.15);
    color: var(--danger);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.badge.critical {
    background: rgba(156, 39, 176, 0.15);
    color: #9C27B0;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.badge.warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge.active {
    background: rgba(249, 59, 83, 0.15);
    color: var(--sked-pink);
    border: 1px solid rgba(249, 59, 83, 0.3);
}

/* Links */
a {
    color: var(--sked-pink);
    text-decoration: none;
    transition: all 0.3s;
}

a:hover {
    color: var(--sked-red);
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--sked-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(249, 59, 83, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 59, 83, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: none;
    white-space: nowrap;
}

.btn-secondary:hover {
    border-color: var(--sked-pink);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Timestamps */
.timestamp {
    color: var(--text-muted);
    font-size: 13px;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.inactive {
    background: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--sked-magenta);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        padding: 30px 20px;
    }
    
    header h1 {
        font-size: 28px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
        text-align: left;
    }

    .admin-info > div:first-child {
        display: none; /* Masquer l'icône 🔐 pour gagner de la place */
    }

    .admin-details {
        padding: 10px 10px 0 10px;
    }

    .admin-meta-sep {
        display: none; /* Supprimer les "|" — chaque item est sur sa propre ligne */
    }

    .admin-meta span {
        flex-basis: 100%;
        line-height: 1.8;
    }

    .admin-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-controls .logout-btn {
        flex: 1;
        text-align: center;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 10px;
    }
}

/* Layout Score + Chat côte à côte */
.score-chat-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
.score-chat-layout.single {
    grid-template-columns: 1fr;
}
@media (max-width: 1100px) {
    .score-chat-layout {
        grid-template-columns: 1fr;
    }
}

/* Chat IA contextuel */
.ai-dot {
    width: 8px; height: 8px; background: #BB86FC; border-radius: 50%;
    animation: ai-bounce 1.2s infinite ease-in-out;
}
@keyframes ai-bounce {
    0%, 80%, 100% { transform: translateY(0) scale(0.7); opacity: 0.4; }
    40% { transform: translateY(-6px) scale(1); opacity: 1; }
}

/* Rendu markdown dans les bulles IA */
.ai-markdown {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}
.ai-markdown p { margin: 0 0 8px 0; }
.ai-markdown p:last-child { margin-bottom: 0; }
.ai-markdown strong { color: #BB86FC; font-weight: 600; }
.ai-markdown em { font-style: italic; opacity: 0.9; }
.ai-markdown ul, .ai-markdown ol { margin: 6px 0 8px 0; padding-left: 20px; }
.ai-markdown li { margin-bottom: 4px; }
.ai-markdown h1, .ai-markdown h2, .ai-markdown h3 {
    font-size: 13px;
    font-weight: 700;
    color: #BB86FC;
    margin: 10px 0 4px 0;
}
.ai-markdown code {
    background: rgba(187, 134, 252, 0.15);
    border: 1px solid rgba(187, 134, 252, 0.2);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    font-family: monospace;
}
.ai-markdown pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    margin: 8px 0;
}
.ai-markdown pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
}
.ai-markdown hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 10px 0;
}

/* Org dropdown : sur mobile aligne à gauche pour ne pas sortir de l'écran */
@media (max-width: 600px) {
    .org-dropdown-menu {
        right: auto !important;
        left: 0 !important;
        min-width: min(220px, calc(100vw - 20px)) !important;
    }
}
