/* TeamSpeak 3 Ultra-Modern Live Tree, Badges & Context Menu Styles */
.ts3-tree-wrapper {
    position: relative;
    background: radial-gradient(circle at 10% 20%, rgba(14, 28, 58, 0.95), rgba(4, 10, 24, 0.98) 90%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 30px rgba(56, 189, 248, 0.08);
    min-height: 480px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.ts3-tree-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.04) 0%, transparent 60%);
    pointer-events: none;
    animation: rotateBgLight 25s linear infinite;
}

@keyframes rotateBgLight {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ts3-tree-container {
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    position: relative;
    z-index: 2;
}

/* Channel Row */
.ts3-channel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.95rem;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.75), rgba(30, 41, 59, 0.45));
    border: 1px solid rgba(56, 189, 248, 0.12);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ts3-channel-row:hover {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.18), rgba(30, 41, 59, 0.75));
    border-color: rgba(56, 189, 248, 0.45);
    transform: translateX(5px) scale(1.002);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.15);
}

.ts3-channel-row.drag-over {
    background: rgba(56, 189, 248, 0.28) !important;
    border: 2px dashed #38bdf8 !important;
    transform: scale(1.02);
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.4);
}

.ts3-channel-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.94rem;
    font-weight: 700;
    color: #f0f9ff;
    letter-spacing: 0.2px;
}

.ts3-spacer-row {
    padding: 0.55rem 0.95rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.3rem 0;
    transition: all 0.2s ease;
}

.ts3-spacer-row:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    transform: scale(1.005);
}

/* Client Row */
.ts3-client-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 2.2rem;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(8, 18, 38, 0.85), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: grab;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ts3-client-row:active {
    cursor: grabbing;
}

.ts3-client-row:hover {
    background: linear-gradient(90deg, rgba(30, 58, 102, 0.85), rgba(15, 23, 42, 0.85));
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.ts3-client-row.dragging {
    opacity: 0.35;
    transform: scale(0.98);
    background: rgba(56, 189, 248, 0.2);
    border: 1px dashed #38bdf8;
}

.ts3-client-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Authentic TeamSpeak 3 Client Avatar Container */
.ts3-client-avatar-wrap {
    position: relative;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Speaking Light Indicators */
.ts3-light {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.ts3-light.idle {
    background: #0284c7;
    box-shadow: 0 0 6px rgba(2, 132, 199, 0.5);
}

.ts3-light.talking {
    background: #22c55e;
    box-shadow: 0 0 12px #22c55e, 0 0 20px rgba(34, 197, 94, 0.8);
    animation: pulseTalk 1.2s infinite;
}

@keyframes pulseTalk {
    0% { transform: scale(1); box-shadow: 0 0 8px #22c55e; }
    50% { transform: scale(1.25); box-shadow: 0 0 16px #22c55e; }
    100% { transform: scale(1); box-shadow: 0 0 8px #22c55e; }
}

/* Audio Status Icons */
.ts3-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    line-height: 1;
}

.ts3-mic-muted {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.ts3-sound-muted {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.ts3-away {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.15);
}

/* Client Nickname */
.ts3-client-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f1f5f9;
}

/* Realistic TS3 Status Badges */
.ts3-realistic-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    padding: 0.18rem 0.45rem;
    border-radius: 6px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.2px;
}

.ts3-status-commander {
    background: rgba(249, 115, 22, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.5);
    color: #fb923c;
    font-weight: 800;
}

.ts3-status-away {
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #d8b4fe;
    animation: afkGlow 2.5s infinite ease-in-out;
}

.ts3-status-mic-muted {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

.ts3-status-sound-muted {
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fde047;
}

@keyframes afkGlow {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; box-shadow: 0 0 10px rgba(168, 85, 247, 0.4); }
}

/* Group Icon Badge with Tooltip */
.ts3-group-icon-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: default;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.ts3-group-icon-badge:hover {
    transform: scale(1.18);
    z-index: 10;
}

.ts3-group-icon-tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0b1528;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    white-space: nowrap;
    opacity: 0;
    transition: all 0.18s ease;
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.6);
}

.ts3-group-icon-badge:hover .ts3-group-icon-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ts3-badge-os {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 0.25rem 0.45rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
}

.ts3-flag {
    border-radius: 3px;
    width: 16px;
    height: 11px;
    object-fit: cover;
}

/* Popover Client Hover Card */
.ts3-client-card {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 40px;
    background: #091326;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.2);
    z-index: 1000;
    min-width: 250px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s, transform 0.2s;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.ts3-client-row:hover .ts3-client-card {
    opacity: 1;
    transform: translateY(0);
}

.ts3-card-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
}

.ts3-card-row:last-child {
    margin-bottom: 0;
}

.ts3-card-label {
    color: #94a3b8;
}

.ts3-card-val {
    color: #ffffff;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

/* Custom Context Menu */
.ts3-context-menu {
    position: fixed;
    background: #0c1830;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(56, 189, 248, 0.2);
    z-index: 99999;
    display: none;
    min-width: 220px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    animation: menuFadeIn 0.15s ease-out;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.ts3-menu-header {
    padding: 0.75rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    font-size: 0.82rem;
    font-weight: 800;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts3-menu-item {
    padding: 0.65rem 1.1rem;
    font-size: 0.86rem;
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: all 0.15s;
    font-weight: 600;
}

.ts3-menu-item:hover {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    padding-left: 1.35rem;
}

.ts3-menu-item.danger {
    color: #f87171;
}

.ts3-menu-item.danger:hover {
    background: rgba(220, 38, 38, 0.25);
    color: #fca5a5;
}

.ts3-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.3rem 0;
}

/* Mobile & Tablet Responsiveness for Live Tree & Panel */
@media (max-width: 768px) {
    .ts3-tree-wrapper {
        padding: 1rem 0.8rem;
        border-radius: 16px;
    }

    .ts3-channel-row {
        padding: 0.55rem 0.75rem;
    }

    .ts3-channel-left {
        font-size: 0.86rem;
        gap: 0.5rem;
    }

    .ts3-client-row {
        padding: 0.5rem 0.65rem;
        margin-left: 1rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .ts3-client-badges {
        gap: 0.3rem;
    }

    .ts3-badge {
        font-size: 0.68rem;
        padding: 0.15rem 0.45rem;
    }

    .ts3-client-card {
        display: none !important; /* Touch devices use modal / tap menu instead of hover */
    }

    .ts3-context-menu {
        position: fixed !important;
        left: 50% !important;
        bottom: 1.5rem !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
        max-width: 320px !important;
        border-radius: 16px !important;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 25px rgba(56, 189, 248, 0.3) !important;
    }
}

