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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #333;
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Шапка */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    z-index: 100;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.view-toggle {
    display: flex;
    background: #f0f2f5;
    border-radius: 6px;
    padding: 2px;
}

.btn-toggle {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-toggle.active {
    background: #fff;
    color: #2c3e50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-select {
    padding: 6px 10px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    min-width: 160px;
}

.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-primary {
    background: #2c3e50;
    color: #fff;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-secondary {
    background: #f0f2f5;
    color: #333;
}

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

.user-info {
    font-size: 13px;
    color: #666;
}

/* Панель проекта */
.project-panel {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
}

.project-panel.hidden {
    display: none;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-back {
    background: #f0f2f5;
    color: #333;
}

#project-title {
    font-size: 16px;
    font-weight: 600;
}

.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-completed {
    background: #cce5ff;
    color: #004085;
}

/* Основной контент */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Статистика */
.stats-panel {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    flex-shrink: 0;
}

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

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

.stat-value.warning {
    color: #e74c3c;
}

.stat-value.urgent {
    color: #f39c12;
}

/* Гант контейнер */
.gantt-container {
    flex: 1;
    overflow: hidden;
}

/* Легенда */
.legend {
    display: flex;
    gap: 20px;
    padding: 8px 20px;
    background: #fff;
    border-top: 1px solid #e1e4e8;
    font-size: 12px;
    flex-shrink: 0;
}

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

.legend-color {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-color.normal {
    background: #4a90e2;
}

.legend-color.urgent {
    background: #f39c12;
}

.legend-color.overdue {
    background: #e74c3c;
}

.legend-color.completed {
    background: #27ae60;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-content h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #666;
}

.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Кастомизация DHTMLX Gantt */
.gantt_task_line {
    border-radius: 3px;
}

.gantt_task_line.overdue {
    background: #e74c3c !important;
    border-color: #c0392b !important;
}

.gantt_task_line.urgent {
    background: #f39c12 !important;
    border-color: #d68910 !important;
}

.gantt_task_line.completed {
    background: #27ae60 !important;
    border-color: #1e8449 !important;
}

.gantt_task_line.normal {
    background: #4a90e2 !important;
    border-color: #357abd !important;
}

.gantt_grid_scale {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e4e8;
}

.gantt_grid_scale .gantt_grid_head_cell {
    color: #2c3e50;
    font-weight: 600;
}

.gantt_task_scale {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e4e8;
}

.gantt_row {
    border-bottom: 1px solid #f0f2f5;
}

.gantt_row:hover {
    background: #f8f9fa;
}

.gantt_tree_content {
    font-size: 13px;
}

.gantt_cell {
    font-size: 13px;
}

/* Лоадер */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f2f5;
    border-top-color: #2c3e50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .filters {
        flex-wrap: wrap;
    }
    
    .stats-panel {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Error panel */
.error-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #fff;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    margin: 20px;
    text-align: center;
}
.error-panel.hidden {
    display: none;
}
.error-panel h2 {
    color: #e74c3c;
    margin-bottom: 10px;
}
.error-panel p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}
.error-panel .btn {
    background: #e74c3c;
    color: #fff;
}
.error-panel .btn:hover {
    background: #c0392b;
}

/* Fallback mode banner */
.webhook-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 8px 15px;
    font-size: 12px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
}
.webhook-banner.hidden {
    display: none;
}
