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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ============ HEADER ============ */
header {
  background: #fff;
  padding: 20px 24px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #d0112b;
}

header h1 span {
  color: #3498db;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

/* ============ КНОПКИ ============ */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-success {
  background: #2ecc71;
  color: white;
}

.btn-success:hover {
  background: #27ae60;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-warning {
  background: #f39c12;
  color: white;
}

.btn-warning:hover {
  background: #e67e22;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid #3498db;
  color: #3498db;
}

.btn-outline:hover {
  background: #3498db;
  color: white;
  transform: translateY(-2px);
}

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

/* ============ СТАТИСТИКА ============ */
.stats {
  background: white;
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: space-around;
}

.stat-item {
  text-align: center;
}

.stat-item .number {
  font-size: 26px;
  font-weight: 700;
  color: #2c3e50;
}

.stat-item .label {
  font-size: 12px;
  color: #95a5a6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============ ПОИСК + СОРТИРОВКА ============ */
.search-box {
  background: white;
  padding: 12px 20px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box input {
  flex: 1;
  min-width: 150px;
  padding: 12px 16px;
  border: 2px solid #e8ecf0;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s ease;
  background: #f8f9fa;
}

.search-box input:focus {
  border-color: #3498db;
  background: white;
}

.search-box button {
  padding: 12px 28px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  white-space: nowrap;
}

.search-box button:hover {
  background: #2980b9;
}

/* ===== СОРТИРОВКА ===== */
.sort-wrapper {
  position: relative;
  min-width: 160px;
}

.sort-wrapper select {
  width: 100%;
  padding: 12px 16px;
  padding-right: 40px;
  background: #f8f9fa;
  border: 2px solid #e8ecf0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2395a5a6' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}

.sort-wrapper select:hover {
  border-color: #3498db;
  background-color: #ebf5fb;
}

.sort-wrapper select:focus {
  border-color: #3498db;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.sort-wrapper select option {
  padding: 8px;
}

/* ============ КАТЕГОРИИ ============ */
.categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.category-btn {
  padding: 8px 18px;
  background: white;
  border: 2px solid #e8ecf0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.category-btn:hover {
  border-color: #3498db;
  background: #ebf5fb;
  transform: translateY(-2px);
}

.category-btn.active {
  border-color: #3498db;
  background: #3498db;
  color: white;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* ============ ТОВАРЫ (СЕТКА) ============ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* ===== ВИДЕЛЕНИЕ ДЛЯ ВИТРИНЫ (первые 4) ===== */
.product-card.featured {
  border: 2px solid #3498db;
  box-shadow: 0 2px 12px rgba(52, 152, 219, 0.15);
}

.product-card.featured:hover {
  box-shadow: 0 8px 30px rgba(52, 152, 219, 0.25);
}

/* ===== КВАДРАТНЫЕ КАРТИНКИ (1:1) ===== */
.product-card .image {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  background: #f0f2f5;
  border-radius: 12px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.product-card .image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-card .image .no-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #bdc3c7;
  font-size: 40px;
}

.product-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #2c3e50;
  line-height: 1.3;
}

.product-card .price {
  font-size: 20px;
  font-weight: 700;
  color: #3498db;
  margin: 4px 0;
  display: inline-block;
}

.product-card .price-old {
  font-size: 14px;
  color: #95a5a6;
  text-decoration: line-through;
  margin-left: 8px;
  display: inline-block;
}

.product-card .description {
  color: #7f8c8d;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ МЕТКИ НА КАРТОЧКЕ (справа от типа) ============ */
.product-info-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.labels-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.labels-inline .label-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.label-featured {
  background: #3498db;
  color: white;
}

.label-discount {
  background: #e74c3c;
  color: white;
}

/* ============ БЕЙДЖИ ============ */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-rent {
  background: #f39c12;
  color: white;
}

.badge-sale {
  background: #2ecc71;
  color: white;
}

.badge-key {
  background: #9b59b6;
  color: white;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 32px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  font-size: 15px;
  z-index: 1000;
  animation: slideUp 0.4s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.toast-success {
  background: #2ecc71;
}

.toast-error {
  background: #e74c3c;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============ МОДАЛЬНОЕ ОКНО (общее) ============ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  z-index: 999;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px 28px 28px;
  max-width: 500px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideUp 0.35s ease;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}

@keyframes modalSlideUp {
  from {
    transform: translateY(40px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-content::-webkit-scrollbar {
  width: 4px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0 6px;
  z-index: 10;
}

.modal-close:hover {
  color: #e74c3c;
  transform: rotate(90deg);
}

/* ============ МОДАЛКА ТОВАРА ============ */
/* ===== КВАДРАТНАЯ КАРТИНКА В МОДАЛКЕ (1:1) ===== */
.modal-image {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  background: #f1f5f9;
  border-radius: 16px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.modal-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-image .no-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #cbd5e1;
  font-size: 56px;
}

.modal-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.3;
}

/* Метки в модалке (справа от типа) */
.modal-labels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.modal-labels .label-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.modal-price {
  font-size: 28px;
  font-weight: 700;
  color: #3498db;
  display: inline-block;
}

.modal-price-old {
  font-size: 18px;
  color: #95a5a6;
  text-decoration: line-through;
  margin-left: 10px;
  display: inline-block;
}

.modal-discount-info {
  font-size: 14px;
  color: #e74c3c;
  font-weight: 600;
  margin-top: 4px;
}

/* ===== ОПИСАНИЕ С КНОПКОЙ "ЧИТАТЬ ДАЛЕЕ" ===== */
.modal-description {
  background: #f8fafc;
  padding: 16px 18px;
  border-radius: 12px;
  margin-bottom: 22px;
  border: 1px solid #eef2f6;
}

.modal-description strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #64748b;
}

.modal-description p {
  color: #334155;
  line-height: 1.7;
  margin: 0;
  font-size: 15px;
  word-wrap: break-word;
  max-height: calc(1.7em * 9);
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.modal-description p.expanded {
  max-height: none;
}

.read-more-btn {
  margin-top: 8px;
  background: none;
  border: none;
  color: #3498db;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  transition: all 0.3s ease;
  display: inline-block;
}

.read-more-btn:hover {
  color: #2980b9;
  text-decoration: underline;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  padding: 14px 24px;
  font-size: 16px;
  flex: 1;
}

/* ============ МОДАЛКА ОПЛАТЫ ============ */
.payment-modal {
  max-width: 460px;
}

.payment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.payment-header .payment-icon {
  font-size: 32px;
}

.payment-header h2 {
  font-size: 22px;
  margin: 0;
  color: #0f172a;
}

.payment-order-info {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border: 1px solid #eef2f6;
}

.payment-order-info > div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.payment-order-info > div:not(:last-child) {
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.payment-label {
  color: #64748b;
  font-size: 14px;
}

.payment-value {
  color: #0f172a;
  font-weight: 500;
  font-size: 14px;
}

.payment-price {
  font-size: 20px;
  font-weight: 700;
  color: #3498db;
}

/* Способы оплаты */
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.payment-method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 2px solid #e8ecf0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
}

.payment-method:hover {
  border-color: #3498db;
  background: #eff6ff;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.payment-method:active {
  transform: scale(0.98);
}

.payment-method-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.payment-method-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.payment-method-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 15px;
}

.payment-method-desc {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.payment-method-arrow {
  color: #94a3b8;
  font-size: 20px;
  transition: transform 0.3s ease;
}

.payment-method:hover .payment-method-arrow {
  transform: translateX(4px);
  color: #3498db;
}

/* Кнопки в модалке оплаты */
.payment-actions {
  display: flex;
  gap: 12px;
}

.payment-actions .btn {
  padding: 14px 24px;
  font-size: 16px;
}

/* ============ БЛОК ЗАГРУЗКИ (СПИННЕР) ============ */
.loading-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
  gap: 16px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e8ecf0;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============ БЛОК РЕКВИЗИТОВ ОПЛАТЫ ============ */
.payment-detail-block {
  background: #f8fafc;
  border: 2px solid #e8ecf0;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.payment-detail-block:hover {
  border-color: #3498db;
  background: #eff6ff;
  transform: translateX(4px);
}

.payment-detail-block:active {
  transform: scale(0.98);
}

.payment-detail-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  color: #64748b;
}

.payment-detail-copy-hint {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
}

.payment-detail-value {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  padding: 4px 0;
  user-select: all;
}

/* Уведомление о копировании */
.payment-copy-notification {
  margin-top: 8px;
  padding: 6px 12px;
  background: #2ecc71;
  color: white;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  animation: copyFadeIn 0.3s ease;
  text-align: center;
}

@keyframes copyFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ КНОПКА TON WALLET ============ */
#tonWalletButton {
  margin-bottom: 16px;
}

#tonWalletButton .btn {
  background: linear-gradient(135deg, #0088cc, #005f8a);
  border: none;
  color: white;
  font-weight: 600;
  padding: 14px;
  font-size: 16px;
  width: 100%;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

#tonWalletButton .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

#tonWalletButton .btn:active {
  transform: scale(0.98);
}

#tonWalletButton .hint {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
}

/* ============ АДМИН-ПАНЕЛЬ ============ */
.admin-panel {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-top: 24px;
}

.admin-panel h2 {
  font-size: 20px;
  color: #2c3e50;
  margin-bottom: 20px;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 14px;
  color: #475569;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
  font-family: inherit;
  background: #fafbfc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #3498db;
  background: white;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============ АДМИН - СПИСОК ТОВАРОВ ============ */
.admin-products-list {
  margin-top: 12px;
}

.admin-products-list .product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-products-list .product-item:last-child {
  border-bottom: none;
}

.product-item .info {
  flex: 1;
  min-width: 150px;
}

.product-item .info .name {
  font-weight: 600;
  color: #0f172a;
}

.product-item .info .details {
  font-size: 13px;
  color: #94a3b8;
}

.product-item .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ АДМИНКА - ПОИСК И ТОВАРЫ ============ */
#adminSearchInput:focus {
  border-color: #3498db;
}

#adminProductsContainer {
  min-height: 100px;
}

.admin-products-list {
  margin-top: 0;
}

#adminProductsToggle .btn {
  min-width: 200px;
}

/* ============ ЗАГРУЗКА КАРТИНОК ============ */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafbfc;
}

.upload-area:hover {
  border-color: #3498db;
  background: #ebf5fb;
}

.upload-area.dragover {
  border-color: #3498db;
  background: #ebf5fb;
}

.upload-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.upload-placeholder p {
  color: #555;
  font-size: 15px;
  margin: 0;
}

.upload-hint {
  font-size: 12px;
  color: #95a5a6;
  display: block;
  margin-top: 4px;
}

/* ============ БЕСКОНЕЧНЫЙ СКРОЛЛ (триггер загрузки) ============ */
.loading-trigger {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 0;
  color: #94a3b8;
  font-size: 14px;
}

.loading-trigger .loading-spinner {
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid #e8ecf0;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== ЛЕНИВАЯ ЗАГРУЗКА КАРТИНОК ===== */
img.lazy {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img.lazy.loaded {
  opacity: 1;
}

img:not([src]) {
  visibility: hidden;
}

/* ============ АДАПТАЦИЯ ============ */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  header {
    padding: 16px;
    flex-direction: column;
    text-align: center;
  }
  
  header h1 {
    font-size: 22px;
  }
  
  .header-buttons {
    width: 100%;
    justify-content: center;
  }
  
  .stats {
    gap: 16px;
    padding: 14px;
    justify-content: center;
  }
  
  .stat-item .number {
    font-size: 20px;
  }
  
  .search-box {
    flex-direction: column;
    padding: 14px;
  }
  
  .search-box input {
    width: 100%;
    min-width: unset;
  }
  
  .search-box button {
    width: 100%;
  }
  
  .sort-wrapper {
    width: 100%;
    min-width: unset;
  }
  
  .sort-wrapper select {
    width: 100%;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }
  
  .product-card {
    padding: 12px;
  }
  
  .product-card .image {
    border-radius: 10px;
  }
  
  .product-card h3 {
    font-size: 14px;
  }
  
  .product-card .price {
    font-size: 17px;
  }
  
  .product-card .price-old {
    font-size: 12px;
  }
  
  .product-info-top {
    gap: 4px;
  }
  
  .labels-inline .label-badge {
    font-size: 8px;
    padding: 1px 6px;
  }
  
  .badge {
    font-size: 9px;
    padding: 2px 8px;
  }
  
  /* Модалки на мобилках */
  .modal-content {
    padding: 20px 16px 20px;
    width: 96%;
    max-height: 85vh;
    border-radius: 20px;
  }
  
  .modal-image {
    border-radius: 12px;
  }
  
  .modal-content h2 {
    font-size: 20px;
  }
  
  .modal-price {
    font-size: 24px;
  }
  
  .modal-price-old {
    font-size: 16px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions .btn {
    width: 100%;
    text-align: center;
  }
  
  .modal-labels .label-badge {
    font-size: 10px;
    padding: 2px 10px;
  }
  
  /* Описание в модалке на мобилках */
  .modal-description p {
    font-size: 14px;
    max-height: calc(1.6em * 9);
  }
  
  .read-more-btn {
    font-size: 13px;
  }
  
  /* Модалка оплаты на мобилках */
  .payment-header h2 {
    font-size: 18px;
  }
  
  .payment-method {
    padding: 12px 14px;
  }
  
  .payment-method-icon {
    font-size: 24px;
    width: 32px;
  }
  
  .payment-actions {
    flex-direction: column;
  }
  
  .payment-actions .btn {
    width: 100%;
    text-align: center;
  }
  
  /* Спиннер на мобилках */
  .loading-spinner {
    width: 40px;
    height: 40px;
  }
  
  .loading-text {
    font-size: 14px;
  }
  
  /* Блок реквизитов на мобилках */
  .payment-detail-value {
    font-size: 15px;
  }
  
  .payment-detail-label {
    font-size: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  
  .payment-detail-copy-hint {
    font-size: 10px;
  }
  
  /* Админка на мобилках */
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .admin-panel {
    padding: 16px;
  }
  
  .admin-products-list .product-item {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .product-item .actions {
    justify-content: center;
  }
  
  /* Загрузка картинок на мобилках */
  .upload-area {
    padding: 20px 15px;
  }
  
  .upload-icon {
    font-size: 30px;
  }
  
  .upload-placeholder p {
    font-size: 13px;
  }
  
  /* Админка - поиск на мобилках */
  #adminSearchInput {
    min-width: unset;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .product-card {
    padding: 10px;
  }
  
  .product-card .image {
    border-radius: 8px;
    margin-bottom: 8px;
  }
  
  .product-card .image .no-image {
    font-size: 30px;
  }
  
  .product-card h3 {
    font-size: 12px;
  }
  
  .product-card .price {
    font-size: 15px;
  }
  
  .product-card .price-old {
    font-size: 11px;
  }
  
  .product-card .description {
    font-size: 11px;
    -webkit-line-clamp: 1;
  }
  
  .categories .category-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .product-info-top {
    gap: 3px;
  }
  
  .labels-inline .label-badge {
    font-size: 7px;
    padding: 1px 4px;
  }
  
  .badge {
    font-size: 8px;
    padding: 1px 6px;
  }
  
  .modal-labels .label-badge {
    font-size: 9px;
    padding: 2px 8px;
  }
  
  .modal-image .no-image {
    font-size: 40px;
  }
  
  /* Описание в модалке на маленьких экранах */
  .modal-description p {
    font-size: 13px;
    max-height: calc(1.5em * 9);
  }
  
  .read-more-btn {
    font-size: 12px;
  }
  
  /* Спиннер на маленьких экранах */
  .loading-spinner {
    width: 30px;
    height: 30px;
    border-width: 3px;
  }
  
  .loading-text {
    font-size: 13px;
  }
  
  /* Модалка оплаты на маленьких экранах */
  .payment-modal .payment-header .payment-icon {
    font-size: 24px;
  }
  
  .payment-modal .payment-header h2 {
    font-size: 16px;
  }
  
  .payment-price {
    font-size: 18px;
  }
  
  .payment-detail-value {
    font-size: 13px;
  }
  
  /* Загрузка картинок на маленьких экранах */
  .upload-area {
    padding: 15px 10px;
  }
  
  .upload-icon {
    font-size: 24px;
  }
  
  .upload-placeholder p {
    font-size: 12px;
  }
  
  .upload-hint {
    font-size: 10px;
  }
  
  /* Админка - кнопки на мобилках */
  #adminProductsToggle .btn {
    min-width: unset;
    width: 100%;
  }
}