/* static/portal/css/admin.css */

:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --info-color: #7209b7;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --sidebar-width: 250px;
    --navbar-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.admin-body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fb;
    min-height: 100vh;
}

/* Навигация */
.admin-navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    height: var(--navbar-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-brand a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--dark-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
    background: var(--light-color);
}

/* Боковая панель */
.admin-sidebar {
    position: fixed;
    left: 0;
    top: var(--navbar-height, 60px);
    bottom: 0;
    width: var(--sidebar-width, 250px);
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    color: #ecf0f1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
}

/* Стили для основного контента при наличии sidebar */
.admin-main.with-sidebar {
    margin-left: var(--sidebar-width, 250px);
    padding-top: var(--navbar-height, 60px);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Заголовок sidebar */
.sidebar-header {
    padding: 25px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* Быстрые действия в sidebar */
.sidebar-actions {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-actions .btn {
    margin-bottom: 10px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    text-align: left;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.sidebar-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sidebar-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-actions .btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.sidebar-actions .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

/* Навигация в sidebar */
.sidebar-nav {
    padding: 15px 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin: 5px 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    font-weight: 500;
}

.sidebar-menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #667eea;
    padding-left: 25px;
}

.sidebar-menu-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: #667eea;
    font-weight: 600;
}

.sidebar-menu-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Статистика в sidebar */
.sidebar-stats {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item i {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #667eea;
}

.stat-item span {
    flex: 1;
    font-size: 0.95rem;
}

/* Свернутый sidebar */
.admin-sidebar.collapsed {
    width: 70px;
}

.admin-sidebar.collapsed .sidebar-header h3,
.admin-sidebar.collapsed .sidebar-actions .btn span,
.admin-sidebar.collapsed .sidebar-menu-link span,
.admin-sidebar.collapsed .stat-item span {
    display: none;
}

.admin-sidebar.collapsed .sidebar-actions {
    padding: 10px;
}

.admin-sidebar.collapsed .sidebar-actions .btn {
    justify-content: center;
    padding: 10px;
}

.admin-sidebar.collapsed .sidebar-menu-link {
    justify-content: center;
    padding: 15px;
}

.admin-sidebar.collapsed .stat-item {
    justify-content: center;
    padding: 15px 0;
}

.admin-main.sidebar-collapsed {
    margin-left: 70px;
}

/* Кнопка toggle sidebar */
.sidebar-toggle {
    position: absolute;
    top: 15px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(180deg);
}

/* Подменю в sidebar */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.show {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 50px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-submenu-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding-left: 55px;
}

.sidebar-submenu-link i {
    width: 15px;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Иконка стрелки для меню с подменю */
.sidebar-menu-link.has-submenu {
    position: relative;
}

.sidebar-menu-link.has-submenu::after {
    content: '▸';
    position: absolute;
    right: 20px;
    transition: transform 0.3s ease;
}

.sidebar-menu-link.has-submenu.active::after {
    transform: rotate(90deg);
}

/* Прокрутка sidebar */
.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-sidebar-toggle {
        display: none;
    }

/* Адаптивность для sidebar */
@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width, 250px);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-main.with-sidebar {
        margin-left: 0;
    }

    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: white;
        font-size: 1.2rem;
        cursor: pointer;
        padding: 10px;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        max-width: 300px;
    }
}

/* Основной контент */
.admin-main {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.content-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}

/* Карточки */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    border: none;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 10px 10px 0 0;
}

.card-body {
    padding: 20px;
}

/* Таблицы */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 15px;
    font-weight: 600;
    color: var(--dark-color);
    text-align: left;
}

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

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Статусные бейджи */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

/* Кнопки */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #4895ef);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #b5179e);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #f3722c);
    color: white;
}

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

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

.btn-block {
    display: block;
    width: 100%;
}

/* Формы */
.form-control {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
    display: block;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Уведомления */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    opacity: 1;
}

/* Toast уведомления */
.toast {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 350px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

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

.toast-error {
    border-left-color: #dc3545;
}

.toast-warning {
    border-left-color: #ffc107;
}

.toast-info {
    border-left-color: #17a2b8;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 20px;
}

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

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

.toast-warning .toast-icon {
    color: #ffc107;
}

.toast-info .toast-icon {
    color: #17a2b8;
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    opacity: 0.7;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

/* Пагинация */
.pagination {
    margin-top: 20px;
}

.page-link {
    border: none;
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 6px;
    margin: 0 2px;
}

.page-link:hover {
    background: #f0f2ff;
    color: var(--secondary-color);
}

.page-item.active .page-link {
    background: var(--primary-color);
    color: white;
}

/* Dropdown пользователя */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    background: none;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.user-dropdown-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
}

.user-dropdown:hover .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.dropdown-item.logout-btn {
    color: var(--danger-color);
}

/* Аватар пользователя */
.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    margin: 0 auto;
}

/* Модальные окна */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 10px 10px 0 0;
    padding: 20px;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Адаптивность */
@media (max-width: 992px) {
    .navbar-menu {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        padding: 0 10px;
    }

    .admin-main {
        padding: 10px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
        gap: 5px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}