* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #404040;
    overflow: hidden;
}

.header {
    background: #333;
    color: #e0e0e0;
    padding: 12px 20px;
    text-align: center;
    border-bottom: 1px solid #404040;
}

.header h1 {
    font-size: 1.5em;
    margin-bottom: 3px;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(106, 76, 147, 0.3);
}

.header p {
    font-size: 0.9em;
    color: #aaa;
}

.content {
    padding: 15px;
}


.servers-section {
    margin-top: 20px;
}

/* Компактная таблица серверов */
.servers-table {
    width: 100%;
    border-collapse: collapse;
    background: #2d2d2d;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #404040;
}

.servers-table th {
    background: #333;
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.95em;
    font-weight: bold;
    border-bottom: 1px solid #404040;
}

.servers-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #404040;
    font-size: 0.9em;
    vertical-align: middle;
}

.servers-table tr:hover {
    background: #333;
}

.servers-table tr:last-child td {
    border-bottom: none;
}

/* Компактный URL */
.server-url {
    font-size: 0.25em;
    color: #999;
    word-break: break-all;
    max-width: 200px;
    font-family: 'Courier New', monospace;
}

/* Статус индикатор рядом с названием */
.server-name-with-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Статус индикатор */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active {
    background: #28a745;
}

.status-inactive {
    background: #dc3545;
}

/* Компактные прогресс-бары */
.progress-bar {
    display: inline-block;
    width: 40px;
    height: 6px;
    background: #404040;
    border-radius: 3px;
    overflow: hidden;
    margin-right: 4px;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.progress-cpu { background: #6a4c93; }
.progress-memory { background: #666; }
.progress-disk { background: #666; }

/* Основные цвета - серые тона */
.status-active {
    background: #28a745;
}

.status-inactive {
    background: #dc3545;
}

/* Фиолетовый акцентный цвет */
.btn-primary {
    background: #6a4c93;
    color: #fff;
}

.btn-primary:hover {
    background: #5a3d83;
}

.compact-btn-limit {
    background: #6a4c93;
    color: #fff;
}

.compact-btn-limit:hover {
    background: #5a3d83;
}

.modal-refresh-btn {
    background: #6a4c93;
    color: #fff;
}

.modal-refresh-btn:hover {
    background: #5a3d83;
}

.server-name-edit:focus {
    border-color: #6a4c93;
    box-shadow: 0 0 5px rgba(106, 76, 147, 0.3);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #6a4c93;
    box-shadow: 0 0 5px rgba(106, 76, 147, 0.3);
}

.mini-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #404040;
    border-radius: 50%;
    border-top-color: #6a4c93;
    animation: spin 1s ease-in-out infinite;
}

/* Компактные кнопки */
.compact-btn {
    padding: 4px 8px;
    font-size: 0.8em;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 4px;
}

.compact-btn-limit {
    background: #6a4c93;
    color: #fff;
}

.compact-btn-restart {
    background: #6a4c93;
    color: #fff;
}

.compact-btn-zero {
    background: #6c757d;
    color: #fff;
    font-weight: bold;
}

.compact-btn-zero:hover {
    background: #5a6268;
}

.compact-btn-console {
    background: #17a2b8;
    color: #fff;
}

.compact-btn-console:hover {
    background: #138496;
}

.compact-btn-logs {
    background: #6a4c93;
    color: #fff;
}

.compact-btn-delete {
    background: #dc3545;
    color: #fff;
}

.compact-btn-delete:hover {
    background: #c82333;
}

.compact-btn:hover {
    opacity: 0.8;
}

/* Компактный input */
.compact-input {
    width: 45px;
    padding: 4px 6px;
    font-size: 0.8em;
    border: 1px solid #555;
    border-radius: 3px;
    background: #333;
    color: #fff;
    text-align: center;
}

/* Поле редактирования названия сервера */
.server-name-edit {
    padding: 2px 6px;
    font-size: 1.1em;
    font-weight: bold;
    border: 1px solid #6a4c93;
    border-radius: 3px;
    background: #333;
    color: #fff;
    outline: none;
    min-width: 100px;
}

/* Поле редактирования URL сервера */
.server-url-edit {
    padding: 2px 6px;
    font-size: 0.75em;
    border: 1px solid #6a4c93;
    border-radius: 3px;
    background: #333;
    color: #fff;
    outline: none;
    min-width: 150px;
    max-width: 200px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.server-url-edit:focus {
    border-color: #6a4c93;
    box-shadow: 0 0 5px rgba(106, 76, 147, 0.3);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .servers-table {
        font-size: 0.8em;
    }
    
    .servers-table th,
    .servers-table td {
        padding: 6px 8px;
    }
    
    .compact-btn {
        padding: 3px 6px;
        font-size: 0.75em;
    }
    
    .compact-input {
        width: 35px;
        font-size: 0.75em;
    }
}

/* Заголовок секции с кнопками */
.section-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid #404040 !important;
    padding-bottom: 6px !important;
}

/* Акценты в тексте */
.server-name {
    color: #fff !important;
    font-weight: bold !important;
}

.stat-compact-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #6a4c93 !important;
}

.section-title {
    font-size: 1.2em !important;
    color: #fff !important;
    margin: 0 !important;
    font-weight: bold !important;
}

.section-buttons {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
}

/* Фильтр серверов */
.filter-container {
    display: flex;
    align-items: center;
}

.filter-select {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 0.8em;
    min-width: 100px;
    height: 24px;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #6a4c93;
    box-shadow: 0 0 5px rgba(106, 76, 147, 0.3);
}

.filter-select option {
    background: #333;
    color: #fff;
}

.stats-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #333;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 8px 15px;
    margin-left: 10px;
    flex: 1;
}

.day-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.day-label {
    font-size: 0.75em;
    color: #ccc;
    font-weight: bold;
    min-width: 50px;
}

.stat-compact-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-compact-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #6a4c93 !important;
}

.stat-compact-label {
    font-size: 0.8em;
    color: #aaa;
}

.server-card {
    background: #333;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}

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

.server-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
}

.server-status {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
}

.status-active {
    background: #2d5a2d;
    color: #6a4c93 !important;
}

.status-inactive {
    background: #5a2d2d;
    color: #999;
}

.server-info {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}

.info-item {
    background: #2a2a2a;
    padding: 6px 8px;
    border-radius: 3px;
    border: 1px solid #404040;
}

.info-label {
    font-size: 0.7em;
    color: #aaa;
    margin-bottom: 2px;
}

.info-value {
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
}

.task-limit {
    background: #2a2a2a;
    padding: 8px;
    border-radius: 3px;
    margin-top: 8px;
    border: 1px solid #404040;
}

.limit-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.limit-input {
    width: 50px;
    padding: 4px;
    border: 1px solid #555;
    border-radius: 3px;
    text-align: center;
    background: #333;
    color: #fff;
    font-size: 0.8em;
}

.limit-btn {
    background: #6a4c93;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

.limit-btn:hover {
    background: #5a3d83;
}

.delete-btn {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    margin-left: 6px;
}

.delete-btn:hover {
    background: #c82333;
}

.logs-btn {
    background: #6a4c93;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

.logs-btn:hover {
    background: #5a3d83;
}

/* Модальное окно для логов */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #2d2d2d !important;
    margin: 2% auto !important;
    padding: 20px !important;
    border: 1px solid #404040 !important;
    border-radius: 8px !important;
    width: 98% !important;
    max-width: 1400px !important;
    max-height: 95vh !important;
    overflow-y: auto !important;
}

/* Переопределение для модального окна консоли */
.console-modal .modal-content.console-modal-content {
    overflow: hidden !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #404040;
    padding-bottom: 10px;
}

.modal-title {
    color: #fff;
    font-size: 1.2em;
    font-weight: bold;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

.logs-content {
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e0e0e0;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.logs-loading {
    text-align: center;
    color: #aaa;
    padding: 20px;
}

.logs-error {
    color: #999;
    background: #2d1a1a;
    border: 1px solid #5a2d2d;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.modal-refresh-btn {
    background: #6a4c93;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
}

.modal-refresh-btn:hover {
    background: #5a3d83;
}

.modal-refresh-btn:disabled {
    background: #666;
    cursor: not-allowed;
}

.refresh-btn {
    background: #6c757d;
    color: #fff;
    border: 1px solid #6c757d;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    min-width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background: #5a6268;
}

.create-server-btn {
    background: #6a4c93;
    color: #fff;
    border: 1px solid #6a4c93;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    min-width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-server-btn:hover {
    background: #5a3d83;
}

.dispatch-queued-btn {
    background: #0d6efd;
    color: #fff;
    border: 1px solid #0d6efd;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    white-space: nowrap;
}

.dispatch-queued-btn:hover:not(:disabled) {
    background: #0b5ed7;
}

.dispatch-queued-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error {
    background: #5a2d2d;
    color: #999;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #7a3d3d;
}

.loading {
    text-align: center;
    padding: 30px;
    color: #aaa;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    border: 3px solid #333;
    border-top: 3px solid #4a9eff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.loading-indicator {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(45, 45, 45, 0.95);
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 10px 15px;
    color: #e0e0e0;
    font-size: 0.9em;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.loading-indicator.show {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-spinner {
    border: 2px solid #333;
    border-top: 2px solid #4a9eff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

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

.modal-content {
    background-color: #2d2d2d;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #404040;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    color: #e0e0e0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #404040;
    padding-bottom: 10px;
}

.modal-title {
    font-size: 1.3em;
    color: #fff;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: #e0e0e0;
    font-weight: bold;
}

.form-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-size: 1em;
}

.form-input:focus {
    outline: none;
    border-color: #4a9eff;
}


.form-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-size: 1em;
}

.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.btn-primary {
    background: #6a4c93;
    color: #fff;
}

.btn-primary:hover {
    background: #5a3d83;
}

.btn-secondary {
    background: #666;
    color: #fff;
}

.btn-secondary:hover {
    background: #777;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 4px;
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .header p {
        font-size: 0.8em;
    }
    
    .content {
        padding: 10px;
    }
    
    
    .server-info {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 4px;
    }
    
    .info-item {
        padding: 4px 6px;
    }
    
    .info-label {
        font-size: 0.65em;
    }
    
    .info-value {
        font-size: 0.85em;
    }
    
    .stats-compact {
        padding: 6px 12px;
        margin-left: 8px;
    }
    
    .day-stats {
        gap: 15px;
    }
    
    .day-label {
        font-size: 0.7em;
        min-width: 45px;
    }
    
    .stat-compact-value {
        font-size: 1em;
    }
    
    .stat-compact-label {
        font-size: 0.75em;
    }
    
    .limit-controls {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .limit-input {
        width: 45px;
        padding: 3px;
    }
    
    .limit-btn, .delete-btn {
        padding: 3px 6px;
        font-size: 0.75em;
    }
    
    .loading-indicator {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 0.8em;
    }
    
    .mini-spinner {
        width: 14px;
        height: 14px;
    }
    
    .console-modal-content {
        max-width: 98% !important;
        width: 98% !important;
    }
    
    .console-url-input {
        min-width: 200px;
    }
    
    .console-iframe-container {
        min-height: 300px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .header p {
        font-size: 0.75em;
    }
    
    
    .server-info {
        grid-template-columns: 2fr 1fr 1fr;
    }
    
    .limit-controls {
        justify-content: space-between;
    }
    
    .stats-compact {
        padding: 4px 8px;
        margin-left: 6px;
    }
    
    .day-stats {
        gap: 10px;
    }
    
    .day-label {
        font-size: 0.65em;
        min-width: 40px;
    }
    
    .stat-compact-value {
        font-size: 0.9em;
    }
    
    .stat-compact-label {
        font-size: 0.7em;
    }
    
    .loading-indicator {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
        font-size: 0.75em;
    }
    
    .mini-spinner {
        width: 12px;
        height: 12px;
    }
    
    .console-iframe-container {
        min-height: 250px;
        margin: 0;
    }
    
    .console-modal-content {
        height: 90vh !important;
        max-height: 90vh !important;
    }
}

/* Модальное окно консоли */
.console-modal-content {
    max-width: 95% !important;
    width: 95% !important;
    height: 95vh !important;
    max-height: 95vh !important;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
}

.console-modal .modal-header {
    flex-shrink: 0;
    padding: 15px 20px;
    margin: 0;
}

.console-controls {
    flex-shrink: 0;
    padding: 15px 20px;
    border-bottom: 1px solid #404040;
    background: #333;
}

.console-url-group {
    margin-bottom: 0;
}

.console-url-input {
    flex: 1;
    min-width: 300px;
}

.console-iframe-container {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    background: #1a1a1a;
    border: none;
    border-radius: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

#consoleIframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}