/* ============================================
   TeamSpeak Channel Viewer - CSS
   MIT DDoS-ERKENNUNG + NEWBIE-DETECTION

   🚨 DDoS:
   🟡 Verdächtig   │ >50/s    │ Gelb
   🔴 DDoS         │ >100/s   │ Rot
   🤖 Bot          │ <30s+>10 │ Lila
   🕸️ Botnet       │ 3+ IP    │ Rot

   👁️ Newbie:
   👁️ Erster       │ ==1      │ Blau leuchtend
   👀 Sehr neu     │ <=5      │ Blau
   🔰 Neuling      │ <=10     │ Hellblau

   🔧 Layout-Änderung (28.12.2025):
   - Header kompakter
   - Sidepanel nach LINKS
   - Mehr Platz für User-Divs
   ============================================ */

/* ============================================
   RESET + GRUNDLAGEN
   ============================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
    min-height: 100vh;
    color: #fff;
}

.cv-container {
    /* Volle Breite nutzen für mehr Platz */
    max-width: 100%;
    margin: 0;
    padding: 8px;
}





/* ============================================
   HEADER - KOMPAKT VERSION
   - Weniger Höhe = mehr Platz für User-Divs
   ============================================ */

.cv-header-compact {
    background: rgba(30, 40, 55, 0.85);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 255, 153, 0.2);
    backdrop-filter: blur(10px);
}

/* Header Zeile 1: Titel + Buttons */
.cv-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cv-header-compact h1 {
    font-size: 18px;
    color: #00ff99;
    text-shadow: 0 0 20px rgba(0, 255, 153, 0.3);
    white-space: nowrap;
}

.cv-header-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================
   BUTTONS - Klein und kompakt
   ============================================ */

.cv-btn-small {
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid rgba(88, 166, 255, 0.4);
    color: #58a6ff;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    user-select: none;
}

.cv-btn-small:hover {
    background: rgba(88, 166, 255, 0.3);
    transform: scale(1.02);
}

.cv-btn-small.active {
    border-color: #00ff99;
    color: #00ff99;
}

/* YouTube Button - etwas auffälliger */
.cv-btn-yt {
    background: rgba(255, 0, 0, 0.12);
    border: 1px solid rgba(255, 0, 0, 0.4);
    color: #ff5a5a;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

.cv-btn-yt:hover {
    background: rgba(255, 0, 0, 0.22);
}

/* Zoom Controls Container */
.cv-zoom-controls {
    display: flex;
    gap: 4px;
}

/* ============================================
   STATUS-ZEILE - Kompakt
   ============================================ */

.cv-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #8b949e;
    flex-wrap: wrap;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(48, 54, 61, 0.5);
}

/* Verbindungs-Dot (grün pulsierend = online) */
.cv-status-dot {
    width: 8px;
    height: 8px;
    background: #00ff99;
    border-radius: 50%;
    animation: cv-pulse 2s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 153, 0.5);
}

.cv-status-dot.offline {
    background: #ff4757;
    animation: none;
}

@keyframes cv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Trennzeichen */
.cv-sep {
    color: #30363d;
}

/* Bedienungshinweis (klein, grau) */
.cv-hint {
    color: #6e7681;
    font-size: 10px;
}

/* Threat Alert (rot blinkend) */
.cv-threat-alert {
    color: #ff4757;
    font-weight: bold;
}

.cv-threat-ok {
    color: #00ff99;
}

/* Newbie Alert (blau) */
.cv-newbie-alert {
    color: #00d4ff;
}

/* ============================================
   SCREENSHOT ERGEBNIS BOX
   ============================================ */

.cv-screenshot-result {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px;
    background: rgba(0, 255, 153, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 153, 0.2);
}

#cv-screenshot-url {
    flex: 1;
    min-width: 200px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    background: rgba(13, 17, 23, 0.9);
    color: #e6edf3;
    font-size: 11px;
}

#cv-screenshot-msg {
    font-size: 11px;
    color: #8b949e;
}

/* ============================================
   INFO PANEL - Ausklappbar
   ============================================ */

.cv-info-panel {
    display: none;
    margin-top: 8px;
    padding: 10px;
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid #58a6ff;
    border-radius: 8px;
}

.cv-info-panel.visible {
    display: block;
}

/* 3-Spalten Grid für Info */
.cv-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.cv-info-col {
    font-size: 11px;
    line-height: 1.6;
}

.cv-info-title {
    font-weight: bold;
    color: #58a6ff;
    margin-bottom: 5px;
}

.cv-info-notes {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #30363d;
    font-size: 10px;
    color: #f0883e;
}

/* ============================================
   MAIN LAYOUT
   - Sidepanel LINKS + Diagramm RECHTS
   - Diagramm bekommt flex: 1 (nimmt restlichen Platz)
   ============================================ */

.cv-main-layout {
    display: flex;
    gap: 8px;
    background: rgba(13, 17, 23, 0.7);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid rgba(48, 54, 61, 0.4);
    min-height: calc(100vh - 140px);
}

/* ============================================
   SIDEPANEL - LINKS
   - Startet eingeklappt (collapsed)
   - Klappt bei User-Klick auf
   ============================================ */

.cv-sidepanel {
    width: 280px;
    min-width: 280px;
    background: rgba(13, 17, 23, 0.9);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 10px;
    padding: 10px;
    transition: width 0.2s, min-width 0.2s, padding 0.2s;
    overflow: hidden;
}

/* Collapsed State - nur Toggle-Button sichtbar */
.cv-sidepanel.collapsed {
    width: 44px !important;
    min-width: 44px !important;
    padding: 8px 6px !important;
}

/* Im collapsed Zustand: Titel, Empty, Content ausblenden */
.cv-sidepanel.collapsed .cv-sidepanel-title,
.cv-sidepanel.collapsed .cv-sidepanel-close,
.cv-sidepanel.collapsed #cv-sidepanel-empty,
.cv-sidepanel.collapsed #cv-sidepanel-content {
    display: none !important;
}

/* Im collapsed Zustand: Header zentrieren */
.cv-sidepanel.collapsed .cv-sidepanel-header {
    justify-content: center;
    border: none;
    margin: 0;
    padding: 0;
}

/* Sidepanel Header */
.cv-sidepanel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    margin-bottom: 8px;
}

/* Toggle Button */
.cv-sidepanel-toggle {
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid rgba(88, 166, 255, 0.4);
    color: #58a6ff;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.cv-sidepanel-toggle:hover {
    background: rgba(88, 166, 255, 0.25);
}

/* Sidepanel Titel */
.cv-sidepanel-title {
    flex: 1;
    color: #58a6ff;
    font-weight: bold;
    font-size: 12px;
}

/* Close Button */
.cv-sidepanel-close {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.4);
    color: #ff4757;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cv-sidepanel-close:hover {
    background: rgba(255, 71, 87, 0.25);
}

/* Empty State Text */
.cv-sidepanel-empty {
    color: #8b949e;
    font-size: 11px;
    line-height: 1.4;
    padding: 8px 0;
}

/* User-Zeile: Flagge + Name */
.cv-sidepanel-userline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

/* Flagge Container */
.cv-sidepanel-flag {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* User Name */
.cv-sidepanel-name {
    font-weight: bold;
    color: #e6edf3;
    font-size: 13px;
}

/* User Sub (Platform) */
.cv-sidepanel-sub {
    font-size: 11px;
    color: #8b949e;
}

/* Action Buttons */
.cv-sidepanel-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

/* User-Zeile: Flagge + Name */
.cv-sidepanel-userline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

/* Flagge Container */
.cv-sidepanel-flag {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* User Name */
.cv-sidepanel-name {
    font-weight: bold;
    color: #e6edf3;
    font-size: 13px;
}

/* User Sub (Platform) */
.cv-sidepanel-sub {
    font-size: 11px;
    color: #8b949e;
}

/* Section Styles */
.cv-sidepanel-section {
    padding: 8px 0;
    border-top: 1px solid rgba(48, 54, 61, 0.4);
}

.cv-sidepanel-section-title {
    font-size: 10px;
    color: #58a6ff;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 4px;
}

.cv-sidepanel-text {
    font-size: 11px;
    color: #e6edf3;
    line-height: 1.4;
}

.cv-sidepanel-links a {
    color: #00ff99;
    text-decoration: none;
    font-size: 11px;
}

.cv-sidepanel-links a:hover {
    color: #58a6ff;
}

.cv-sidepanel-copy {
    width: 100%;
    min-height: 60px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    background: rgba(13, 17, 23, 0.9);
    color: #e6edf3;
    font-size: 10px;
    resize: vertical;
}

.cv-sidepanel-msg {
    font-size: 10px;
    color: #8b949e;
    margin-top: 4px;
}

/* ============================================
   DIAGRAMM BEREICH
   - Nimmt den meisten Platz ein (flex: 1)
   ============================================ */

.cv-diagram-area {
    flex: 1;
    min-width: 0;
    min-height: 600px;
    overflow: auto;
}

/* SVG Cursor Styles */
#cv-diagram svg {
    cursor: default;
}

#cv-diagram svg.cv-pannable {
    cursor: grab;
}

#cv-diagram svg.cv-panning {
    cursor: grabbing;
}

/* ============================================
   CHANNEL NODES
   ============================================ */

.cv-channel-box {
    fill: #1c2128;
    stroke: #30363d;
    stroke-width: 2;
    rx: 10;
    ry: 10;
}

.cv-channel:hover .cv-channel-box {
    stroke: #58a6ff;
}

.cv-channel-icon {
    font-size: 20px;
}

.cv-channel-name {
    fill: #e6edf3;
    font-weight: 600;
    font-size: 13px;
}

.cv-channel-count {
    fill: #7d8590;
    font-size: 11px;
}

/* ============================================
   USER NODES - Box Styles
   ============================================ */

.cv-user-box {
    fill: #0d1117;
    stroke: #238636;
    stroke-width: 2;
    rx: 10;
    ry: 10;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.cv-user:hover .cv-user-box {
    filter: drop-shadow(0 4px 16px rgba(35, 134, 54, 0.4));
}

/* Status-basierte Styles */
.cv-user-box.talking {
    stroke: #00ff99;
    animation: cv-glow-talk 2s ease-in-out infinite;
}

.cv-user-box.muted {
    stroke: #f0883e;
}

.cv-user-box.away {
    stroke: #484f58;
    opacity: 0.7;
}

.cv-user-box.recording {
    stroke: #ff4757 !important;
    stroke-width: 3px !important;
    animation: cv-recording-pulse 0.8s ease-in-out infinite !important;
}

/* ============================================
   🚨 THREAT STYLES (DDoS/Bot/Botnet)
   ============================================ */

.cv-user-box.threat-suspicious {
    stroke: #f0883e !important;
    stroke-width: 3px !important;
    animation: cv-threat-warning 1.5s ease-in-out infinite !important;
}

.cv-user-box.threat-ddos {
    stroke: #ff4757 !important;
    stroke-width: 4px !important;
    animation: cv-threat-danger 0.5s ease-in-out infinite !important;
}

.cv-user-box.threat-bot {
    stroke: #a855f7 !important;
    stroke-width: 3px !important;
}

.cv-user-box.threat-botnet {
    stroke: #ff4757 !important;
    stroke-width: 4px !important;
    animation: cv-threat-danger 0.5s ease-in-out infinite !important;
}

/* ============================================
   👁️ NEWBIE STYLES
   ============================================ */

.cv-user-box.newbie-first {
    stroke: #00d4ff !important;
    stroke-width: 4px !important;
    animation: cv-newbie-first-glow 1s ease-in-out infinite !important;
}

.cv-user-box.newbie-verynew {
    stroke: #58a6ff !important;
    stroke-width: 3px !important;
}

.cv-user-box.newbie-regular {
    stroke: #7dd3fc !important;
    stroke-width: 2px !important;
}

/* ============================================
   ANIMATIONEN
   ============================================ */

@keyframes cv-glow-talk {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(0, 255, 153, 0.4)); }
    50% { filter: drop-shadow(0 0 20px rgba(0, 255, 153, 0.8)); }
}

@keyframes cv-recording-pulse {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.5; }
}

@keyframes cv-threat-warning {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(240, 136, 62, 0.6)); }
    50% { filter: drop-shadow(0 0 25px rgba(240, 136, 62, 1)); }
}

@keyframes cv-threat-danger {
    0%, 100% { filter: drop-shadow(0 0 15px rgba(255, 71, 87, 0.8)); }
    50% { filter: drop-shadow(0 0 35px rgba(255, 71, 87, 1)); }
}

@keyframes cv-newbie-first-glow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.8)); }
    50% { filter: drop-shadow(0 0 30px rgba(0, 212, 255, 1)); }
}

/* ============================================
   CONNECTION LINKS (Linien zwischen Channel und User)
   ============================================ */

.cv-link {
    fill: none;
    stroke: #30363d;
    stroke-width: 2;
    opacity: 0.5;
}

.cv-link-talking {
    stroke: #00ff99;
    opacity: 0.7;
}

.cv-link-muted {
    stroke: #f0883e;
    stroke-dasharray: 8, 4;
}

.cv-link-away {
    stroke: #484f58;
    stroke-dasharray: 4, 8;
    opacity: 0.3;
}

/* Threat Links */
.cv-link-threat-warning {
    stroke: #f0883e;
    stroke-width: 3;
}

.cv-link-threat-danger {
    stroke: #ff4757;
    stroke-width: 4;
}

/* Newbie Links */
.cv-link-newbie-first {
    stroke: #00d4ff;
    stroke-width: 3;
}

.cv-link-newbie-verynew {
    stroke: #58a6ff;
}

.cv-link-newbie-regular {
    stroke: #7dd3fc;
}

/* ============================================
   USER TEXT STYLES - NORMAL MODE (2-Spalten)
   ============================================ */

.cv-user-flag-normal {
    font-size: 18px;
}

.cv-user-name-normal {
    fill: #e6edf3;
    font-weight: bold;
    font-size: 14px;
}

.cv-user-name-normal.talking {
    fill: #00ff99;
}

.cv-user-name-normal.muted {
    fill: #f0883e;
}

.cv-user-name-normal.away {
    fill: #7d8590;
}

.cv-user-platform-normal {
    fill: #8b949e;
    font-size: 11px;
}

.cv-user-status-normal {
    fill: #7d8590;
    font-size: 12px;
}

.cv-user-time-normal {
    fill: #6e7681;
    font-size: 11px;
}

.cv-user-logins-normal {
    fill: #6e7681;
    font-size: 11px;
}

.cv-user-first-normal {
    fill: #484f58;
    font-size: 10px;
}

.cv-user-packets-normal {
    fill: #8b949e;
    font-size: 11px;
}

.cv-user-bandwidth-normal {
    fill: #6e7681;
    font-size: 10px;
}

.cv-user-city-normal {
    fill: #8b949e;
    font-size: 11px;
}

.cv-user-isp-normal {
    fill: #6e7681;
    font-size: 10px;
}

.cv-user-groups-normal {
    fill: #7d8590;
    font-size: 10px;
}

.cv-user-away-normal {
    fill: #f0883e;
    font-size: 10px;
    font-style: italic;
}

.cv-user-recording-normal {
    fill: #ff4757;
    font-size: 10px;
    font-weight: bold;
    animation: cv-rec-text-blink 0.8s infinite;
}

@keyframes cv-rec-text-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   USER TEXT STYLES - KOMPAKT MODE
   ============================================ */

.cv-user-flag {
    font-size: 16px;
}

.cv-user-name {
    fill: #e6edf3;
    font-weight: bold;
    font-size: 12px;
}

.cv-user-name.talking {
    fill: #00ff99;
}

.cv-user-name.muted {
    fill: #f0883e;
}

.cv-user-name.away {
    fill: #7d8590;
}

.cv-user-status {
    fill: #7d8590;
    font-size: 10px;
}

.cv-user-time {
    fill: #484f58;
    font-size: 9px;
}

.cv-user-stats {
    fill: #484f58;
    font-size: 9px;
}

.cv-user-first {
    fill: #484f58;
    font-size: 9px;
}

/* ============================================
   PNG FLAGGEN STYLES
   ============================================ */

.cv-user-flag-img {
    /* SVG image element - Standard-Styles */
}

/* ============================================
   TOOLTIP (Hover)
   ============================================ */

.cv-tooltip {
    position: absolute;
    background: rgba(13, 17, 23, 0.98);
    border: 1px solid #30363d;
    border-radius: 12px;
    font-size: 11px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s;
    max-width: 350px;
    min-width: 250px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.cv-tooltip.visible {
    opacity: 1;
}

.cv-tooltip-header {
    background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cv-tooltip-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.cv-tooltip-avatar img {
    border-radius: 3px;
}

.cv-tooltip-title-area {
    flex: 1;
}

.cv-tooltip-title {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.cv-tooltip-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

/* ============================================
   FOOTER
   ============================================ */

.cv-footer {
    margin-top: 15px;
    text-align: center;
    padding: 10px;
}

#cv-api-link {
    font-size: 10px;
    color: #484f58;
}

#cv-api-link a {
    color: #58a6ff;
    text-decoration: none;
}

#cv-api-link a:hover {
    color: #00ff99;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1400px) {
    .cv-sidepanel {
        width: 240px;
        min-width: 240px;
    }
}

@media (max-width: 1200px) {
    /* Sidepanel unter Diagramm */
    .cv-main-layout {
        flex-direction: column;
    }

    .cv-sidepanel {
        width: 100%;
        min-width: 100%;
        position: static;
    }

    .cv-sidepanel.collapsed {
        width: 100% !important;
        min-width: 100% !important;
        height: 44px;
    }

    .cv-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cv-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .cv-header-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .cv-status-row {
        font-size: 10px;
    }

    .cv-hint {
        display: none;
    }
}

