/* Админский интерфейс - стили */

.admin-templates {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
}

.admin-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  min-width: 150px;
}

.filter-input {
  flex: 1;
  min-width: 200px;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.admin-templates-list {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
}

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

.admin-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.admin-table th {
  padding: 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.admin-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-table .actions {
  display: flex;
  gap: 8px;
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #ff3d5f;
}

.btn-secondary {
  background: #2b2c36;
  color: #fff;
}

.btn-secondary:hover {
  background: #35364a;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(108, 229, 177, 0.2);
  color: #6ce5b1;
}

.badge-danger {
  background: rgba(255, 92, 122, 0.2);
  color: #ff5c7a;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

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

/* Модальное окно */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 800;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.form-control[type="file"] {
  padding: 8px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-error {
  padding: 60px 20px;
  text-align: center;
}

.admin-error h1 {
  color: var(--danger);
  margin-bottom: 16px;
}

/* Форма входа администратора */
.admin-login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg);
}

.admin-login-form {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.admin-login-form h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}

.admin-login-error {
  background: rgba(255, 92, 122, 0.2);
  color: #ff5c7a;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.admin-login-form .form-group {
  margin-bottom: 20px;
}

.admin-login-form .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.admin-login-form .form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.admin-login-form .form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.admin-login-form .form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-login-form .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Drag-and-drop загрузка файлов */
.file-upload-container {
  width: 100%;
}

.file-upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-upload-dropzone:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.file-upload-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(91, 124, 250, 0.1);
  transform: scale(1.02);
}

.file-upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.file-upload-text {
  margin-bottom: 20px;
}

.file-upload-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.file-upload-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.file-upload-button {
  display: inline-block;
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.file-upload-button:hover {
  background: #6b7ff0;
}

.file-upload-button input {
  display: none;
}

/* Предпросмотр файла */
.file-preview {
  margin-top: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.file-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.file-preview-info {
  flex: 1;
}

.file-preview-name {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.file-preview-size {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.file-preview-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.file-preview-remove:hover {
  background: rgba(255, 92, 122, 0.2);
  color: var(--danger);
}

.file-preview-content {
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 400px;
  overflow: auto;
}

.file-preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.file-preview-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
}

/* Админский интерфейс разделов */
.admin-sections {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.admin-sections-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.admin-sections-list {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
}

.admin-table tr.active {
  background: rgba(108, 229, 177, 0.1);
}

.admin-table tr {
  cursor: pointer;
}

.admin-section-details {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
}

.admin-section-details.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.section-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-details-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.section-card-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.section-card-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.card-preview {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.card-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-order {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.card-info {
  padding: 12px;
}

.card-info h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
}

.card-template {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.card-actions {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

/* Навигация админ-панели */
.admin-panel-wrapper {
  min-height: 100vh;
  background: var(--bg);
}

.admin-nav {
  background: var(--card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-nav-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 4px;
}

.admin-nav-item {
  padding: 16px 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  position: relative;
}

.admin-nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.admin-nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-nav-back {
  margin-left: auto;
  color: var(--muted);
}

.admin-nav-back:hover {
  color: var(--text);
}

/* Страница слайдеров */
.admin-sliders {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-sliders-list {
  margin-top: 24px;
}

.sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}

.slider-card-item {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.slider-card-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.slider-card-preview {
  position: relative;
  width: 100%;
  padding-top: 50%; /* 2:1 aspect ratio */
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.slider-card-preview video,
.slider-card-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

.slider-card-order {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.slider-card-content {
  padding: 16px;
}

.slider-card-subtitle {
  font-size: 11px;
  color: #4ade80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.slider-card-actions {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

/* Адаптивность */
@media (max-width: 1024px) {
  .sliders-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-templates,
  .admin-sections,
  .admin-sliders {
    padding: 16px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .admin-filters {
    flex-direction: column;
  }

  .filter-input,
  .filter-select {
    width: 100%;
  }

  .admin-table {
    font-size: 12px;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px;
  }

  .admin-table .actions {
    flex-direction: column;
  }

  .admin-sections-layout {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

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

  .modal-content {
    padding: 24px;
    margin: 20px;
  }

  .file-upload-dropzone {
    padding: 30px 16px;
  }

  .file-upload-icon {
    font-size: 36px;
  }

  .file-preview-content {
    max-height: 250px;
  }

  .admin-nav-container {
    padding: 0 12px;
    gap: 0;
  }

  .admin-nav-item {
    padding: 12px 14px;
    font-size: 13px;
  }
}

