/* C³ CELERITY - Modern Dark UI
 * by Click Connect
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Colors - Deep dark theme */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    --bg-hover: #27272a;
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --warning-bg: rgba(234, 179, 8, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    
    --border: #27272a;
    --border-light: #3f3f46;
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    
    --transition: 0.15s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px var(--accent-glow));
    animation: pulse 3s infinite;
}

.logo-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.7;
    font-weight: 400;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-menu li {
    margin-bottom: 4px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    transition: height 0.3s ease;
}

.nav-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-menu a:hover::before {
    height: 60%;
}

.nav-menu a.active {
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-menu a.active::before {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-weight: 500;
}

.logout-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Content */
.content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: var(--bg-primary);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.topbar h1 {
    font-size: 20px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.main-content {
    padding: 32px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #a855f7 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-icon {
    font-size: 24px;
}

.stat-trend {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 20px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, transparent 100%);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
}

.card-body.no-padding {
    padding: 0;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.table th.sortable {
    user-select: none;
    transition: all 0.2s ease;
}

.table th.sortable:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
    transform: scale(1.005);
}

.table code {
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border: none;
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: black; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
    transform: scale(1.1);
}

.btn-icon:hover::after {
    opacity: 1;
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: all var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch:hover .toggle-slider {
    border-color: var(--border-light);
}

.toggle-switch:hover input:checked + .toggle-slider {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* Page Header with Sticky Filters */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.sticky-header {
    position: sticky;
    top: 73px;
    z-index: 40;
    background: var(--bg-primary);
    padding: 16px 0;
    margin: -16px 0 24px 0;
    border-bottom: 1px solid var(--border);
}

.page-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 280px;
    padding: 10px 14px 10px 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-box input:hover {
    border-color: var(--border-light);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: var(--bg-tertiary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-hint {
    position: absolute;
    right: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: inherit;
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

.results-count {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* Users Table */
.users-table-card {
    overflow: visible;
}

.table-wrapper {
    overflow-x: auto;
}

.user-row {
    transition: all var(--transition);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-id {
    font-weight: 600;
    color: var(--text-primary);
}

.user-name {
    font-size: 12px;
    color: var(--text-muted);
}

.plan-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-standart {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.plan-premium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.traffic-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.traffic-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.traffic-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.traffic-limit {
    color: var(--text-muted);
    font-size: 12px;
}

.traffic-unlimited {
    color: var(--success);
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Nodes Table */
.node-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.node-ip {
    font-size: 12px;
    color: var(--text-muted);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online .status-dot { 
    background: var(--success); 
    box-shadow: 0 0 12px var(--success), 0 0 20px rgba(34, 197, 94, 0.3);
}
.status-online { color: var(--success); font-weight: 500; }

.status-offline .status-dot { 
    background: var(--text-muted); 
}
.status-offline { color: var(--text-muted); }

.status-error .status-dot { 
    background: var(--danger); 
    box-shadow: 0 0 12px var(--danger);
}
.status-error { color: var(--danger); font-weight: 500; }

.status-syncing .status-dot { 
    background: var(--warning); 
    animation: pulse 1s infinite; 
    box-shadow: 0 0 12px var(--warning);
}
.status-syncing { color: var(--warning); font-weight: 500; }

.node-actions {
    display: flex;
    gap: 8px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    width: 100%;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.5s ease;
}

.quick-action:hover::before {
    left: 100%;
}

.quick-action:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateX(4px);
}

.quick-action:active {
    transform: translateX(2px) scale(0.98);
}

.qa-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* System Info */
.system-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sys-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.sys-item:last-child {
    border-bottom: none;
}

.sys-label {
    color: var(--text-muted);
    font-size: 13px;
}

.sys-value {
    font-weight: 500;
    font-size: 13px;
}

/* Logs */
.logs-container {
    max-height: 300px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: var(--bg-primary);
}

.log-line {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-line:hover {
    background: var(--bg-tertiary);
    white-space: normal;
    word-break: break-all;
}

.log-error { color: var(--danger); }
.log-warn { color: var(--warning); }
.log-success { color: var(--success); }

.logs-empty, .logs-loading, .logs-error {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: scale(1.05);
}

.page-btn:active {
    transform: scale(0.95);
}

.page-dots {
    color: var(--text-muted);
    padding: 0 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(150px) scale(0.9);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    backdrop-filter: blur(12px);
    min-width: 280px;
}

.toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.toast.error {
    border-color: var(--danger);
    background: linear-gradient(135deg, var(--danger-bg) 0%, rgba(239, 68, 68, 0.05) 100%);
    color: var(--danger);
}

.toast.success {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--success-bg) 0%, rgba(34, 197, 94, 0.05) 100%);
    color: var(--success);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--border-light);
}

.form-group small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.form-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #18181b 50%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: -250px;
    right: -250px;
    animation: float 20s infinite alternate;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.2) 0%, transparent 70%);
    bottom: -200px;
    left: -200px;
    animation: float 15s infinite alternate-reverse;
}

@keyframes float {
    to {
        transform: translate(50px, 50px) scale(1.1);
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo-icon {
    font-size: 48px;
    filter: drop-shadow(0 0 20px var(--accent-glow));
    display: inline-block;
    animation: pulse 2s infinite;
}

.login-header h1 {
    margin-top: 16px;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    margin-top: 8px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.badge-success { 
    background: var(--success-bg); 
    color: var(--success); 
    border-color: var(--success);
}

.badge-warning { 
    background: var(--warning-bg); 
    color: var(--warning); 
    border-color: var(--warning);
}

.badge-danger { 
    background: var(--danger-bg); 
    color: var(--danger); 
    border-color: var(--danger);
}

.badge-secondary { 
    background: var(--bg-tertiary); 
    color: var(--text-secondary); 
    border-color: var(--border);
}

.badge-lg { 
    padding: 7px 16px; 
    font-size: 12px; 
}

.badge:hover {
    transform: scale(1.05);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.detail-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.detail-item .value {
    font-size: 14px;
    font-weight: 500;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    margin: 28px 0 16px;
    color: var(--text-secondary);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* Nodes List */
.nodes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.node-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.node-name {
    font-weight: 600;
}

/* Actions List */
.actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Input readonly */
.input-readonly {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

/* Grid */
.row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.col { flex: 1; }
.col-4 { flex: 0 0 33.333%; }
.col-6 { flex: 0 0 calc(50% - 12px); }
.col-8 { flex: 0 0 calc(66.666% - 12px); }

/* Empty State */
.empty-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-cell {
    padding: 0 !important;
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.hint { font-size: 13px; color: var(--text-muted); }

/* Settings grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.settings-grid .form-group {
    margin-bottom: 0;
}
.settings-grid input[type="number"] {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: var(--success); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning); color: var(--warning); }

/* Groups */
.groups-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.checkbox-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.checkbox-tag:hover {
    background: var(--bg-hover);
}

.checkbox-tag input {
    display: none;
}

.checkbox-tag input:checked + .tag-dot + span {
    font-weight: 600;
}

.checkbox-tag input:checked ~ * {
    opacity: 1;
}

.checkbox-tag:has(input:checked) {
    background: var(--bg-elevated);
}

.tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.group-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
    transition: all 0.2s ease;
    cursor: default;
}

.group-tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.group-tag-sm {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 4px;
    transition: all 0.2s ease;
    cursor: default;
}

.group-tag-sm:hover {
    transform: scale(1.08);
}

.group-more {
    font-size: 11px;
    color: var(--text-muted);
}

.groups-list {
    margin-top: 8px;
}

/* Actions Grid (Node Management) */
.actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn .action-icon {
    font-size: 16px;
}

/* Mobile Header (hidden on desktop) */
.mobile-header {
    display: none;
}

.mobile-overlay {
    display: none;
}

/* Mobile Cards - скрыты по умолчанию (показываются только на мобилке) */
.mobile-nodes-list,
.mobile-users-list {
    display: none;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Скрываем desktop таблицы */
    .table-wrapper {
        display: none !important;
    }
    
    /* Показываем мобильные карточки */
    .mobile-nodes-list,
    .mobile-users-list {
        display: flex !important;
    }
    
    /* Mobile Header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        z-index: 200;
    }
    
    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .mobile-logo .logo-icon {
        font-size: 24px;
    }
    
    .mobile-logo .logo-text {
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 0.5px;
        background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .mobile-status {
        display: flex;
        align-items: center;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Overlay */
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 150;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Sidebar Mobile */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 200;
        transition: left 0.3s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    /* Content */
    .content {
        margin-left: 0;
        padding-top: 60px;
        width: 100%;
    }
    
    .topbar {
        position: relative;
        padding: 16px;
    }
    
    .topbar h1 {
        font-size: 18px;
    }
    
    .topbar-right .status-text {
        display: none;
    }
    
    .main-content {
        padding: 16px;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    /* Forms */
    .form-row,
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .row {
        flex-direction: column;
        gap: 16px;
    }
    
    .col-4, .col-6, .col-8 {
        flex: 1;
    }
    
    /* Page Header */
    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .page-header-left,
    .page-header-center,
    .page-header-right {
        width: 100%;
    }
    
    .filters-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box,
    .filter-select {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    /* Tables - скрываем на мобилках */
    .table-wrapper {
        display: none;
    }
    
    /* Mobile Cards - показываем только на мобилке */
    .mobile-nodes-list,
    .mobile-users-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .mobile-node-card,
    .mobile-user-card {
        background: var(--bg-tertiary);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 16px;
        transition: all 0.2s ease;
    }
    
    .mobile-node-card:active,
    .mobile-user-card:active {
        transform: scale(0.98);
        background: var(--bg-hover);
    }
    
    .mobile-node-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
        gap: 12px;
    }
    
    .mobile-node-title {
        flex: 1;
    }
    
    .mobile-node-title strong {
        font-size: 15px;
        display: block;
        margin-bottom: 4px;
    }
    
    .mobile-node-title code {
        font-size: 12px;
        color: var(--text-muted);
    }
    
    .mobile-node-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .mobile-stat-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .mobile-stat-label {
        font-size: 11px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mobile-stat-value {
        font-size: 14px;
        font-weight: 500;
    }
    
    .mobile-node-actions {
        display: flex;
        gap: 8px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }
    
    
    /* Logs Container Mobile */
    .logs-container {
        max-height: 200px;
        font-size: 11px;
    }
    
    .log-line {
        padding: 6px 12px;
        word-break: break-word;
        white-space: pre-wrap;
        font-size: 10px;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        padding: 10px 16px;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    /* Cards */
    .card {
        border-radius: 10px;
    }
    
    .card-header {
        padding: 16px;
        flex-wrap: wrap;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .dashboard-main,
    .dashboard-sidebar {
        width: 100%;
        margin-top: 0;
    }
    
    /* Nodes table scrollable */
    .nodes-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Quick Actions */
    .quick-action {
        padding: 16px;
        font-size: 15px;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }
    
    .page-btn {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }
    
    /* Forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Login Page */
    .login-container {
        padding: 16px;
    }
    
    .login-box {
        padding: 32px 24px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .action-buttons {
        gap: 6px;
    }
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.lang-btn {
    flex: 1;
    padding: 6px 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.lang-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.lang-btn.active {
    color: var(--text-primary);
    background: var(--accent);
}
