:root {
    --primary-color: #1a237e;
    --primary-light: #534bae;
    --primary-dark: #000051;
    --secondary-color: #00b0ff;
    --success-color: #00c853;
    --warning-color: #ff9100;
    --danger-color: #ff1744;
    --light-color: #f5f7fa;
    --dark-color: #263238;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Боковая панель */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    background-color: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.sidebar-menu {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    padding: 0 20px;
    margin-bottom: 12px;
}

.menu-item {
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease;
    z-index: -1;
}

.menu-item:hover, .menu-item.active {
    color: white;
    border-left-color: var(--secondary-color);
}

.menu-item:hover::before, .menu-item.active::before {
    width: 100%;
}

.menu-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
}

.menu-badge {
    margin-left: auto;
    background-color: var(--secondary-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.user-info {
    flex-grow: 1;
    min-width: 0;
}

.user-info .fw-bold {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .small {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Основной контент - с width для предотвращения перекрытия */
.main-content {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
    max-width: calc(100% - 260px) !important;
    padding: 0 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
}

/* Когда sidebar скрыт (неавторизованные пользователи) */
.main-content:not(:has(+ .sidebar)) {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
}

/* Альтернативный способ - если sidebar не существует */
body:not(:has(.sidebar)) .main-content,
.main-content.no-sidebar {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Верхняя навигация */
.top-navbar {
    background-color: white !important;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    padding: 16px 24px !important;
    position: sticky !important;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid var(--gray-200);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-badge {
    position: relative;
}

.notification-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Карточки */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: white;
    margin-bottom: 24px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    padding: 18px 24px;
    border-radius: 12px 12px 0 0 !important;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.card-body {
    padding: 24px;
}

/* Таблицы */
.table-custom {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.table-custom thead {
    background-color: var(--gray-100);
}

.table-custom th {
    border-top: none;
    font-weight: 600;
    color: var(--gray-700);
    padding: 16px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-300);
}

.table-custom td {
    padding: 16px;
    vertical-align: middle;
    border-top: 1px solid var(--gray-200);
}

.table-custom tbody tr:hover {
    background-color: rgba(0, 176, 255, 0.02);
}

/* Кнопки */
.btn-custom {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.2);
}

/* Бейджи */
.badge-custom {
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 500;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-new { background-color: #e3f2fd; color: #1565c0; }
.status-in-progress { background-color: #fff3e0; color: #ef6c00; }
.status-completed { background-color: #e8f5e9; color: #2e7d32; }
.status-on-hold { background-color: #fce4ec; color: #c2185b; }

/* Прогресс-бары */
.progress-custom {
    height: 8px;
    border-radius: 4px;
    background-color: var(--gray-200);
}

.progress-custom .progress-bar {
    border-radius: 4px;
}

/* Пагинация */
.pagination-custom .page-item .page-link {
    border: none;
    color: var(--gray-700);
    padding: 8px 16px;
    border-radius: 6px;
    margin: 0 4px;
    transition: all 0.2s ease;
}

.pagination-custom .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.pagination-custom .page-item .page-link:hover {
    background-color: var(--gray-100);
    color: var(--primary-color);
}

/* Вкладки */
.nav-tabs-custom {
    border-bottom: 1px solid var(--gray-300);
}

.nav-tabs-custom .nav-link {
    border: none;
    color: var(--gray-600);
    font-weight: 500;
    padding: 12px 20px;
    margin-right: 8px;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
    position: relative;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--primary-color);
    background-color: var(--gray-100);
}

.nav-tabs-custom .nav-link.active {
    color: var(--primary-color);
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
}

/* Новости */
.news-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.news-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.news-image {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gray-100);
}

/* Если нет изображения, показываем иконку */
.news-image:not(:has(img)) {
    height: 180px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: rgba(255, 255, 255, 0.9);
}

.news-image i {
    font-size: 3rem;
    z-index: 1;
}

/* Изображение с учетом настроек размера и выравнивания */
.news-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Размеры изображений */
.news-image img[data-size="small"] {
    max-width: 400px;
}

.news-image img[data-size="medium"] {
    max-width: 600px;
}

.news-image img[data-size="large"] {
    max-width: 100%;
}

/* Выравнивание изображений */
.news-image[data-align="left"] {
    text-align: left;
    justify-content: flex-start;
}

.news-image[data-align="center"] {
    text-align: center;
    justify-content: center;
}

.news-image[data-align="right"] {
    text-align: right;
    justify-content: flex-end;
}

.news-image[data-align="auto"] {
    text-align: center;
    justify-content: center;
}

.news-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    line-height: 1.4;
}

.news-title a {
    color: inherit;
    text-decoration: none;
}

.news-title a:hover {
    color: var(--primary-color);
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.news-meta-left, .news-meta-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.news-meta i {
    margin-right: 4px;
}

.rating-stars {
    color: #ffc107;
    font-size: 0.9rem;
}

.rating-stars .far {
    color: #e0e0e0;
}

/* Интерактивный рейтинг */
.rating-stars-interactive {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating-stars-interactive .star {
    font-size: 0.9rem;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.rating-stars-interactive .star:hover,
.rating-stars-interactive .star.active {
    color: #ffc107;
    transform: scale(1.1);
}

.rating-stars-interactive .star.filled {
    color: #ffc107;
}

.rating-stars-interactive .star i {
    transition: all 0.2s ease;
}

.rating-stars-interactive .rating-value {
    margin-left: 8px;
    font-size: 0.9rem;
    color: var(--gray-600);
    min-width: 30px;
}

.news-excerpt {
    color: var(--gray-700);
    margin-bottom: 16px;
    flex-grow: 1;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

/* Статистика на главной */
.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card-small {
    background-color: var(--gray-100);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon-small {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(0, 176, 255, 0.1);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 12px;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* AI рекомендации */
.ai-suggestion {
    background-color: var(--gray-100);
    border-left: 4px solid var(--secondary-color);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.ai-suggestion:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-suggestion.warning {
    border-left-color: var(--warning-color);
    background-color: rgba(255, 145, 0, 0.05);
}

.ai-suggestion.danger {
    border-left-color: var(--danger-color);
    background-color: rgba(255, 23, 68, 0.05);
}

.ai-suggestion strong {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.ai-suggestion p {
    color: var(--gray-700);
    margin: 0;
}

/* Cookie Notification */
.cookie_notify {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 16px 24px;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.cookie_notify_text {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 1200px;
    width: 100%;
}

.cookie_notify_text a {
    color: var(--secondary-color);
    text-decoration: underline;
}

.cookie_notify_button {
    background: var(--secondary-color);
    color: white;
    padding: 8px 24px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.cookie_notify_button:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-1px);
}

/* Мобильная кнопка меню */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Адаптивность - ТОЧНО КАК В ШАБЛОНЕ */
@media (max-width: 1200px) {
    .sidebar {
        width: 70px;
        overflow-x: hidden;
    }
    
    .sidebar .menu-text, .sidebar .menu-title {
        display: none;
    }
    
    .sidebar-header h3 {
        font-size: 1.2rem;
    }
    
    .main-content {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
        max-width: calc(100% - 70px) !important;
    }
    
    .sidebar:hover {
        width: 260px;
    }
    
    .sidebar:hover .menu-text, .sidebar:hover .menu-title {
        display: block;
    }
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .news-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .news-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
