/**
 * Стили веб-панели управления парсером.
 * Тёмная тема, современный дизайн.
 */

/* ==================== Сброс и базовые стили ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Цветовая палитра */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-input: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #6c757d;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --border: #2a2a4a;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* ==================== Контейнер ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== Шапка ==================== */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.header .status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-running {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-paused {
    background-color: rgba(255, 193, 7, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.status-stopped {
    background-color: rgba(220, 53, 69, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* ==================== Карточки ==================== */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px var(--shadow);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

/* ==================== Кнопки ==================== */
.btn {
    display: inline-block;
    padding: 10px 25px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}

.btn-warning {
    background-color: var(--warning);
    color: #212529;
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-info {
    background-color: var(--info);
    color: #fff;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== Формы ==================== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
}

/* ==================== Прогресс-бар ==================== */
.progress-bar-container {
    background-color: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
    height: 25px;
    margin: 10px 0;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 10px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    min-width: 30px;
}

.progress-bar-text {
    padding: 0 10px;
    white-space: nowrap;
}

/* ==================== Таблица прогресса ==================== */
.progress-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.progress-table th,
.progress-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.progress-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.progress-table td {
    font-size: 0.95rem;
}

.progress-table tr:hover {
    background-color: rgba(233, 69, 96, 0.05);
}

/* ==================== Сетка кнопок управления ==================== */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* ==================== Авторизация ==================== */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
}

.auth-container .card {
    text-align: center;
}

.auth-container h2 {
    border: none;
    margin-bottom: 10px;
}

.auth-container p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.auth-container .form-group {
    text-align: left;
}

.auth-error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* ==================== Уведомления ==================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 12px var(--shadow);
    animation: slideIn 0.3s ease;
}

.notification-success {
    background-color: var(--success);
}

.notification-error {
    background-color: var(--danger);
}

.notification-info {
    background-color: var(--info);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== Мультиселект ==================== */
select[multiple] {
    min-height: 120px;
    padding: 5px;
}

select[multiple] option {
    padding: 8px 12px;
    border-radius: 4px;
    margin: 2px 0;
    cursor: pointer;
}

select[multiple] option:hover {
    background-color: var(--bg-card);
}

select[multiple] option:checked {
    background-color: var(--accent);
    color: #fff;
}

/* ==================== Список документов (файловый менеджер) ==================== */
.no-documents {
    color: var(--text-muted);
    text-align: center;
    padding: 30px;
    font-size: 0.95rem;
}

.documents-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(145deg, var(--bg-input) 0%, rgba(15, 52, 96, 0.5) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.document-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), #ff6b81);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.document-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.05) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.document-item:hover::before,
.document-item:hover::after {
    opacity: 1;
}

.document-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #e94560 0%, #ff6b81 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow:
        0 4px 15px rgba(233, 69, 96, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.document-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.document-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

.document-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-top: 8px;
}

.document-meta span {
    display: flex;
    align-items: center;
    gap: 2px;
}

.document-meta span:first-child::before {
    content: none;
    margin-right: 0;
}

.document-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.document-item:hover .document-actions {
    opacity: 1;
    transform: translateX(0);
}

.document-actions .btn {
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.document-actions .btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.document-actions .btn-info:hover {
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

@media (max-width: 768px) {
    .documents-list {
        grid-template-columns: 1fr;
    }
    
    .document-actions {
        opacity: 1;
        transform: translateX(0);
    }
    
    .document-item:hover {
        transform: translateY(-2px);
    }
}

/* ==================== Адаптивность ==================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .progress-table th,
    .progress-table td {
        padding: 8px 10px;
		font-size: 0.65rem;
    }
}
