/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Заголовок */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Секции */
section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

section h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Поиск */
.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.search-group {
    display: flex;
    flex-direction: column;
}

.search-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #4a5568;
}

.search-group input,
.search-group select {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-group input:focus,
.search-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

/* Табы */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: #f7fafc;
    color: #4a5568;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #edf2f7;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

/* Контент табов */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Таблицы */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background: #f7fafc;
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: center;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

.data-table .loading {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 40px;
}

/* Статусы */
.lid-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: normal;
    margin-left: 8px;
    font-family: 'Courier New', monospace;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    display: inline-block;
    min-width: 80px;
}

.status-responded {
    background: #c6f6d5;
    color: #22543d;
}

.status-pending {
    background: #fed7d7;
    color: #742a2a;
}

.status-reminder1 {
    background: #fef5e7;
    color: #744210;
}

.status-reminder2 {
    background: #fed7d7;
    color: #742a2a;
}

/* Обновление */
.update-section {
    text-align: center;
    padding: 20px;
}

.update-info {
    margin-left: 15px;
    color: #718096;
    font-size: 0.9rem;
}

/* Системная информация */
.system-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.system-section h2 {
    color: #4a5568;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.8rem;
}

.system-section h2 span {
    color: #10b981;
    font-weight: 600;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.system-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.system-card:hover {
    /* Убираем анимацию при наведении */
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.system-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e7ff;
}

.system-header i {
    font-size: 1.5rem;
    color: #667eea;
}

.system-header span {
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
}

/* Круговые диаграммы загрузки */
.usage-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 1rem auto;
}

.usage-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.usage-circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}

.usage-circle-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-in-out;
}

.usage-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: #374151;
}

.usage-circle-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Цвета для различных уровней загрузки */
.usage-low {
    stroke: #10b981; /* Зеленый */
}

.usage-medium {
    stroke: #f59e0b; /* Желтый */
}

.usage-high {
    stroke: #ef4444; /* Красный */
}

/* Прогресс-бары */
.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease-in-out, background-color 0.3s ease;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.progress-fill.medium {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.progress-fill.high {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* Макет системной карточки с визуалами */
.system-visual {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1rem;
}


/* Графики на всю ширину карточки */
.mini-chart {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mini-chart canvas {
    width: 100%;
    height: calc(100% - 30px);
    display: block;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
}

.chart-label {
    font-size: 0.85rem;
    color: #374151;
    margin-top: 8px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-label .chart-title {
    flex: 1;
}

.chart-label .current-value {
    color: #667eea;
    font-weight: 700;
    margin-left: 8px;
}

.chart-label .trend {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    margin-left: 6px;
}

.chart-label .trend.up {
    background: #ef4444;
}

.chart-label .trend.down {
    background: #10b981;
}

.chart-label .trend.stable {
    background: #6b7280;
}


.system-details {
    flex: 1;
}

.system-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    min-height: 1.5rem;
}

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

.system-item .label {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.5;
    padding-top: 0.1rem;
    flex-shrink: 0;
}

.system-item .value {
    color: #111827;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    text-align: right;
    max-width: 60%;
    word-wrap: break-word;
    padding-top: 0.1rem;
}


/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .search-form {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }

    /* Адаптивность для системной информации */
    .system-grid {
        grid-template-columns: 1fr;
    }
    
    .system-card {
        padding: 1rem;
    }
    
    .system-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .system-item .value {
        min-width: auto;
        width: 100%;
        text-align: left;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Утилиты */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.hidden { display: none; }
.visible { display: block; }

/* Кнопки процессов */
.process-tab-button {
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.process-tab-button:hover {
    background: #f8fafc;
    color: #374151;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.process-tab-button:active {
    transform: translateY(0);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.close {
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close:hover {
    color: white;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Список процессов */
.process-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-size: 1rem;
}

.process-loading i {
    margin-right: 8px;
    color: #667eea;
}

.process-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.process-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.process-item:hover {
    background: #e2e8f0;
    border-left-color: #667eea;
}

.process-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.process-pid {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.process-usage {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.process-info {
    flex-grow: 1;
}

/* PM2 секция */
.pm2-section {
    margin-top: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.pm2-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.pm2-header i {
    font-size: 0.8rem;
}

.pm2-refresh {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: auto;
    font-size: 0.75rem;
    transition: background 0.2s ease;
}

.pm2-refresh:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pm2-list {
    max-height: 200px;
    overflow-y: auto;
}

.pm2-loading {
    padding: 16px;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
}

.pm2-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8rem;
    transition: background 0.2s ease;
}

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

.pm2-item:hover {
    background: #e2e8f0;
}

.pm2-name {
    flex: 2;
    font-weight: 600;
    color: #374151;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    margin-right: 12px;
}

.pm2-stats {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.pm2-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 35px;
}

.pm2-stat-label {
    color: #6b7280;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 500;
}

.pm2-stat-value {
    color: #374151;
    font-weight: 600;
    margin-top: 1px;
}

.pm2-status {
    padding: 2px 4px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 45px;
    text-align: center;
    flex-shrink: 0;
}

.pm2-status.online {
    background: #d1fae5;
    color: #065f46;
}

.pm2-status.stopped {
    background: #fee2e2;
    color: #991b1b;
}

.pm2-status.errored {
    background: #fef3c7;
    color: #92400e;
}
