.navbar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.navbar-brand-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
  color: #212529;
}

.navbar-brand-subtitle {
  font-size: 0.75rem;
  color: #6c757d;
  line-height: 1.2;
}


/* ============================================================================
   Sidebar Styles
   ============================================================================ */

/* Мобильная шапка */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  z-index: 1040;
  display: flex;
  align-items: center;
}

.mobile-header-content {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 1rem;
  gap: 0.75rem;
}

.mobile-sidebar-toggle {
  background: transparent;
  border: none;
  color: #495057;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.mobile-sidebar-toggle:hover {
  background: #f8f9fa;
  color: #212529;
}

.mobile-sidebar-toggle:active {
  transform: scale(0.95);
}

.mobile-sidebar-toggle i {
  font-size: 1.25rem;
}

.mobile-header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

.mobile-header-brand:hover {
  color: inherit;
  opacity: 0.8;
}

.mobile-header-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.mobile-header-text {
  flex: 1;
  min-width: 0;
}

.mobile-header-title {
  font-size: 1rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overlay для мобильных */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1049;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: none;
  pointer-events: none;
}

.sidebar-overlay[style*="display: block"] {
  pointer-events: auto;
}

/* Основной сайдбар */
.sidebar {
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  transition: transform 0.3s ease, width 0.3s ease;
  overflow: hidden;
}

/* Переопределяем Bootstrap offcanvas базовые стили */
.sidebar.offcanvas {
  visibility: visible !important;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1051;
}

.sidebar.collapsed .sidebar-content {
  overflow-x: hidden !important;
  overflow-y: auto;
}

.sidebar.collapsed {
  overflow-x: hidden !important;
  overflow-y: visible;
}

/* Заголовок сайдбара */
.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 0.75rem;
}

/* Кнопка сворачивания сайдбара */
.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: #6c757d;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
}

.sidebar-toggle-btn:hover {
  background: #f8f9fa;
  color: #212529;
}

.sidebar-toggle-btn i {
  font-size: 1.125rem;
  transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-btn i {
  transform: rotate(180deg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
  flex: 1;
  min-width: 0;
}

.sidebar-brand:hover {
  opacity: 0.8;
  color: inherit;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text {
  flex: 1;
  min-width: 0;
}

.sidebar-brand-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.2;
  margin-bottom: 0.125rem;
}

.sidebar-brand-subtitle {
  font-size: 0.75rem;
  color: #6c757d;
  line-height: 1.2;
}

/* Навигация */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: #495057;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
  white-space: nowrap;
}

.sidebar-item span {
  transition: opacity 0.2s ease;
}

.sidebar-item i {
  font-size: 1.125rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-item:hover {
  background: #f8f9fa;
  color: #212529;
  border-left-color: #dee2e6;
}

.sidebar-item.active {
  background: #e7f3ff;
  color: #0d6efd;
  border-left-color: #0d6efd;
  font-weight: 600;
}

.sidebar-item.active i {
  color: #0d6efd;
}

/* Футер с профилем пользователя */
.sidebar-footer {
  border-top: 1px solid #e9ecef;
  padding: 1.5rem 1.25rem;
  flex-shrink: 0;
  background: #f8f9fa;
  min-height: 80px;
  display: flex;
  align-items: center;
}

/* Основной футер */
.main-footer {
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding: 1.5rem 0;
  min-height: 80px;
  display: flex;
  align-items: center;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-avatar i {
  font-size: 1.5rem;
  color: #6c757d;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.2;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: #6c757d;
  line-height: 1.2;
  text-transform: capitalize;
  transition: opacity 0.2s ease;
}

.sidebar-user-menu {
  flex-shrink: 0;
}

.sidebar-user-toggle {
  padding: 0.25rem;
  color: #6c757d;
  border: none;
  background: transparent;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.sidebar-user-toggle:hover {
  background: #e9ecef;
  color: #212529;
}

.sidebar-user-toggle:focus {
  box-shadow: none;
}

/* Свернутое состояние сайдбара */
.sidebar.collapsed {
  width: 80px !important;
}

.sidebar.collapsed:hover {
  width: 80px !important;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-user-info {
  opacity: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  display: none !important;
}

.sidebar.collapsed .sidebar-item:hover span,
.sidebar.collapsed .sidebar-item:hover .sidebar-brand-text,
.sidebar.collapsed:hover .sidebar-brand-text,
.sidebar.collapsed:hover .sidebar-item span {
  display: none !important;
  opacity: 0 !important;
  width: 0 !important;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 0.75rem;
  position: relative;
}

.sidebar.collapsed .sidebar-item:hover {
  justify-content: center;
  padding: 0.75rem;
}

.sidebar.collapsed .sidebar-item i {
  margin: 0;
}

.sidebar.collapsed .sidebar-section-title {
  padding: 0;
  text-align: center;
  height: 0;
}

.sidebar.collapsed .sidebar-user {
  justify-content: center;
}

.sidebar.collapsed .sidebar-user-menu {
  display: none;
}

.sidebar.collapsed .sidebar-header {
  justify-content: flex-start;
  padding: 1.5rem 0.75rem;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  width: 100%;
  gap: 0;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.sidebar.collapsed .sidebar-brand:hover {
  background: #f8f9fa;
}

.sidebar.collapsed .sidebar-brand-text {
  display: none;
}

.sidebar.collapsed .sidebar-logo {
  margin: 0 auto;
  display: block;
}

.sidebar.collapsed .sidebar-toggle-btn {
  margin: 0;
  width: 100%;
}

/* Tooltip для свернутого состояния */
.sidebar.collapsed .sidebar-item {
  position: relative;
}

.sidebar.collapsed .sidebar-item:hover::after {
  content: attr(data-title);
  position: fixed;
  left: 80px;
  background: #212529;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  white-space: nowrap;
  z-index: 1050;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  max-width: 200px;
  margin-left: 0.75rem;
}

.sidebar.collapsed .sidebar-item:hover::before {
  content: '';
  position: fixed;
  left: 80px;
  border: 6px solid transparent;
  border-right-color: #212529;
  z-index: 1051;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  margin-left: 0.5rem;
}

/* Показываем tooltip только при наведении */
.sidebar.collapsed .sidebar-item:hover::after,
.sidebar.collapsed .sidebar-item:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Вычисляем позицию tooltip через JavaScript */
.sidebar.collapsed .sidebar-item[data-tooltip-top]::after {
  top: var(--tooltip-top, 50%);
  transform: translateY(-50%);
}

.sidebar.collapsed .sidebar-item[data-tooltip-top]::before {
  top: var(--tooltip-top, 50%);
  transform: translateY(-50%);
}

/* Адаптивность */
@media (min-width: 992px) {
  .sidebar-toggle {
    display: none;
  }
  
  .sidebar-overlay {
    display: none !important;
  }
  
  /* Переопределяем Bootstrap offcanvas для десктопа */
  .sidebar.offcanvas {
    position: fixed !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    background-color: #ffffff !important;
    border-right: 1px solid #e9ecef !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transition: width 0.3s ease;
  }
  
  .sidebar.collapsed.offcanvas {
    width: 80px !important;
  }
  
  .sidebar.collapsed.offcanvas:hover {
    width: 80px !important;
  }
  
  .sidebar.offcanvas.showing,
  .sidebar.offcanvas.show,
  .sidebar.offcanvas:not(.hiding):not(.hiding) {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .sidebar.offcanvas.hiding {
    transform: translateX(0) !important;
    visibility: visible !important;
  }
  
  /* Сдвигаем основной контент при наличии сайдбара */
  .main-content {
    margin-left: 280px;
    transition: margin-left 0.3s ease;
  }
  
  body:has(.sidebar.collapsed) .main-content,
  .main-content[style*="margin-left: 80px"] {
    margin-left: 80px !important;
  }
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
    top: 56px;
    height: calc(100vh - 56px);
  }
  
  .sidebar.show,
  .sidebar.offcanvas.show {
    transform: translateX(0);
    z-index: 1050 !important;
  }
  
  .sidebar-content {
    position: relative;
    z-index: 1051;
    pointer-events: auto !important;
  }
  
  .sidebar-item,
  .sidebar-brand,
  .sidebar-toggle-btn,
  .sidebar-user,
  .sidebar-item a {
    pointer-events: auto !important;
    position: relative;
    z-index: 1052;
  }
  
  .sidebar.offcanvas {
    pointer-events: auto !important;
  }
  
  .sidebar.offcanvas.show {
    pointer-events: auto !important;
  }
  
  /* Bootstrap backdrop не должен блокировать sidebar */
  .offcanvas-backdrop {
    z-index: 1049 !important;
    top: 56px;
    height: calc(100vh - 56px);
  }
  
  .sidebar-overlay {
    top: 56px;
    height: calc(100vh - 56px);
  }
  
  .main-content {
    margin-left: 0 !important;
    margin-top: 56px;
  }
}

/* Кастомный скроллбар для сайдбара */
.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #adb5bd;
}

/* Page Header */
.page-title {
  font-size: 2rem;
  font-weight: 300;
  color: #212529;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: #6c757d;
  margin-bottom: 0;
}

/* Status Badge */
.status-badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
}

.status-published {
  background: #e8f5e8;
  color: #388e3c;
}

.status-draft {
  background: #f5f5f5;
  color: #616161;
}

/* Section Titles */
.section-title {
  font-size: 1.25rem;
  font-weight: 400;
  color: #212529;
  margin-bottom: 1rem;
}

/* Floating Labels */
.form-floating > label {
  color: #6c757d;
  font-weight: 400;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: #212529;
  font-weight: 500;
}

.form-control, .form-select {
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
  border-color: #495057;
  box-shadow: 0 0 0 0.2rem rgba(73, 80, 87, 0.15);
}

/* Small labels */
.form-label.small {
  font-size: 0.875rem;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.25rem;
}

/* Top Section - компактная */
.top-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

/* Items Section - компактная */
.items-count {
  background: #e9ecef;
  color: #495057;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 500;
}

/* Items List - табличный вид */
.items-list {
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
}

.item-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
  background: white;
  margin-bottom: 1px;
  transition: all 0.2s ease;
  cursor: grab;
}

.item-row:hover {
  background: #f8f9fa;
}

.item-row.sortable-ghost {
  opacity: 0.4;
}

.item-row.sortable-chosen {
  background: #e3f2fd;
}

.item-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Drag handle */
.item-drag-handle {
  color: #adb5bd;
  cursor: grab;
  padding: 0.25rem;
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
}

.item-drag-handle:hover {
  color: #495057;
}

.item-drag-handle:active {
  cursor: grabbing;
}

.item-number {
  background: #495057;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
  margin-right: 0.75rem;
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-text {
  font-weight: 500;
  color: #212529;
  margin-bottom: 0.125rem;
  line-height: 1.3;
  font-size: 0.95rem;
}

.item-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.75rem;
  color: #6c757d;
}

.type-label {
  background: #e9ecef;
  color: #495057;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
}

.required-label {
  background: #ffebee;
  color: #c62828;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
}

.options-preview {
  font-style: italic;
  color: #6c757d;
  font-size: 0.7rem;
}

.item-actions {
  flex-shrink: 0;
  margin-left: 0.75rem;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

/* Move buttons */
.move-buttons {
  display: flex;
  gap: 0.125rem;
  margin-right: 0.25rem;
}

.move-buttons .btn {
  padding: 0.25rem 0.375rem;
  font-size: 0.75rem;
  line-height: 1;
}

/* Reorder info */
.reorder-info {
  background: #e3f2fd;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #1565c0;
}

.reorder-info i {
  margin-right: 0.5rem;
}

/* Empty state - компактная */
.empty-state-compact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #f8f9fa;
  border-radius: 12px;
  color: #6c757d;
  font-size: 0.875rem;
}

.empty-state-compact i {
  font-size: 1.25rem;
  color: #adb5bd;
}

/* Actions Section */
.actions-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.5rem;
}

.actions-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.actions-grid .btn {
  display: flex;
  align-items: center;
  text-align: left;
  padding: 1rem;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.actions-grid .btn i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.action-title {
  font-weight: 500;
  color: inherit;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.action-desc {
  font-size: 0.875rem;
  color: #6c757d;
  margin: 0;
  line-height: 1.3;
}

.actions-grid .btn-dark .action-desc {
  color: rgba(255, 255, 255, 0.8);
}

/* Basic Info Section - сворачиваемая */
.basic-info-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1rem 1.5rem;
}

.basic-info-section [role="button"] {
  cursor: pointer;
  user-select: none;
}

.basic-info-section [role="button"]:hover {
  opacity: 0.8;
}

.basic-info-section .bi-chevron-down {
  transition: transform 0.3s ease;
  font-size: 0.875rem;
}

.basic-info-section [aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.basic-info-form {
  padding-top: 0.75rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.empty-state i {
  font-size: 3rem;
  color: #adb5bd;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 400;
  color: #495057;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #6c757d;
  margin: 0;
}

/* Responsive */
@media (max-width: 992px) {
  .add-item-section {
    position: static;
  }
}

@media (max-width: 768px) {
  .page-header .d-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .item-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .actions-grid .btn {
    width: 100%;
  }
}