* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--tg-theme-bg-color, #f5f5f5);
  color: var(--tg-theme-text-color, #111);
  padding: 12px;
  padding-bottom: 84px;
}

#loading {
  text-align: center;
  padding: 40px 0;
  opacity: 0.6;
}

.view[hidden] {
  display: none;
}

/* --- Список --- */

.gift-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gift-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--tg-theme-secondary-bg-color, #fff);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.gift-row .thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #eee;
  flex-shrink: 0;
}

.gift-row .thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #eee;
  flex-shrink: 0;
}

.gift-row .title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-row .price {
  font-weight: 600;
  font-size: 14px;
  color: var(--tg-theme-link-color, #2481cc);
  flex-shrink: 0;
}

/* --- Кнопка добавления (FAB) --- */

.fab {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: calc(100% - 24px);
}

/* --- Экран деталей / экран добавления --- */

.detail-view,
.add-gift-form {
  background: var(--tg-theme-secondary-bg-color, #fff);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.back-btn {
  align-self: flex-start;
  background: none;
  padding: 4px 0;
  font-size: 14px;
  color: var(--tg-theme-link-color, #2481cc);
}

#detail-photo {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
  background: #eee;
}

.detail-view h2 {
  margin: 0;
  font-size: 19px;
}

.detail-view .price {
  font-weight: 600;
  color: var(--tg-theme-link-color, #2481cc);
}

.description {
  font-size: 14px;
  opacity: 0.85;
  white-space: pre-wrap;
}

a.link {
  font-size: 14px;
  color: var(--tg-theme-link-color, #2481cc);
}

.actions {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button, .badge {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

button.primary {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
}

button.danger {
  background: #e53935;
  color: #fff;
}

button.secondary {
  background: #e0e0e0;
  color: #333;
}

.badge {
  background: #ddd;
  color: #666;
  cursor: default;
}

.badge.reserved-by-me {
  background: #c8e6c9;
  color: #2e7d32;
}

.badge.no-reservation {
  background: #fff3cd;
  color: #8a6500;
}

/* --- Форма добавления --- */

.add-gift-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.add-gift-form label.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.add-gift-form input,
.add-gift-form textarea {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.add-gift-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

#add-gift-status {
  font-size: 13px;
  opacity: 0.8;
}
