/* ===== modals.css — Modals, Cart, Forms, Toast ===== */

.modal-overlay { position: fixed; inset: 0; background: rgba(74,34,58,.5); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 24px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; opacity: 0; visibility: hidden; transition: var(--transition); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-overlay .modal { margin: auto; }
.modal { background: var(--bg-white); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; max-height: calc(100dvh - 40px); overflow-y: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-lg); transform: scale(.95); transition: var(--transition); }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 0; }
.modal-header h3 { font-family: var(--font-heading); font-size: 24px; font-weight: 600; color: var(--text-dark); }
.modal-close { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--bg-light); display: flex; align-items: center; justify-content: center; color: var(--text-medium); cursor: pointer; font-size: 18px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.cart-empty { text-align: center; padding: 40px 0; }
.cart-empty p { color: var(--text-light); margin-bottom: 20px; }
.cart-items { display: flex; flex-direction: column; gap: 16px; }
.cart-item { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg-light); border-radius: var(--radius-md); }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; color: var(--text-dark); margin-bottom: 4px; }
.cart-item-price { color: var(--primary); font-weight: 700; }
.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-top: 1px solid var(--gray-light); font-size: 16px; font-weight: 600; }
.total-price { color: var(--primary); font-size: 20px; font-family: var(--font-heading); }

.order-modal { max-width: 560px; }
.order-form { display: flex; flex-direction: column; gap: 16px; }
.order-form-group { display: flex; flex-direction: column; gap: 6px; }
.order-form-label { font-size: 12px; font-weight: 600; color: var(--text-medium); text-transform: uppercase; letter-spacing: .5px; }
.order-form-input, .order-form-select, .order-form-textarea {
  padding: 12px 14px; border: 1px solid var(--gray-medium); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; color: var(--text-dark); transition: var(--transition); background: var(--bg-white); width: 100%;
}
.order-form-input:focus, .order-form-select:focus, .order-form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(194,24,122,.1);
}
.order-form-textarea { min-height: 80px; resize: vertical; }
.order-form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B3D5A' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.order-summary { background: var(--bg-light); border-radius: var(--radius-md); padding: 16px; margin-bottom: 8px; }
.order-summary-title { font-size: 14px; font-weight: 600; color: var(--text-dark); margin-bottom: 12px; }
.order-summary-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gray-light); font-size: 14px; }
.order-summary-item:last-child { border-bottom: none; }
.order-summary-name { color: var(--text-dark); font-weight: 500; }
.order-summary-qty { color: var(--text-light); font-size: 12px; margin-left: 6px; }
.order-summary-price { color: var(--primary); font-weight: 600; }
.order-summary-total { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; margin-top: 8px; border-top: 2px solid var(--gray-medium); font-weight: 700; font-size: 16px; }
.order-summary-total .total-label { color: var(--text-dark); }
.order-summary-total .total-value { color: var(--primary); font-family: var(--font-heading); font-size: 20px; }

.order-error { color: var(--danger); font-size: 13px; padding: 10px 14px; background: #FFEBEE; border-radius: var(--radius-sm); display: none; }
.order-error.visible { display: block; }

.order-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.order-actions .btn { flex: 1; min-width: 140px; }

.success-modal .modal { text-align: center; padding-bottom: 24px; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--success); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto 16px; }
.success-title { font-family: var(--font-heading); font-size: 28px; font-weight: 600; color: var(--text-dark); margin-bottom: 8px; }
.success-text { font-size: 15px; color: var(--text-light); margin-bottom: 24px; line-height: 1.6; }

.orders-table-wrapper { background: var(--bg-white); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.orders-toolbar { padding: 16px; display: flex; gap: 12px; border-bottom: 1px solid var(--gray-light); flex-wrap: wrap; }
.orders-filter { padding: 8px 12px; border: 1px solid var(--gray-medium); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: var(--bg-white); cursor: pointer; }

.orders-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.orders-table th { background: var(--bg-light); padding: 12px 16px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); border-bottom: 1px solid var(--gray-light); }
.orders-table td { padding: 14px 16px; border-bottom: 1px solid var(--gray-light); vertical-align: top; }
.orders-table tr:hover { background: var(--bg-light); }
.orders-table tr:last-child td { border-bottom: none; }

.order-id { font-family: monospace; font-size: 12px; color: var(--text-light); }
.order-customer { font-weight: 600; color: var(--text-dark); }
.order-phone { font-size: 13px; color: var(--text-medium); }
.order-items { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.order-total { font-weight: 700; color: var(--primary); font-size: 15px; }
.order-date { font-size: 12px; color: var(--text-light); white-space: nowrap; }

.status-select { padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--gray-medium); font-size: 13px; font-family: inherit; background: var(--bg-white); cursor: pointer; transition: var(--transition); }
.status-select:focus { outline: none; border-color: var(--primary); }
.status-select.status-new { background: #FFF3E0; color: #E65100; border-color: #FFE0B2; }
.status-select.status-processing { background: #E3F2FD; color: #1565C0; border-color: #BBDEFB; }
.status-select.status-completed { background: #E8F5E9; color: #2E7D32; border-color: #C8E6C9; }
.status-select.status-cancelled { background: #FFEBEE; color: #C62828; border-color: #FFCDD2; }



/* Notification badge */
.nav-badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }




/* Product description */
.product-desc {
  font-size: 13px;
  color: var(--text-light);
  margin: 4px 0 8px;
  line-height: 1.4;
}

.cart-item-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-item-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--gray-medium);
  background: var(--bg-white);
  color: var(--text-medium);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.cart-item-qty-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cart-item-qty {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  min-width: 20px;
  text-align: center;
}

.cart-item-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: #FFEBEE;
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin-left: 8px;
}

.cart-item-remove:hover {
  background: var(--danger);
  color: #fff;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  animation: toastSlideIn .3s ease, toastFadeOut .3s ease 2.7s forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* Cart badge bounce animation */
@keyframes badgeBounce {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
}

.cart-count.bounce {
  animation: badgeBounce .4s ease;
}

.cart-empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
  opacity: .6;
}

/* ===== Модалка напоминаний v2 ===== */
.modal-birthday { max-width: 480px; }

.birthday-intro {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
  line-height: 1.55;
}

/* Индикатор шагов (1 Телефон → 2 Праздники → 3 Telegram) */
.bday-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: var(--bg-light);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-md);
}

.bday-step-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-medium);
  white-space: nowrap;
}

.bday-chip-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(194, 24, 122, .3);
}

.bday-step-line {
  flex: 1;
  height: 1px;
  background: var(--gray-medium);
}

/* Секции */
.bday-section {
  background: var(--bg-light);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.bday-section-head { margin-bottom: 10px; }

.bday-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.bday-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
  line-height: 1.45;
}

/* Телефон */
#userPhone {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-medium);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-dark);
  background: var(--bg-white);
}

#userPhone:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 24, 122, .12);
}

/* Добавить праздник */
.bday-add {
  width: 100%;
  border-style: dashed;
  padding: 10px;
  margin-top: 4px;
}

/* Telegram: статус */
/* Сохранить */
.bday-save {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

/* Статус привязки Telegram */
.tg-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.tg-status-pending { background: var(--gray-light); color: var(--text-medium); }
.tg-status-pending .tg-status-dot { background: var(--gray-medium); }

.tg-status-linked { background: #E8F5E9; color: #2E7D32; }
.tg-status-linked .tg-status-dot { background: var(--success); box-shadow: 0 0 0 3px rgba(76,175,80,.2); }

.tg-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Строка праздника в модалке */
.reminder-row {
  background: var(--bg-white);
  padding: 12px 14px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-medium);
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Шапка строки: название + аккуратный крестик справа */
.reminder-row-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.reminder-row-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.reminder-row .remove-row {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--gray-light);
  color: var(--text-light);
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.reminder-row .remove-row:hover {
  background: #ff4d4d;
  color: #fff;
}

.reminder-row .form-group label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.reminder-row select,
.reminder-row input[type="text"],
.reminder-row input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-medium);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-white);
  color: var(--text-dark);
}

.reminder-row .form-group:last-child { grid-column: span 2; }

/* Подсказка в пустом поле даты (Chromium / Android Chrome) */
.reminder-row input[type="date"]:invalid { color: var(--text-light); }
.reminder-row input[type="date"]:invalid:not(:focus)::before {
  content: 'Выберите дату';
  color: var(--text-light);
  font-size: 13px;
}

/* ===== Мобильная компактность модалки напоминаний =====
   Модалка должна помещаться на экран телефона без прокрутки */
@media (max-width: 480px) {
  .modal-overlay { padding: 12px; }
  .modal-header { padding: 18px 18px 0; }
  .modal-header h3 { font-size: 20px; }
  .modal-body { padding: 16px 18px; }

  .birthday-intro { font-size: 12px; margin-bottom: 12px; }
  .bday-steps { padding: 8px 10px; margin-bottom: 14px; gap: 6px; }
  .bday-step-chip { font-size: 11px; gap: 5px; }
  .bday-section { padding: 12px; margin-bottom: 10px; }
  .bday-section-title { font-size: 13px; }
  .bday-hint { font-size: 11px; }

  .reminder-row { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
  .reminder-row .form-group:last-child { grid-column: auto; }
}
/* ============================================================
   Product Detail Modal — v2 redesign
   Двухколоночный лейаут на десктопе, стек на мобильных.
   ============================================================ */
.modal-overlay.product-detail-modal .modal { max-width: 780px; }
.product-detail-modal .modal-header { justify-content: flex-end; padding: 20px 20px 0; }
.product-detail-modal .modal-header h3 { display: none; }

.product-detail-modal .modal-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 18px 20px 24px;
}

.product-detail-modal .product-detail-image {
  position: relative;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--secondary) 0%, var(--bg-light) 100%);
  overflow: hidden;
  margin-bottom: 0;
}
.product-detail-modal .product-detail-image img { width: 100%; height: 100%; object-fit: cover; }

.product-detail-modal .product-detail-info { display: flex; flex-direction: column; min-width: 0; }

.product-detail-modal .product-category {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--secondary);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}
.product-detail-modal .product-detail-name { font-size: 26px; line-height: 1.25; margin-bottom: 10px; }
.product-detail-modal .product-detail-desc { color: var(--text-medium); line-height: 1.6; margin-bottom: 16px; }
.product-detail-modal .product-detail-price { font-size: 28px; margin-bottom: 18px; }

.product-detail-modal .product-detail-actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.product-detail-modal .qty-selector { border-radius: 99px; border-color: rgba(194, 24, 122, .25); }
.product-detail-modal .qty-btn { border-radius: 99px; width: 38px; height: 38px; }
.product-detail-modal .qty-value { font-weight: 700; min-width: 26px; text-align: center; }

@media (min-width: 620px) {
  .product-detail-modal .modal-body { grid-template-columns: 1.05fr 1fr; gap: 26px; padding: 24px 26px 28px; }
  .product-detail-modal .product-detail-image { min-height: 400px; height: 100%; }
}

@media (max-width: 619px) {
  .product-detail-modal .product-detail-image { height: 240px; }
  .product-detail-modal .product-detail-actions .btn { width: 100%; }
}

/* --- Цена в модалке: крупная цифра + пилюля BYN + формула при кол-ве >1 --- */
.product-detail-modal .product-detail-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-size: 0;
  margin-bottom: 18px;
}
.product-detail-modal .price-num { font-size: 34px; font-weight: 800; color: var(--text-dark); line-height: 1; }
.product-detail-modal .price-cur {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary-dark); background: var(--secondary);
  padding: 5px 12px; border-radius: 99px;
}
.product-detail-modal .price-formula { display: block; width: 100%; font-size: 12px; color: var(--text-medium); margin-top: 6px; }

/* ============================================================
   Увеличение фото товара — кнопка-пилюля + лайтбокс
   ============================================================ */
.product-detail-modal .product-detail-image { cursor: zoom-in; }

.detail-zoom-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  border: none;
  cursor: zoom-in;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(74, 34, 58, .22), inset 0 0 0 1px rgba(255,255,255,.5);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  white-space: nowrap;
  transition: transform .2s, background .2s, box-shadow .2s;
}
.detail-zoom-btn .zoom-icon { font-size: 14px; line-height: 1; }
.detail-zoom-btn:hover { transform: scale(1.06); background: rgba(255,255,255,.95); box-shadow: 0 6px 18px rgba(194,24,122,.3); }
.detail-zoom-btn:active { transform: scale(.94); }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(16, 7, 12, .88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.lightbox-overlay.active { display: flex; animation: lightboxIn .25s ease; }
@keyframes lightboxIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  transform-origin: center center;
  will-change: transform;
  cursor: zoom-out;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .25s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); transform: rotate(90deg); }

.lightbox-hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .8);
  font-size: 12px;
  letter-spacing: .2px;
  line-height: 1.45;
  text-align: center;
  max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, .12);
  padding: 9px 16px;
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.lightbox-hint.show { opacity: 1; }
