/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 40px 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 36px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Админ панель */
.admin-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Кнопки */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

/* Баланс кухни */
.kitchen-balance {
    background: white;
    padding: 20px 30px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 30px;
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Лидерборд */
.leaderboard {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.leaderboard h2 {
    margin-bottom: 25px;
    color: #374151;
    font-size: 28px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
}

thead th:first-child {
    border-radius: 12px 0 0 0;
}

thead th:last-child {
    border-radius: 0 12px 0 0;
}

tbody td {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}

tbody tr:hover {
    background: #f9fafb;
}

/* Модальные окна */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.header-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.header-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 24px 28px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f9fafb;
}

/* Мульти-селект */
.multi-select-container {
    margin-bottom: 24px;
    position: relative;
}

.select-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.select-input-wrapper {
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    padding: 10px;
    min-height: 52px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    cursor: text;
    transition: all 0.2s;
    background: white;
}

.select-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    animation: tagAppear 0.25s ease-out;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tag-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    line-height: 1;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.select-search-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 150px;
    font-size: 15px;
    padding: 6px;
    color: #374151;
}

.select-search-input::placeholder {
    color: #9ca3af;
}

.select-dropdown {
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 14px 14px;
    max-height: 320px;
    overflow-y: auto;
    background: white;
    display: none;
    position: absolute;
    width: calc(100% - 2px);
    left: 0;
    top: 100%;
    z-index: 100;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    margin-top: -2px;
}

.select-dropdown.show {
    display: block;
    animation: dropdownSlide 0.25s ease-out;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
}

.dropdown-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.dropdown-item span {
    flex: 1;
    font-size: 15px;
    color: #374151;
    font-weight: 500;
}

/* Формы */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
    font-family: inherit;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

/* Скроллбар */
.select-dropdown::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.select-dropdown::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.select-dropdown::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.select-dropdown::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Адаптивность */
@media (max-width: 768px) {
    h1 {
        font-size: 28px;
    }

    .admin-panel {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .modal {
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }

    table {
        font-size: 14px;
    }

    thead th,
    tbody td {
        padding: 12px 8px;
    }
}

.filter-section {
    background: white;
    padding: 20px 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    margin-bottom: 0;
}

.filter-container .multi-select-container {
    flex: 1;
    min-width: 300px;
    margin-bottom: 0;
}

.filter-container .select-input-wrapper {
    min-height: 44px;
}

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    margin-bottom: 0;
}

/* Сортировка таблицы */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    position: relative;
    padding-right: 35px !important;
}

.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
    transition: all 0.2s;
}

.sortable:hover .sort-icon {
    opacity: 1;
}

.sortable.asc .sort-icon::after {
    content: '↑';
}

.sortable.desc .sort-icon::after {
    content: '↓';
}

.sortable.asc .sort-icon,
.sortable.desc .sort-icon {
    opacity: 1;
    color: #4ade80;
}

.sortable.asc .sort-icon::after,
.sortable.desc .sort-icon::after {
    content: '';
}

.sortable.asc .sort-icon {
    content: '↑';
}

.sortable.desc .sort-icon {
    content: '↓';
}

/* Адаптивность для фильтра */
@media (max-width: 768px) {
    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-container .multi-select-container {
        min-width: 100%;
    }

    .btn-sm {
        width: 100%;
    }
}

.filter-section {
    background: white;
    padding: 20px 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    margin-bottom: 0;
}

.filter-container .multi-select-container {
    flex: 1;
    min-width: 300px;
    margin-bottom: 0;
}

.filter-container .select-input-wrapper {
    min-height: 44px;
}

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    margin-bottom: 0;
    white-space: nowrap;
}

/* ✅ Стили для кнопки "Применить" */
.btn-apply {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-apply:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Индикатор активного фильтра */
.filter-active-indicator {
    display: none;
    background: #fef3c7;
    color: #92400e;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
}

.filter-active-indicator.show {
    display: block;
}