@import url('variables.css');

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

a:hover { color: var(--primary); }

ul, ol { list-style: none; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  transition: var(--transition);
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Notification */
.notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--secondary);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  pointer-events: none;
}

.notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Scroll top */
.scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(231,76,60,0.4);
  z-index: 999;
}

.scroll-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

.scroll-top.visible {
  display: flex;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(2px);
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Badge animation */
.action-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
  border: 2px solid var(--bg-white);
  z-index: 5;
}

.action-badge.visible { display: flex; }

.action-badge.bounce {
  animation: bounce 0.4s ease;
}

@keyframes bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); }
  50% { transform: scale(0.9); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active { display: flex; }

.modal__content {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__icon {
  width: 64px;
  height: 64px;
  background: #fff3e0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: var(--warning);
}

.modal__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal__text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal__btn {
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.modal__btn--cancel {
  background: var(--bg-gray);
  color: var(--text-secondary);
}

.modal__btn--cancel:hover { background: #e0e0e0; }

.modal__btn--confirm {
  background: var(--primary);
  color: #fff;
}

.modal__btn--confirm:hover { background: var(--primary-dark); }

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  font-size: 15px;
  color: var(--text-muted);
}

.loading--vertical {
  flex-direction: column;
  gap: 16px;
}

/* ==========================================
   ЗАГРУЗЧИКИ И СКЕЛЕТОНЫ
   ========================================== */

/* 1. Полноэкранный лоадер (перекрывает всё) */
.page-loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: loaderFadeIn 0.2s ease;
}

@keyframes loaderFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-loader__spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loaderSpin 0.8s linear infinite;
}

@keyframes loaderSpin {
  to { transform: rotate(360deg); }
}

.page-loader__text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

/* 2. Скелетон для карточек товаров */
.skeleton-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-gray) 0%,
    #eef2f5 50%,
    var(--bg-gray) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
}

.skeleton-card__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
}

.skeleton-line--sm { width: 40%; height: 10px; }
.skeleton-line--md { width: 80%; }
.skeleton-line--lg { width: 60%; height: 20px; }
.skeleton-line--btn { width: 100%; height: 38px; border-radius: var(--radius-sm); margin-top: auto; }

/* 3. Инлайн-лоадер (для таблиц, блоков) */
.inline-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
  width: 100%;
}

.inline-loader i {
  font-size: 28px;
  color: var(--primary);
}