:root {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --button-bg: #008f95;
    --button-text: #ffffff;
    --notification-bg: rgba(0, 0, 0, 0.9);
    --accent-color: #008f95;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="light"] {
    --bg-color: #f5f5f5;
    --text-color: #1a1a1a;
    --button-bg: #efe02b;
    --button-text: #333333;
    --notification-bg: rgba(255, 255, 255, 0.95);
    --card-bg: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(0, 143, 149, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 143, 149, 0.05) 0%, transparent 50%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.6;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    visibility: visible;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-circle {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 143, 149, 0.3);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.loader-logo {
    width: 80px;
    height: auto;
}

.loader-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    opacity: 0.8;
}

.container {
    max-width: 450px;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.logo {
    width: 100px;
    height: auto;
    opacity: 0;
    animation: logo-fade-in 0.8s forwards 0.2s ease-out;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

@keyframes logo-fade-in {
    0% { opacity: 0; transform: translateY(-10px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.logo.loaded {
    animation: logo-pulse 3s infinite ease-in-out;
}

@keyframes logo-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(0, 143, 149, 0.3)); }
    50% { transform: scale(1.02); filter: drop-shadow(0 0 8px rgba(0, 143, 149, 0.5)); }
}

.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 19px;
    font-weight: 650;
    color: var(--text-color);
    margin: 0;
}

.status-overview {
    background: rgba(0, 143, 149, 0.05);
    border: 1px solid rgba(0, 143, 149, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.update-time {
    font-size: 13px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.update-dot {
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

.update-dot.updating {
    background: #f59e0b;
    animation: spin 1s linear infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.refresh-button {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
    min-width: 100px;
}

.refresh-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 143, 149, 0.3);
}

.refresh-button:active {
    transform: translateY(0);
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.refresh-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.refresh-button.updating .refresh-icon {
    animation: spin 1s linear infinite;
}

.servers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.server-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.server-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

.server-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.server-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.server-cpu {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.server-cpu.stale {
    opacity: 0.3;
}

.cpu-bar {
    flex: 1;
    height: 16px; /* Увеличиваем высоту с 3px до 16px */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    max-width: 80px;
    position: relative; /* Добавляем для позиционирования текста */
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpu-fill {
    position: absolute; /* Делаем заливку абсолютно позиционированной */
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #40ab68d6 0%, #40ab68d6 60%, #40ab68d6 100%);
    transition: width 0.4s ease;
    border-radius: 2px;
    z-index: 1; /* Помещаем заливку под текст */
}

.cpu-text {
    position: relative; /* Позиционируем текст поверх заливки */
    z-index: 2;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-color);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8); /* Добавляем тень для лучшей читаемости */
    pointer-events: none; /* Отключаем события мыши для текста */
    min-width: 15px;
    text-align: center;
}

.cpu-count {
    font-size: 9px;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.6;
    min-width: 30px;
    text-align: left;
}

.server-status {
    display: flex;
    align-items: center;
}

.status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
}

.status.online {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status.checking {
    background: rgba(234, 179, 8, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(234, 179, 8, 0.3);
    animation: checking-pulse 1.5s infinite;
}

@keyframes checking-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-color);
    opacity: 0.7;
    font-size: 13px;
}

.footer h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--text-color);
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #06b6d4;
}

.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--notification-bg);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.update-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 143, 149, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    z-index: 1000;
    transform: translateY(-100px);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.update-indicator.show {
    transform: translateY(0);
}

.debug-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.9);
    color: #00ff00;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 10px;
    max-width: 250px;
    z-index: 1001;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.debug-info.show {
    display: block;
}

@media (max-width: 480px) {
    body { padding: 15px; }
    .container { padding: 20px; max-width: 100%; }
    .header h1 { font-size: 18px; }
    .logo { width: 50px; }
    .server-item { padding: 10px 14px; }
    .server-name { font-size: 13px; }
    .cpu-bar { max-width: 60px; }
}

/* Анимации появления */
.server-item {
    animation: slideInUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(15px);
}

.server-item:nth-child(1) { animation-delay: 0.05s; }
.server-item:nth-child(2) { animation-delay: 0.1s; }
.server-item:nth-child(3) { animation-delay: 0.15s; }
.server-item:nth-child(4) { animation-delay: 0.2s; }
.server-item:nth-child(5) { animation-delay: 0.25s; }
.server-item:nth-child(6) { animation-delay: 0.3s; }
.server-item:nth-child(7) { animation-delay: 0.35s; }
.server-item:nth-child(8) { animation-delay: 0.4s; }
.server-item:nth-child(9) { animation-delay: 0.45s; }
.server-item:nth-child(10) { animation-delay: 0.5s; }
.server-item:nth-child(11) { animation-delay: 0.55s; }
.server-item:nth-child(12) { animation-delay: 0.6s; }
.server-item:nth-child(13) { animation-delay: 0.65s; }
.server-item:nth-child(14) { animation-delay: 0.7s; }
.server-item:nth-child(15) { animation-delay: 0.75s; }
.server-item:nth-child(16) { animation-delay: 0.8s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}