/* =============================================================================
   common.css — общие стили для всех страниц
   Подключается ПЕРВЫМ, до страничных файлов (index.css, analytics.css и т.д.)

   Сюда попадают только те стили, которые нужны минимум на двух страницах:
   - Reset и базовая типографика (body, *).
   - Кнопки (.btn, .btn-primary, .btn-reset).
   - Статусные плашки (.status-indicator и её цветовые варианты) —
     используются JS для рендера таблиц на index и analytics.
   - Фильтры (.filter-select, .filter-input, .filter-label и т.д.) —
     базовое оформление; сайдбары на index/analytics переопределяют их
     своими правилами, повышая специфичность (.sidebar-filters .filter-*).
   - Навигационные ссылки (.nav-link) — базовое состояние.
   - Утилиты (.loading, .spinner, .no-data, .file-info) — в index/analytics
     рендерятся JS-ом, поэтому вынесены в общий файл.
   - Общий footer.

   Стили, специфичные для одной страницы, сюда НЕ попадают — они в
   своих файлах: index.css, analytics.css, admin.css, login.css.
   ============================================================================= */

/* =============================================================================
   Reset и базовая типографика
   ============================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* =============================================================================
   Кнопки — используются во всех страницах (index, analytics, admin)
   ============================================================================= */
.btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.btn-primary {
    background-color: #2c5aa0;
    color: white;
}

.btn-primary:hover {
    background-color: #1c3f76;
    transform: translateY(-1px);
}

.btn-reset {
    background-color: #dc3545;
    color: white;
}

.btn-reset:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

/* =============================================================================
   Фильтры — базовое оформление
   На index/analytics сайдбар переопределяет эти стили через
   .sidebar-filters .filter-* (темнее, компактнее). На admin используется
   базовое (светлое) оформление.
   ============================================================================= */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

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

.filter-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 3px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-label::before {
    content: "🔍";
    font-size: 10px;
}

.filter-select,
.filter-input {
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
    transition: border-color 0.2s;
    height: 32px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.date-filter-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 3px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-filter-label::before {
    content: "📅";
    font-size: 10px;
}

.clear-date-btn {
    margin-top: 3px;
    padding: 2px 5px;
    font-size: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.clear-date-btn:hover {
    background-color: #e9ecef;
}

/* =============================================================================
   Навигация — базовое состояние
   .nav-link используется во всех HTML (sidebar на index/analytics и
   горизонтальная навигация на admin).
   .nav-link-logout — общая для всех страниц стилизация кнопки «Выход».
   ============================================================================= */
.nav-link {
    display: inline-block;
    padding: 12px 22px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    transition: color 0.2s, border-color 0.2s;
}

.nav-link:hover {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.nav-link.active {
    color: #fff;
    border-bottom-color: #fff;
    font-weight: 600;
}

.nav-link-logout {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 12px !important;
}

.nav-link-logout:hover {
    color: #fff !important;
    border-bottom-color: rgba(255, 255, 255, 0.3) !important;
}

/* =============================================================================
   Статусы — плашки статуса проекта, рендерятся динамически JS-ом
   Используется в таблицах на index.html (app.js) и analytics.html (analytics.js).
   ============================================================================= */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-completed    { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-in-progress  { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.status-stopped      { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.status-not-required { background-color: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }

.plan-ok   { color: #28a745; font-weight: 600; }
.plan-late { color: #dc3545; font-weight: 600; }

.bool-true,
.bool-false {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.bool-true  { background-color: #28a745; color: white; }
.bool-false { background-color: #dc3545; color: white; }

/* =============================================================================
   Загрузка / нет данных — используются на index и admin
   ============================================================================= */
.loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: #2c5aa0;
    font-size: 14px;
    flex: 1;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading.active {
    display: flex;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #2c5aa0;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.no-data::before {
    content: "📭";
    font-size: 36px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* =============================================================================
   Футер — общий футер, может переопределяться страничными файлами
   ============================================================================= */
footer {
    text-align: center;
    padding: 10px 25px;
    color: #6c757d;
    font-size: 12px;
    border-top: 1px solid #eaeaea;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

/* =============================================================================
   Утилиты — общие мелочи
   ============================================================================= */
.file-info {
    font-size: 12px;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    padding: 5px 8px;
    border-radius: 4px;
    border-left: 3px solid #2c5aa0;
    min-width: 150px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================================
   Адаптивность — только для общих элементов (.btn, .file-info, .filters)
   Адаптивность специфичных элементов в своих страничных файлах.
   ============================================================================= */
@media (max-width: 992px) {
    .btn { padding: 7px 12px; font-size: 12px; }
    .file-info { font-size: 11px; min-width: 120px; }
}

@media (max-width: 1200px) {
    .filters { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .btn { width: 100%; justify-content: center; }
    .file-info { width: 100%; text-align: center; }
}

@media (max-height: 700px) {
    .filter-select,
    .filter-input { height: 28px; padding: 5px 7px; }
}
