/* Основные стили, гамма цветов по ТЗ */
:root{
  --navy:#2F3E56;
  --navy-dark:#223045;
  --muted:#5B6C82;
  --bg:#F2F2F2;
  --bg-top:#f7f7f8; /* верхний цвет градиента (добавлено) */
  --card:#D6D1CC;
  --text:#1F2933;
  --white:#fff;
  --collection-height:460px; /* синхронизированная высота */
  --collection-max-width:860px; /* централизованная ширина коллекции и рейтинга */
  --product-photo-height:320px; /* высота миниатюры товара; модал будет пропорционален */
}
*{box-sizing:border-box;font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;}
body{margin:0;background:var(--bg-top);color:var(--text);} /* делаем фон однотонным верхним цветом, чтобы блоки совпадали */
.container{max-width:1180px;margin:0 auto;padding:24px;}
.site-header{background:transparent;padding:16px 0;}
.site-header .container{display:flex;align-items:center;gap:16px}
.logo{font-weight:800;color:var(--navy);font-size:24px}
.main-nav{margin-left:24px;flex:1}
.main-nav a{margin:0 10px;color:var(--muted);text-decoration:none}
.user-info{color:var(--muted);font-weight:600;display:flex;flex-direction:column;align-items:flex-end}
.user-name{font-weight:700;color:var(--navy)}
.user-balance{color:var(--muted);font-size:13px;display:flex;align-items:center;gap:8px}

/* yun-icon - иконка ЮБ */
.yun-icon{height:22px; width:auto; display:inline-block; vertical-align:middle}
.yun-icon.small-coin{height:16px}
.balance-number{font-weight:800;color:var(--navy);font-size:18px}

/* Header */
.site-header{
  /* Сделана контрастной: белый фон, мягкая тень и высок z-index, остаётся sticky */
  background: var(--white);
  position: sticky;
  top:0;
  z-index:1000;
  box-shadow: 0 6px 20px rgba(15,22,33,0.08);
  padding: 10px 0;
}
.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:18px 0;
}
.logo{
  font-weight:700;
  color:var(--navy);
  font-size:22px;
}
.nav a{
  margin:0 10px;
  color:var(--blue-gray);
  text-decoration:none;
  font-weight:600;
}
.profile{color:var(--navy-dark); font-weight:600}

/* Hero */
.hero{display:flex;gap:24px;align-items:center;padding:20px 0 0} /* убираем нижний отступ, чтобы collection прилегала */
.hero-left{flex:1}
.hero-left h1{font-size:40px;margin:0 0 12px;color:var(--navy)}
.hero-left .lead{color:var(--muted);margin-bottom:20px}
.btn{display:inline-block;padding:12px 18px;border-radius:10px;text-decoration:none;box-shadow:0 6px 18px rgba(0,0,0,0.06)}
.btn.primary{background:var(--navy);color:var(--white)}
.btn.outline{background:transparent;border:1px solid var(--navy);color:var(--navy);padding:10px 14px}

.hero-right{width:auto}
.hero-banner{width:100%;height:220px;border-radius:16px;background-size:cover;background-position:center;box-shadow:0 10px 30px rgba(0,0,0,0.08)}

/* Two-col removed - rating now under collection */

.balance-card{background:var(--bg-top);padding:18px;border-radius:16px;box-shadow:0 10px 30px rgba(0,0,0,0.06)} /* фон карточки баланса теперь совпадает */
.balance-top{font-size:20px;font-weight:700;color:var(--navy);display:flex;align-items:center;gap:8px}
.balance-amount{font-size:24px}
.balance-sub{color:var(--muted);margin:6px 0 12px}
.rating-title{margin:12px 0}
.top-list{list-style:none;padding:0;margin:0}
.top-item{display:flex;align-items:center;justify-content:space-between;padding:8px;border-radius:10px;margin-bottom:8px;background:var(--bg-top)} /* фон топ-элемента */
.top-item.current{background:var(--bg-top);border:1px solid rgba(34,48,69,0.08);}
.top-item .place{width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;margin-right:10px;background:#efeef2}
.top-item:nth-child(1) .place{background:gold}
.top-item:nth-child(2) .place{background:silver}
.top-item:nth-child(3) .place{background:#cd7f32}

/* Collection now full-width within container */
.collection-full{
  /* делаем полосу на всю ширину окна (full-bleed) */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: var(--bg-top); /* использовать верхний цвет градиента */
  padding: 12px 0; /* вертикальные отступы, чтобы было воздухно */
  padding-top:12px;
  margin-top: 0; /* не тянуть вверх, чтобы не создавать artefacts */
  display:flex;
  justify-content:center;
}
/* картинка должна умещаться полностью и не обрезаться; если она уже меньше ширины — по бокам будет фон */
.collection-img{
  width: auto;           /* не растягиваем по ширине искусственно */
  max-width: 100%;       /* не превышать область */
  height: auto;
  object-fit: contain;   /* показываем всю картинку без обрезки */
  max-height: 72vh;      /* ограничиваем высоту окна, чтобы не выходила за рамки */
  margin: 0; /* гарантируем отсутствие внешних отступов */
  display:block;
}


/* Products grid */
.products-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:20px; margin:20px 0; }
.product-card{ display:flex; flex-direction:column; background:var(--bg-top); border-radius:12px; padding:8px; box-shadow:0 8px 20px rgba(0,0,0,0.04)} /* фон карточек теперь совпадает с верхом */
.product-photo{ height:var(--product-photo-height); background-size:cover; background-position:center; border-radius:12px; overflow:hidden }
.product-img{ width:100%; height:100%; object-fit:cover; display:block }
.product-body{ display:flex; flex-direction:column; flex:1 }
.product-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:auto; }
.price{ font-weight:800; color:var(--navy-dark); }

/* Product photo slider (catalog) */
.product-photo-slider{ position:relative; width:100%; height:var(--product-photo-height); border-radius:12px; overflow:hidden; background:var(--bg-top) } /* фон слайдера */
.product-photo-slider .slide{ width:100%; height:100%; background-size:cover; background-position:center; position:absolute; top:0; left:0 }
.product-photo-slider .slide-prev, .product-photo-slider .slide-next{ position:absolute; top:50%; transform:translateY(-50%); width:36px; height:36px; border-radius:50%; border:none; background:rgba(255,255,255,0.9); box-shadow:0 6px 18px rgba(0,0,0,0.08); cursor:pointer; font-size:18px }
.product-photo-slider .slide-prev{ left:10px }
.product-photo-slider .slide-next{ right:10px }

/* Cart table */
.cart-table{ width:100%; border-collapse:collapse; margin-bottom:18px; }
.cart-table th, .cart-table td{ padding:12px; text-align:left; border-bottom:1px solid #eee; }
.cart-product{ display:flex; gap:12px; align-items:center; }

/* Удалён лишний дубликат :root - переменные объявлены в начале файла */

.side-stack{display:flex;flex-direction:column;gap:16px;height:var(--collection-height)}
.btn.full-width{width:100%;display:inline-flex;align-items:center;justify-content:center}

/* Помещаем balance-card внизу side-stack */
.side-stack .balance-card{margin-top:auto}

/* Thumb в корзине */
.thumb{width:80px;height:80px;background-size:cover;background-position:center;border-radius:10px}
.thumb-img{ width:100px; height:100px; object-fit:cover; border-radius:10px }

/* Ограничиваю ширину изображения коллекции и делаю рейтинговый блок той же ширины */
.rating-section{display:flex;justify-content:center;margin-top:20px}
.rating-wrapper{width:100%;max-width:var(--collection-max-width);margin:0 auto}
.rating-wrapper .balance-card{width:100%}

/* Добавляю стили для модального окна предпросмотра изображений */
.img-modal{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(15,22,33,0.6); opacity:0; pointer-events:none; transition:opacity .2s ease }
.img-modal.open{ opacity:1; pointer-events:auto }
.img-modal-content{ max-width:90vw; max-height:90vh; background:transparent; padding:10px; border-radius:10px; display:flex; align-items:center; justify-content:center; position:relative }
.img-modal-img{ max-width:100%; max-height: min(90vh, calc(var(--product-photo-height) * 2.8)); box-shadow:0 10px 30px rgba(0,0,0,0.5); border-radius:8px }
.img-modal-close{ position:absolute; top:20px; right:20px; z-index:1001; background:rgba(255,255,255,0.95); border:none; width:44px; height:44px; border-radius:50%; font-size:22px; cursor:pointer; box-shadow:0 6px 18px rgba(0,0,0,0.2) }

/* Prev/Next buttons inside modal */
.img-modal-prev, .img-modal-next{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:56px;
  height:56px;
  border-radius:50%;
  border:none;
  background:rgba(255,255,255,0.95);
  box-shadow:0 8px 20px rgba(0,0,0,0.25);
  font-size:28px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  z-index:1001;
}
.img-modal-prev{ left:16px }
.img-modal-next{ right:16px }
.img-modal-prev:focus, .img-modal-next:focus, .img-modal-close:focus{ outline:2px solid rgba(47,62,86,0.12) }

/* animation for staggered reveal from top */
.animate-item{opacity:0;transform:translateY(-12px);will-change:opacity,transform;transition:opacity .48s cubic-bezier(.2,.9,.2,1), transform .48s cubic-bezier(.2,.9,.2,1)}
.animate-item.in{opacity:1;transform:translateY(0)}
/* helper: when nested elements also animate, increase the cascade */
.animate-item.delay-1{transition-delay:0.06s}
.animate-item.delay-2{transition-delay:0.12s}
.animate-item.delay-3{transition-delay:0.18s}
.animate-item.delay-4{transition-delay:0.24s}
.animate-item.delay-5{transition-delay:0.30s}

/* ensure user-menu visible when .open class is present */
.user-menu.open{opacity:1;transform:translateY(0);pointer-events:auto}

/* touch-friendly: on small screens show menu full width */
@media(max-width:600px){
  .user-menu{right:8px;left:8px;min-width:auto}
}

@media(max-width:900px){
  .hero{flex-direction:column}
  .hero-right{width:100%}
  .two-column{flex-direction:column}
  .col.left{width:100%}
  .side-stack{height:auto} /* на мобильных делаем auto */
}

.muted{ color:var(--blue-gray) }
.small{ font-size:13px }

/* конец файла */

/* Modal for users list */
.users-modal{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(15,22,33,0.45); opacity:0; pointer-events:none; transition:opacity .18s ease; z-index:1500 }
.users-modal[aria-hidden="false"]{ opacity:1; pointer-events:auto }
.users-modal-content{ width:90%; max-width:720px; background:var(--white); padding:20px; border-radius:12px; box-shadow:0 12px 40px rgba(15,22,33,0.12); position:relative }
.users-modal-close{ position:absolute; top:12px; right:12px; background:transparent;border:none;font-size:20px;cursor:pointer }
.all-users-list{ list-style:none;margin:12px 0 0;padding:0; max-height:60vh; overflow:auto }
.all-user-item{ padding:10px;border-bottom:1px solid #f1f1f2 }
.all-user-item.current{ background:linear-gradient(90deg, rgba(47,62,86,0.04), rgba(47,62,86,0.02)); border-left:3px solid var(--navy); padding-left:8px }

/* User dropdown: скрываем ссылку "Выйти" пока не наведён курсор на имя, и удерживаем при наведении на саму ссылку */
.user-dropdown{ position: relative; display: inline-block; }
.user-dropdown .user-name{ cursor:default; }
.user-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: transparent; /* фон для самой ссылки задаём на элементе .user-menu-item */
  padding: 0;
  margin: 0;
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none; /* блокирует клики, когда скрыто */
  z-index: 1200;
  white-space: nowrap;
}

/* Отображаем меню при наведении на имя (через общий контейнер) или при наведении на само меню */
.user-dropdown:hover .user-menu,
.user-menu:hover,
.user-dropdown:focus-within .user-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Стиль для пункта меню: делаем заметным и кликабельным */
.user-menu .user-menu-item{
  display: inline-block;
  padding: 8px 10px;
  margin: 0;
  color: var(--navy);
  background: var(--white);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

/* Сохранение обратной совместимости: класс .user-menu.open должен по-прежнему показывать меню */
.user-menu.open{ opacity:1; transform:translateY(0); pointer-events:auto; visibility:visible }
