/* ============================================================================
   VRChat Multi-Account Dashboard — Cyber-Minimalism Design System
   ============================================================================
   Farben: Tiefschwarz + VRChat-Grün + Kühles Blau/Violett
   Stil: Glassmorphism-Karten, feine 1px Rahmen, Inter Font
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================================
   CSS Custom Properties (Design Tokens)
   ============================================================================ */
:root {
    --bg-primary: #0b0b0b;
    --bg-secondary: #111111;
    --bg-tertiary: #161616;
    --bg-card: rgba(20, 20, 20, 0.6);
    --bg-card-hover: rgba(30, 30, 30, 0.7);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-input-focus: rgba(255, 255, 255, 0.07);

    --accent-green: #2ecc71;
    --accent-green-dim: rgba(46, 204, 113, 0.15);
    --accent-blue: #6c5ce7;
    --accent-blue-dim: rgba(108, 92, 231, 0.15);
    --accent-violet: #a855f7;
    --accent-violet-dim: rgba(168, 85, 247, 0.12);

    --text-primary: #e8e8e8;
    --text-secondary: #888888;
    --text-tertiary: #555555;
    --text-accent: #b0b0b0;

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(108, 92, 231, 0.3);

    --status-join-me: #42caff;
    --status-active: #2ecc71;
    --status-ask-me: #e8a33d;
    --status-busy: #f44336;
    --status-offline: #444444;

    --sidebar-width: 240px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --shadow-glow-green: 0 0 20px rgba(46,204,113,0.15);
    --shadow-glow-blue: 0 0 20px rgba(108,92,231,0.15);

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   Reset & Base
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-violet); }

::selection { background: var(--accent-blue-dim); color: var(--text-primary); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ============================================================================
   Layout: App Shell
   ============================================================================ */
#app {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* ============================================================================
   Login Screen (Dashboard Auth)
   ============================================================================ */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.login-card {
    width: 380px;
    padding: 48px 40px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card .logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--shadow-glow-blue);
}

.login-card h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-card .error-msg {
    color: var(--status-busy);
    font-size: 12px;
    margin-bottom: 12px;
    min-height: 18px;
}

/* ============================================================================
   Sidebar
   ============================================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-glow-blue);
    flex-shrink: 0;
}

.sidebar-header .brand-text h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.sidebar-header .brand-text span {
    font-size: 11px;
    color: var(--text-tertiary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    user-select: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
    border-color: rgba(108,92,231,0.15);
}

.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.nav-item .badge {
    margin-left: auto;
    background: var(--accent-green-dim);
    color: var(--accent-green);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.sidebar-footer .nav-item { color: var(--text-tertiary); font-size: 12px; }

/* ============================================================================
   Main Content Area
   ============================================================================ */
.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg-primary);
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================================================
   Cards (Glassmorphism)
   ============================================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================================
   Account Cards
   ============================================================================ */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
}

.account-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.account-avatar.online { border-color: var(--accent-green); }

.account-info { flex: 1; min-width: 0; }

.account-info .name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-info .status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.join-me { background: var(--status-join-me); box-shadow: 0 0 6px var(--status-join-me); }
.status-dot.active { background: var(--status-active); box-shadow: 0 0 6px var(--status-active); }
.status-dot.ask-me { background: var(--status-ask-me); box-shadow: 0 0 6px var(--status-ask-me); }
.status-dot.busy { background: var(--status-busy); box-shadow: 0 0 6px var(--status-busy); }
.status-dot.offline { background: var(--status-offline); }

.status-text {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:hover { background: var(--bg-input-focus); border-color: var(--border-hover); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-glow-blue);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-success {
    background: var(--accent-green-dim);
    border-color: rgba(46,204,113,0.2);
    color: var(--accent-green);
}

.btn-danger {
    background: rgba(244,67,54,0.1);
    border-color: rgba(244,67,54,0.2);
    color: var(--status-busy);
}

.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; font-size: 16px; }

/* ============================================================================
   Inputs
   ============================================================================ */
.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: all var(--transition-fast);
    outline: none;
}

.input:focus {
    background: var(--bg-input-focus);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-dim);
}

.input::placeholder { color: var(--text-tertiary); }

.input-group { margin-bottom: 16px; }
.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 16px;
    height: 16px;
}

/* ============================================================================
   Stats Row
   ============================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 18px 20px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ============================================================================
   Friend List
   ============================================================================ */
.friend-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    cursor: default;
}

.friend-item:hover { background: rgba(255,255,255,0.03); }

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.friend-info { flex: 1; min-width: 0; }
.friend-info .name { font-size: 13px; font-weight: 500; }
.friend-info .meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.friend-status { display: flex; align-items: center; gap: 6px; }

/* ============================================================================
   Toggle Switch
   ============================================================================ */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle .slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 11px;
    transition: all var(--transition-normal);
}

.toggle .slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.toggle input:checked + .slider {
    background: var(--accent-green-dim);
    border-color: var(--accent-green);
}

.toggle input:checked + .slider::before {
    transform: translateX(18px);
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

/* ============================================================================
   Automation Log
   ============================================================================ */
.log-list {
    max-height: 400px;
    overflow-y: auto;
}

.log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.log-item .log-time {
    color: var(--text-tertiary);
    font-family: monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-item .log-action {
    color: var(--accent-green);
    font-weight: 500;
}

.log-item .log-details { color: var(--text-secondary); }

/* ============================================================================
   Modal
   ============================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal {
    width: 440px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 { font-size: 16px; font-weight: 600; }

.modal-body { padding: 24px; overflow-y: auto; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.close-btn:hover { color: var(--text-primary); }

/* ============================================================================
   Section Title
   ============================================================================ */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title h2 {
    font-size: 16px;
    font-weight: 600;
}

/* ============================================================================
   Automation Rule Card
   ============================================================================ */
.rule-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 8px;
}

.rule-info { flex: 1; }
.rule-info .rule-name { font-size: 13px; font-weight: 500; }
.rule-info .rule-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ============================================================================
   Whitelist
   ============================================================================ */
.whitelist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.whitelist-item .name { flex: 1; font-size: 13px; }

/* ============================================================================
   Empty State
   ============================================================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 13px; }

/* ============================================================================
   Loading / Pulse Animation
   ============================================================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading { animation: pulse 1.5s infinite; }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }

/* ============================================================================
   Responsive / Notification Toast
   ============================================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.3s ease;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--status-busy); }
.toast.info { border-left: 3px solid var(--accent-blue); }

/* ============================================================================
   Select dropdown
   ============================================================================ */
.select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.select:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-dim); }
.select option { background: var(--bg-secondary); color: var(--text-primary); }

/* ============================================================================
   Network Page — Mutual Friends Network
   ============================================================================ */

/* Mode Toggle Bar */
.network-mode-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: fit-content;
}

.network-mode-btn {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.network-mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.network-mode-btn.active {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow-blue);
}

/* Controls Bar */
.network-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.network-controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.network-controls-right {
    flex: 1;
    max-width: 320px;
}

.sharing-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sharing-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    user-select: none;
}

/* Search */
.network-search-wrap {
    position: relative;
}

.network-search-wrap .input {
    padding-left: 14px;
    padding-right: 14px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
}

.search-results:empty {
    display: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(108, 92, 231, 0.1);
}

.search-result-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.search-result-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Stats Row */
.network-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.network-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(12px);
}

.network-stat-value {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.network-stat-value.mutual {
    background: linear-gradient(135deg, var(--accent-green), #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.network-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Graph Container */
.network-graph-card {
    padding: 0 !important;
    overflow: hidden;
    position: relative;
}

.network-graph-container {
    width: 100%;
    height: 500px;
    background: radial-gradient(ellipse at center, rgba(20,20,30,1) 0%, var(--bg-primary) 100%);
    position: relative;
}

/* vis-network Canvas Styling */
.network-graph-container canvas {
    outline: none !important;
}

/* Legend */
.network-legend {
    display: flex;
    gap: 20px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Sharing Users List */
.sharing-users-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sharing-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.sharing-user-item:hover {
    background: rgba(255,255,255,0.03);
}

.sharing-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-blue-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sharing-user-info {
    flex: 1;
}

.sharing-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.sharing-user-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Resize Handle */
.network-resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 14px;
    cursor: ns-resize;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid var(--border);
    transition: background var(--transition-fast);
    user-select: none;
}

.network-resize-handle:hover {
    background: rgba(108, 92, 231, 0.1);
}

.network-resize-handle.active {
    background: rgba(108, 92, 231, 0.2);
}

.resize-grip {
    width: 40px;
    height: 4px;
    position: relative;
}

.resize-grip::before,
.resize-grip::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--text-tertiary);
    border-radius: 1px;
    transition: background var(--transition-fast);
}

.resize-grip::before {
    top: 0;
}

.resize-grip::after {
    bottom: 0;
}

.network-resize-handle:hover .resize-grip::before,
.network-resize-handle:hover .resize-grip::after {
    background: var(--accent-blue);
}

.network-resize-handle.active .resize-grip::before,
.network-resize-handle.active .resize-grip::after {
    background: var(--accent-violet);
}

/* ============================================================================
   Session Status Badges (Account Cards)
   ============================================================================ */

.session-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 6px;
    font-weight: 500;
    line-height: 1.4;
    transition: all var(--transition-normal);
}

.session-valid {
    background: rgba(46, 204, 113, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(46, 204, 113, 0.25);
}

.session-expired-badge {
    background: rgba(244, 67, 54, 0.12);
    color: #ff6b6b;
    border: 1px solid rgba(244, 67, 54, 0.3);
    animation: session-pulse 2s ease-in-out infinite;
}

@keyframes session-pulse {
    0%, 100% { border-color: rgba(244, 67, 54, 0.3); box-shadow: none; }
    50% { border-color: rgba(244, 67, 54, 0.6); box-shadow: 0 0 8px rgba(244, 67, 54, 0.15); }
}

.account-card.session-expired {
    border-color: rgba(244, 67, 54, 0.25) !important;
    box-shadow: 0 0 12px rgba(244, 67, 54, 0.08);
}

.relogin-link {
    color: #ff9800;
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
}

.relogin-link:hover {
    color: #ffb74d;
}

/* ============================================================================
   Groups Activity Panel
   ============================================================================ */

.groups-toolbar {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

/* --- Group Tile --- */
.group-tile {
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-normal);
    border: 1px solid var(--border);
    position: relative;
}

.group-tile:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-2px);
}

.group-tile-banner {
    height: 80px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    position: relative;
}

.group-tile-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--bg-card));
}

.group-tile-banner-empty {
    background: linear-gradient(135deg, var(--accent-blue-dim), var(--accent-violet-dim));
}

.group-tile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    position: relative;
    z-index: 1;
    margin-top: -24px;
}

.group-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--border);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.group-tile-icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.group-tile-info {
    flex: 1;
    min-width: 0;
}

.group-tile-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-tile-code {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: monospace;
}

.group-privacy-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.group-privacy-badge.public {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.group-privacy-badge.private {
    background: rgba(244, 67, 54, 0.12);
    color: #ff6b6b;
}

/* --- Stats Row --- */
.group-tile-stats {
    display: flex;
    gap: 0;
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--border);
}

.group-stat {
    flex: 1;
    text-align: center;
    padding: 6px 0;
}

.group-stat + .group-stat {
    border-left: 1px solid var(--border);
}

.group-stat-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.group-stat-online {
    color: var(--accent-green) !important;
}

.group-stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* --- Live Data Section --- */
.group-tile-live {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-tile-live.expanded {
    max-height: 1200px;
}

.group-live-loading {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.group-no-activity {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

.group-section {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}

.group-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.group-more {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 4px;
}

/* --- Instance Cards --- */
.group-instances-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.instance-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.instance-card:hover {
    background: var(--bg-input-focus);
}

.instance-thumb {
    width: 48px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.instance-info {
    flex: 1;
    min-width: 0;
}

.instance-world {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.instance-meta {
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.instance-players {
    color: var(--accent-green);
}

/* --- Event Cards --- */
.group-events-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-card {
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.event-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-status {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
    flex-shrink: 0;
}

.event-live {
    background: rgba(244, 67, 54, 0.15);
    color: #ff6b6b;
    animation: session-pulse 1.5s ease-in-out infinite;
}

.event-upcoming {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.event-soon {
    background: rgba(232, 163, 61, 0.15);
    color: var(--status-ask-me);
}

.event-past {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-tertiary);
}

.event-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.event-time {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* --- Post Cards --- */
.group-posts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.post-card {
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.post-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.post-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.post-image {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 6px;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* --- Announcement --- */
.group-announcement {
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-blue-dim), var(--accent-violet-dim));
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-accent);
}

.announcement-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.announcement-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.announcement-date {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .groups-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Visibility Toggle (Config Mode) --- */
.group-vis-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.group-vis-toggle:hover {
    transform: scale(1.15);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow-blue);
}

.group-vis-toggle.visible {
    border-color: var(--accent-green);
}

.group-vis-toggle.hidden {
    border-color: var(--status-busy);
}

.group-tile-hidden {
    opacity: 0.35;
    filter: grayscale(0.8);
}

.group-tile-hidden:hover {
    opacity: 0.6;
}

.groups-config-hint {
    font-size: 12px;
    color: var(--accent-blue);
    font-weight: 500;
    animation: config-hint-pulse 2s ease-in-out infinite;
}

@keyframes config-hint-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
