:root {
    --bg: #050505;
    --bg-light: #0a0a0a;
    --accent: #ff2a2a;
    --accent-glow: rgba(255, 42, 42, 0.4);
    --text: #e2e2e7;
    --text-dim: #888;
    --card-bg: #0d0d0f;
    --border: #1a1a1d;
    --shadow: 0 8px 30px rgba(0,0,0,0.5);
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background-image: radial-gradient(circle at 30% 40%, rgba(255, 42, 42, 0.03) 0%, transparent 40%),
                      repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 10px);
}

header {
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.logo {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--accent);
    transition: text-shadow 0.3s ease;
}
.logo:hover {
    text-shadow: 0 0 20px var(--accent);
}
.logo span {
    color: var(--accent);
    position: relative;
}
.logo span::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 0 20px 40px 20px;
    box-sizing: border-box;
}

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    border-top: 1px solid var(--border);
    padding-top: 40px;
}

.stats-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #555;
}
.stats-text span {
    color: var(--text);
    margin: 0 5px;
}
.stats-text b {
    color: var(--accent);
}

.count-group {
    display: flex;
    align-items: center;
    gap: 30px;
}
.count-val {
    font-size: 56px;
    font-weight: 900;
    color: var(--accent);
    line-height: 0.8;
    text-shadow: 0 0 15px var(--accent);
}

.btn-load {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    border-radius: 4px;
}
.btn-load:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    backdrop-filter: blur(2px);
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(255,42,42,0.2);
}
.card.offline {
    opacity: 0.4;
    filter: grayscale(0.5);
}
.card.offline:hover {
    opacity: 0.6;
}

.node-id {
    font-weight: 700;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.node-ip {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 12px;
}

.pulse {
    width: 6px;
    height: 6px;
    background: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 10px #2ecc71;
    animation: pulse-green 2s infinite;
    display: inline-block;
    margin-right: 8px;
}
@keyframes pulse-green {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.pulse-off {
    width: 6px;
    height: 6px;
    background: #ff4444;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff4444;
    display: inline-block;
    margin-right: 8px;
    animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    justify-content: center !important;
    align-items: center !important;
    animation: fadeIn 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #0f0f12;
    border: 1px solid var(--accent);
    padding: 30px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255,42,42,0.2);
    border-radius: 16px;
    animation: slideUp 0.4s ease;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 !important;
}

#modal {
display: none;
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100vw !important;
height: 100vh !important;
background: rgba(0,0,0,0.8);
backdrop-filter: blur(10px);
z-index: 10000;
justify-content: center !important;
align-items: center !important;
margin: 0 !important;
padding: 0 !important;
}

#modal .modal-content {
background: #0f0f12;
border: 1px solid var(--accent);
padding: 30px;
width: 90%;
max-width: 450px;
text-align: center;
box-shadow: 0 0 50px rgba(255,42,42,0.2);
border-radius: 16px;
max-height: 90vh;
overflow-y: auto;
margin: 0 !important;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h3 {
    color: #fff;
    letter-spacing: 2px;
    margin-top: 0;
}

input, select, textarea {
    width: 100%;
    background: #000;
    border: 1px solid #222;
    padding: 12px;
    color: #fff;
    margin: 15px 0;
    box-sizing: border-box;
    outline: none;
    border-radius: 8px;
    transition: border 0.3s ease;
}
input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.btn-send {
    background: var(--accent);
    border: none;
    color: white;
    padding: 12px 30px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.btn-send:hover {
    background: #ff4d4d;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99999;
}
.toast {
    background: rgba(15, 15, 18, 0.95);
    border-left: 4px solid var(--accent);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-width: 250px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards,
               fadeOut 0.5s ease forwards 4.5s;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%) translateY(20px); }
    to { opacity: 1; transform: translateX(0) translateY(0); }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-20px); }
}

#auth-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000;
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(20px);
    transition: opacity 0.3s ease;
}

.auth-card {
    width: 320px;
    padding: 40px;
    background: #0a0a0c;
    border: 1px solid #1a1a1c;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 16px;
    animation: floatIn 0.5s ease;
}
@keyframes floatIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.auth-logo {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 24px;
    letter-spacing: 5px;
    color: #fff;
    margin-bottom: 5px;
}
.auth-logo span { color: var(--accent); }

.auth-status {
    font-size: 10px;
    color: #444;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

#auth-input {
    width: 100%;
    background: #000;
    border: 1px solid #222;
    padding: 15px;
    color: var(--accent);
    font-family: monospace;
    text-align: center;
    margin-bottom: 20px;
    outline: none;
    transition: 0.3s;
    border-radius: 8px;
}
#auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 42, 42, 0.1);
}

#auth-btn {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 2px;
    transition: 0.3s;
    border-radius: 8px;
}
#auth-btn:hover {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 20px var(--accent-glow);
}

#auth-error {
    color: #ff4444;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
    margin-top: 15px;
    display: none;
}

/* Поиск */
.search-bar {
    width: 100%;
    margin: 10px 0 20px 0;
    display: block;
}
#nodeSearch {
    width: 100%;
    box-sizing: border-box;
    background: #050505;
    border: 1px solid #111;
    padding: 12px 15px;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    outline: none;
    border-radius: 30px;
    transition: all 0.3s ease;
}
#nodeSearch:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 42, 42, 0.1);
}
#nodeSearch::placeholder {
    color: #333;
}

.tg-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #222;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #888;
    text-decoration: none;
    font-size: 10px;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    transition: 0.3s;
    z-index: 1000;
    border-radius: 30px;
}
.tg-float:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 15px rgba(255, 42, 42, 0.2);
}

.node-settings-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.node-settings-btn:hover {
    color: var(--accent);
    transform: rotate(45deg);
}
.node-settings-btn svg {
    width: 16px;
    height: 16px;
}

.node-details-box {
    background: #0a0a0a;
    padding: 12px;
    border: 1px solid #151515;
    border-radius: 8px;
    font-size: 12px;
    color: #aaa;
    line-height: 1.6;
    text-align: left;
    font-family: monospace;
}

.modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0d0d0d;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.modal-row input {
    flex: 1;
    margin-right: 8px;
    margin-bottom: 0;
    height: 38px;
    padding: 0 12px;
    line-height: 38px;
    box-sizing: border-box;
}

.button-group-compact {
    display: flex;
    gap: 0;
}
.btn-load-cst {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0 15px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    height: 38px;
    line-height: 38px;
    margin: 0 !important;
    box-sizing: border-box;
}
.button-group-compact .btn-load-cst:first-child {
    border-radius: 20px 0 0 20px;
    border-right: none;
}
.button-group-compact .btn-load-cst:last-child {
    border-radius: 0 20px 20px 0;
}
.btn-load-cst:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 15px rgba(255,42,42,0.3);
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 10px;
    color: var(--accent);
    font-weight: bold;
    user-select: none;
}
.checkbox-container input {
    display: none;
}
.checkmark {
    height: 14px;
    width: 14px;
    background-color: #111;
    border: 1px solid var(--accent);
    margin-right: 8px;
    display: inline-block;
    position: relative;
    border-radius: 3px;
}
.checkbox-container input:checked ~ .checkmark:after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid var(--accent);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.load-status-icon {
    transition: color 0.3s ease;
}

#proxyModal .modal-content {
    max-width: 500px;
}
#proxyContent {
    background: #0a0a0a;
    padding: 15px;
    border: 1px solid #222;
    border-radius: 8px;
    font-family: monospace;
    word-break: break-all;
    margin-bottom: 20px;
    color: #0f0;
    max-height: 200px;
    overflow-y: auto;
}

.task-item {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border 0.2s ease;
}
.task-item:hover {
    border-color: var(--accent);
}
.task-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    flex: 1;
}
.task-type {
    color: var(--accent);
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.task-url {
    color: #888;
    font-size: 11px;
    word-break: break-all;
    font-family: var(--font-mono);
}
.task-actions {
    display: flex;
    gap: 10px;
    margin-left: 15px;
}
.btn-del {
    color: #666;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
}
.btn-del:hover {
    color: var(--accent);
    text-decoration: underline;
}


#statsModal .modal-content.glass {
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 42, 42, 0.3);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,42,42,0.2), 0 0 30px rgba(255,42,42,0.2);
    padding: 30px;
}

#statsModal .stats-column {
    animation: fadeSlideUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}
#statsModal .stats-column:first-child { animation-delay: 0.1s; }
#statsModal .stats-column:last-child { animation-delay: 0.2s; }

@keyframes fadeSlideUp {
    to { opacity: 1; transform: translateY(0); }
}

.stats-column-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #aaa;
    border-left: 3px solid var(--accent);
    padding-left: 15px;
}
.stats-column-header i {
    stroke-width: 1.5px;
}

.stats-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #222;
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}
.stat-card:hover::before {
    transform: translateX(100%);
}
.stat-card:hover {
    border-color: var(--accent);
    box-shadow: 0 5px 20px rgba(255,42,42,0.2);
    transform: translateY(-5px);
}

.stat-card.online {
    border-color: rgba(46, 204, 113, 0.3);
}
.stat-card.online:hover {
    border-color: #2ecc71;
    box-shadow: 0 5px 20px rgba(46,204,113,0.2);
}

.stat-card.new {
    border-color: rgba(255, 187, 0, 0.3);
}
.stat-card.new:hover {
    border-color: #ffbb00;
    box-shadow: 0 5px 20px rgba(255,187,0,0.2);
}

.stat-icon {
    margin-bottom: 10px;
    color: #555;
    transition: color 0.3s ease;
}
.stat-card:hover .stat-icon {
    color: var(--accent);
}
.stat-card.online:hover .stat-icon { color: #2ecc71; }
.stat-card.new:hover .stat-icon { color: #ffbb00; }

.stat-icon i {
    width: 24px;
    height: 24px;
}

.stat-label {
    font-size: 10px;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 28px;
    font-weight: 900;
    font-family: var(--font-mono);
    line-height: 1.2;
}
.stat-card.online .stat-value { color: #2ecc71; text-shadow: 0 0 10px rgba(46,204,113,0.5); }
.stat-card.new .stat-value { color: #ffbb00; text-shadow: 0 0 10px rgba(255,187,0,0.5); }

.stat-percent {
    font-size: 11px;
    color: #aaa;
    margin-top: 5px;
}

.chart-container {
    background: rgba(0,0,0,0.3);
    border: 1px solid #222;
    border-radius: 16px;
    padding: 20px;
    transition: border 0.3s ease;
}
.chart-container:hover {
    border-color: var(--accent);
}

/* ===== Модальное окно настроек Telegram ===== */
#settingsModal .modal-content {
    max-width: 500px;
    text-align: left;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid #222;
    padding-bottom: 15px;
}
.settings-header i {
    color: var(--accent);
    width: 24px;
    height: 24px;
}
.settings-header h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 2px;
}

.settings-field {
    display: flex;
    align-items: center;
    background: #000;
    border: 1px solid #222;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: border 0.3s ease;
}
.settings-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}
.settings-field i {
    width: 40px;
    text-align: center;
    color: #666;
}
.settings-field input {
    flex: 1;
    background: transparent;
    border: none;
    margin: 0;
    padding: 12px 12px 12px 0;
}
.settings-field input:focus {
    box-shadow: none;
}

.settings-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    cursor: pointer;
    transition: border 0.3s ease;
}
.settings-checkbox:hover {
    border-color: var(--accent);
}
.settings-checkbox .checkbox-container {
    margin: 0;
}
.settings-checkbox span {
    font-size: 12px;
    color: #aaa;
}

.watched-section {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}
.watched-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.watched-header span {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.watched-header button {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.watched-header button:hover {
    background: var(--accent);
    color: #000;
}

#watchedBotsList {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.watched-bot-item {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #000;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 4px;
}
.watched-bot-item input {
    flex: 1;
    background: transparent;
    border: none;
    margin: 0;
    padding: 10px;
    height: auto;
}
.watched-bot-item input:focus {
    box-shadow: none;
}
.watched-bot-item button {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s;
}
.watched-bot-item button:hover {
    color: var(--accent);
    background: rgba(255,42,42,0.1);
}

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.settings-actions button {
    flex: 1;
}

/* Пагинация */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}
.pagination-info {
    font-size: 12px;
    color: #666;
    font-family: var(--font-mono);
}
.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pagination-controls select {
    background: #050505;
    border: 1px solid #222;
    color: #eee;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    font-size: 12px;
    cursor: pointer;
}
.pagination-controls select:focus {
    border-color: var(--accent);
}
.btn-pag {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}
.btn-pag:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(255,42,42,0.1);
}
.btn-pag:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.page-display {
    font-size: 12px;
    color: #eee;
    margin: 0 5px;
    min-width: 40px;
    text-align: center;
}