/* Admin Panel Styles */
/* Uses theme variables from styles.css */

/* Admin layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--background);
}

.admin-sidebar {
  width: 250px;
  background-color: var(--sidebar);
  color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar-header {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 1rem;
}

.admin-sidebar-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--sidebar-foreground);
}

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

.admin-sidebar-nav li {
  margin: 0;
}

.admin-sidebar-nav a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--sidebar-foreground);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.admin-sidebar-nav a:hover {
  background-color: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  border-left-color: var(--sidebar-primary);
}

.admin-sidebar-nav a.router-link-active {
  background-color: var(--sidebar-primary);
  color: var(--sidebar-primary-foreground);
  border-left-color: var(--sidebar-primary);
}

.admin-sidebar-nav a.disabled {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

/* Submenu styles */
.admin-sidebar-nav .has-submenu {
  position: relative;
}

.admin-sidebar-nav .submenu-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.admin-sidebar-nav .submenu-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.admin-sidebar-nav .submenu-arrow.open {
  transform: rotate(180deg);
}

.admin-submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  background-color: var(--muted);
  border-left: 3px solid var(--sidebar-primary);
}

.admin-submenu li {
  margin: 0;
}

.admin-submenu a {
  padding-left: 2.5rem !important;
  font-size: 0.9rem;
  background-color: transparent;
}

.admin-submenu a:hover {
  background-color: var(--sidebar-accent) !important;
}

.admin-submenu a.router-link-active {
  background-color: var(--sidebar-primary) !important;
  color: var(--sidebar-primary-foreground) !important;
}

.admin-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.admin-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-header h1 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.admin-header .subtitle {
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

/* Admin cards */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Autocomplete dropdown */
.position-relative {
  position: relative !important;
}

/* Выпадающий список автодополнения - фиксированное позиционирование поверх всех элементов */
.list-group.shadow {
  position: fixed !important;
  z-index: 10000 !important;
  background: white !important;
  border: 1px solid #dee2e6 !important;
  border-radius: 0.375rem !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
  margin-top: 2px !important;
}

/* Карточка с фильтрами - overflow visible для выпадающих списков */
.filters-card {
  overflow: visible !important;
}

.filters-card .card-body {
  overflow: visible !important;
}

/* Все карточки - сохраняем округление углов */
.card {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card .table-responsive {
  border-radius: var(--radius-lg);
}

.card .table {
  margin-bottom: 0;
}

/* Округление углов для первой и последней ячеек таблицы */
.card .table thead tr:first-child th:first-child {
  border-top-left-radius: calc(var(--radius-lg) - 1px);
}

.card .table thead tr:first-child th:last-child {
  border-top-right-radius: calc(var(--radius-lg) - 1px);
}

.card .table tbody tr:last-child td:first-child {
  border-bottom-left-radius: calc(var(--radius-lg) - 1px);
}

.card .table tbody tr:last-child td:last-child {
  border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

.admin-stat-card h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.admin-stat-card .value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--foreground);
}

.admin-stat-card .change {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

/* Content list */
.content-list {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.content-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--muted);
}

.content-list-search {
  flex: 1;
  max-width: 300px;
}

.content-list-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0 1.5rem;
  padding-top: 1rem;
}

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

.content-table thead {
  background-color: var(--muted);
}

.content-table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
}

.content-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

.content-table tbody tr:hover {
  background-color: var(--muted);
}

.content-table .status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
}

.status-badge.published {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.status-badge.draft {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

.status-badge.archived {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.content-table .actions {
  display: flex;
  gap: 0.5rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination button {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background-color: var(--muted);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* Editor */
.content-editor {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.content-editor-toolbar {
  display: flex;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.content-editor-toolbar button {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.content-editor-toolbar button:hover {
  background-color: var(--muted);
}

.content-editor-toolbar button.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.content-editor-textarea {
  width: 100%;
  min-height: 400px;
  padding: 1rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  resize: vertical;
}

.content-editor-textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--ring);
}

.content-editor-preview {
  min-height: 400px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--background);
}

/* Form groups */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--foreground);
}

.form-group .help-text {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  background-color: var(--muted);
  color: var(--muted-foreground);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }
  
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }
  
  .admin-content {
    padding: 1rem;
  }
  
  .content-list-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .content-list-search {
    max-width: 100%;
  }
  
  .content-table {
    font-size: 0.875rem;
  }
  
  .content-table th,
  .content-table td {
    padding: 0.75rem;
  }
  
  .admin-stats {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   Settings/Dashboard Tiles
   =================================== */
.admin-page {
  padding: 0;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--muted-foreground);
  font-size: 1rem;
  margin-bottom: 0;
}

/* Settings Tiles Grid */
.settings-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

/* Individual Tile */
.settings-tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--foreground);
  transition: all 0.2s ease;
  cursor: pointer;
}

.settings-tile:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  color: var(--foreground);
  text-decoration: none;
}

.settings-tile.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.settings-tile.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

/* Tile Icon */
.tile-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

/* Tile Body */
.tile-body {
  flex: 1;
  min-width: 0;
}

.tile-body h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--foreground);
}

.tile-body p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
  line-height: 1.4;
}

/* Tile Badge */
.tile-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 4px;
  margin-top: 0.5rem;
}

/* Tile Arrow */
.tile-arrow {
  flex-shrink: 0;
  color: var(--muted-foreground);
  transition: transform 0.2s ease;
}

.settings-tile:hover .tile-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .settings-tiles {
    grid-template-columns: 1fr;
  }
  
  .tile-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }
  
  .tile-body h4 {
    font-size: 0.95rem;
  }
  
  .tile-body p {
    font-size: 0.8rem;
  }
}
