/* Основные стили */
body { 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale; 
}

/* Sidebar анимации */
.sidebar { 
    transition: transform 0.3s ease-in-out; 
}

.content { 
    transition: margin-left 0.3s ease-in-out; 
}

/* Toast уведомления */
.toast {
    position: fixed; 
    bottom: 20px; 
    left: 50%; 
    transform: translateX(-50%);
    padding: 12px 24px; 
    border-radius: 8px; 
    color: white; 
    z-index: 1050;
    opacity: 0; 
    transition: opacity 0.3s, transform 0.3s;
    max-width: 90vw; 
    text-align: center;
    pointer-events: none;
}

.toast.show { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success { 
    background-color: #28a745; 
}

.toast.error { 
    background-color: #dc3545; 
}

/* Навигация */
.nav-link.active { 
    background-color: #334155; 
}

/* Модальные окна */
.modal-backdrop {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); 
    z-index: 1040;
    animation: fadeIn 0.2s ease-in-out;
}

.modal {
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    z-index: 1050;
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Screen reader only - для доступности */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Улучшение фокуса для клавиатурной навигации */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Мобильные устройства */
@media (max-width: 640px) {
    .user-select-btn {
        font-size: 0.875rem;
        padding: 0.625rem;
    }
    
    input[type="date"],
    input[type="number"],
    input[type="text"],
    select {
        font-size: 16px !important;
    }
}

/* Loading состояния */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== ИЗМЕНЕНИЯ ДЛЯ СТАТИСТИКИ ==================== */
/* Добавьте этот код в ваш существующий css/styles.css */

/* Контейнер модального окна статистики */
.stats-modal {
    max-width: 95vw;
    width: 95vw;
    margin: 0 auto;
}

/* Таблица статистики */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-table th {
    padding: 12px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
}

/* Кликабельные заголовки для сортировки */
.stats-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.stats-table th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Индикаторы сортировки */
.sort-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.7;
}

.stats-table th.sorted-asc .sort-indicator::after {
    content: '▲';
}

.stats-table th.sorted-desc .sort-indicator::after {
    content: '▼';
}

/* Сумма трафика в заголовке */
.column-total {
    display: block;
    font-size: 9px;
    margin-top: 2px;
    opacity: 0.9;
    font-weight: 500;
}

.stats-table th.active-sort {
    background-color: rgba(255, 255, 255, 0.15);
}

.stats-table td {
    padding: 10px 6px;
    text-align: center;
}

/* Ширина колонок */
.stats-table td:first-child,
.stats-table th:first-child {
    width: 35px;
    padding: 10px 4px;
    font-size: 11px;
}

.stats-table td:nth-child(2),
.stats-table th:nth-child(2) {
    text-align: left;
    padding-left: 8px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-table td:nth-child(3),
.stats-table td:nth-child(4),
.stats-table th:nth-child(3),
.stats-table th:nth-child(4) {
    width: 80px;
    font-size: 12px;
    font-weight: 500;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .stats-modal {
        max-width: 98vw;
        width: 98vw;
        padding: 10px;
    }

    .stats-table {
        font-size: 11px;
    }

    .stats-table th {
        padding: 10px 4px;
        font-size: 10px;
    }

    .stats-table td {
        padding: 8px 4px;
    }

    /* Узкие колонки для мобильных */
    .stats-table td:first-child,
    .stats-table th:first-child {
        width: 30px;
        padding: 8px 2px;
        font-size: 10px;
    }

    .stats-table td:nth-child(2),
    .stats-table th:nth-child(2) {
        max-width: 110px;
        padding-left: 6px;
        padding-right: 4px;
        font-size: 11px;
    }

    .stats-table td:nth-child(3),
    .stats-table td:nth-child(4),
    .stats-table th:nth-child(3),
    .stats-table th:nth-child(4) {
        width: 70px;
        font-size: 11px;
        padding: 8px 3px;
    }

    .column-total {
        font-size: 8px;
    }
}

@media (max-width: 480px) {
    .stats-table td:nth-child(2),
    .stats-table th:nth-child(2) {
        max-width: 100px;
    }

    .stats-table td:nth-child(3),
    .stats-table td:nth-child(4),
    .stats-table th:nth-child(3),
    .stats-table th:nth-child(4) {
        width: 65px;
        font-size: 10px;
    }
}


/* ✅ ДОБАВЛЕНО: Стили для кликабельных имен пользователей в таблице */
.user-stats-link {
    color: #3b82f6; /* Tailwind blue-500 */
    text-decoration: none;
    font-weight: 500;
}

.user-stats-link:hover {
    text-decoration: underline;
}

