:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 56px;
    --transition-speed: 0.3s;

    /* Цветовая палитра */
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;

    /* Тени */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);

    /* Скругления */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}

/* Шрифты */
* {
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.sidebar-logo-text,
.btn,
.breadcrumb,
.card-title,
.modal-title {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 500;
}

/* Общие стили */
body {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Заголовки */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--dark-color);
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

h4 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--dark-color);
}

h5 {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

h6 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Абзацы */
p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.lead {
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.7;
}

/* Контейнер приложения */
.app-container {
    min-height: 100vh;
    position: relative;
}

/* Сайдбар */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--light-color);
    transition: all var(--transition-speed) ease;
    position: fixed;
    z-index: 1050;
    box-shadow: var(--shadow-lg);
    left: 0;
    top: 0;
    bottom: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 3px 0 15px rgba(0,0,0,0.3);
}

/* Шапка сайдбара */
.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    opacity: 1;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

/* Состояние для свернутого меню */
.sidebar.collapsed .sidebar-logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Кнопка сворачивания */
#sidebarCollapse {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--light-color);
    padding: 5px 8px;
    flex-shrink: 0;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

#sidebarCollapse:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.toggle-icon {
    transition: transform var(--transition-speed) ease;
    font-size: 0.875rem;
}

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* Меню сайдбара */
.sidebar-menu {
    padding: 20px 0;
    flex-grow: 1;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height) - 120px);
}

.sidebar-menu .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 15px;
    margin: 2px 0;
    border-radius: 0;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-menu .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent-color);
}

.sidebar-menu .nav-link.active {
    background: rgba(52, 152, 219, 0.2);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 600;
}

.sidebar-menu .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.sidebar.collapsed .nav-link i {
    font-size: 1.3rem;
}

.menu-text {
    transition: opacity var(--transition-speed) ease;
    margin-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    font-size: 14px;
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

/* Футер сайдбара */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    color: var(--light-color);
    flex-grow: 1;
    overflow: hidden;
}

.user-info i {
    font-size: 1.5rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.user-name {
    transition: opacity var(--transition-speed) ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.sidebar.collapsed .user-name {
    opacity: 0;
    width: 0;
    margin-right: 0;
}

.logout-btn {
    flex-shrink: 0;
    margin-left: 22px;
}

.logout-btn .btn-link {
    text-decoration: none;
    color: var(--light-color) !important;
    opacity: 0.8;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.logout-btn .btn-link:hover {
    opacity: 1;
    transform: scale(1.05);
}

.logout-btn i {
    font-size: 1.2rem;
}

.logout-text {
    transition: opacity var(--transition-speed) ease;
    margin-left: 5px;
    white-space: nowrap;
    font-size: 14px;
}

.sidebar.collapsed .logout-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
    overflow: hidden;
}

/* Основной контент */
.content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: all var(--transition-speed) ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
}

.sidebar.collapsed ~ .content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* Стили для гостевого режима (когда меню скрыто) */
.content.guest-content {
    margin-left: 0 !important;
    width: 100% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Мобильная верхняя панель */
.navbar.d-lg-none {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: #fff;
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
    font-family: 'Roboto', sans-serif;
}

.navbar-brand {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

/* Хлебные крошки */
.breadcrumb {
    background: transparent;
    margin-bottom: 1.5rem;
    padding: 0.75rem 0;
    font-family: 'Roboto', sans-serif;
}

.breadcrumb-item {
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #666;
    font-weight: 500;
}

/* Основной контент */
main.container-fluid {
    max-width: 98%;
    margin: 0 auto;
    padding: 0 2rem;
}

@media (max-width: 768px) {
    main.container-fluid {
        padding: 0 1rem;
    }
}

/* Карточки */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 1.25rem 1.5rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Кнопки */
.btn {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border-radius: var(--border-radius-md);
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, #2980b9 100%);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #219653 100%);
    border: none;
}

.btn-outline-primary {
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--accent-color);
    color: white;
}

/* Формы */
.form-control {
    border-radius: var(--border-radius-md);
    border: 1px solid #ddd;
    padding: 0.75rem 1rem;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: 'Open Sans', sans-serif;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    font-family: 'Roboto', sans-serif;
}

/* Таблицы */
.table {
    font-family: 'Open Sans', sans-serif;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
    padding: 1rem;
    font-family: 'Roboto', sans-serif;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
    transition: background-color 0.2s ease;
}

/* Оверлей для мобильных */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
    cursor: pointer;
    backdrop-filter: blur(3px);
}

/* Адаптивность */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1060;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Скрываем кнопку сворачивания на мобильных */
    #sidebarCollapse {
        display: none !important;
    }

    /* Показываем оверлей при открытом меню */
    .sidebar.mobile-open + .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }

    body {
        font-size: 13px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Подвал */
.footer {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
    font-size: 0.875rem;
    color: #666;
    font-family: 'Roboto', sans-serif;
}

.footer.guest-footer {
    margin-top: auto;
    background: transparent;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
}

/* Стили для страницы входа */
.site-login .card {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s ease-out;
}

.site-login .card-header {
    background: linear-gradient(135deg, var(--accent-color) 0%, #2980b9 100%);
    color: white;
    font-size: 1.25rem;
    padding: 1.5rem;
}

.site-login .text-muted {
    color: #6c757d !important;
    font-weight: 300;
}

.site-login a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.site-login a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Кастомные классы для текста */
.text-thin {
    font-weight: 300;
}

.text-regular {
    font-weight: 400;
}

.text-medium {
    font-weight: 500;
}

.text-bold {
    font-weight: 600;
}

.text-uppercase {
    letter-spacing: 1px;
}

/* Утилиты */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.rounded-sm {
    border-radius: var(--border-radius-sm) !important;
}

.rounded-md {
    border-radius: var(--border-radius-md) !important;
}

.rounded-lg {
    border-radius: var(--border-radius-lg) !important;
}

/* Кастомные цвета текста */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.text-accent {
    color: var(--accent-color) !important;
}

.text-success-custom {
    color: var(--success-color) !important;
}

/* Отступы */
.mt-6 {
    margin-top: 4rem !important;
}

.mb-6 {
    margin-bottom: 4rem !important;
}

.py-6 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
}