/* ═══════════════════════════════════════════════════════════
   POLISH.CSS - Premium finishing touches
   Тонкие детали, улучшения без ломки существующего
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   1. SCROLLBAR - минималистичный премиум
   ═══════════════════════════════════════════════════════════ */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

body.light-theme * {
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
  background-clip: padding-box;
}

body.light-theme ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  background-clip: padding-box;
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
  background-clip: padding-box;
}

/* ═══════════════════════════════════════════════════════════
   2. SCROLL PROGRESS BAR - тонкая линия сверху
   ═══════════════════════════════════════════════════════════ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--text-primary, #fff),
    var(--text-primary, #fff),
    transparent);
  width: 0%;
  z-index: 1000;
  pointer-events: none;
  transition: width 0.08s ease-out;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

body.light-theme .scroll-progress {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════════════════
   3. NAV GLASS ENHANCEMENT - чуть ярче blur
   ═══════════════════════════════════════════════════════════ */

/* Убрали backdrop-filter отсюда, чтобы не перезаписывать полупрозрачность из index.html */

nav.scrolled {
  /* Дополнительный эффект при скролле */
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

/* Тонкая линия под nav при скролле */
nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.08) 20%,
    rgba(255, 255, 255, 0.08) 80%,
    transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

nav.scrolled::after {
  opacity: 1;
}

body.light-theme nav::after {
  background: linear-gradient(90deg,
    transparent,
    rgba(0, 0, 0, 0.08) 20%,
    rgba(0, 0, 0, 0.08) 80%,
    transparent);
}

/* ═══════════════════════════════════════════════════════════
   4. SMOOTH IMAGE LOADING
   ═══════════════════════════════════════════════════════════ */

img {
  opacity: 0;
  animation: image-fade-in 0.6s ease-out forwards;
}

img[loading="eager"],
.no-fade {
  animation: none;
  opacity: 1;
}

@keyframes image-fade-in {
  to { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   5. BUTTON FINISHING TOUCH
   Добавляем чуть более яркий активный state
   ═══════════════════════════════════════════════════════════ */

/* Более плавная реакция на hover для всех интерактивных */
.btn-submit,
.btn-buy,
.btn-card,
.theme-toggle,
.back {
  will-change: transform, box-shadow;
}

/* ═══════════════════════════════════════════════════════════
   6. SECTION DIVIDER - красивые разделители
   Класс .divider для тонкой градиентной линии
   ═══════════════════════════════════════════════════════════ */

.divider {
  height: 1px;
  border: none;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent);
  margin: 2rem 0;
}

body.light-theme .divider {
  background: linear-gradient(90deg,
    transparent,
    rgba(0, 0, 0, 0.1),
    transparent);
}

/* ═══════════════════════════════════════════════════════════
   7. TEXT BALANCE - более красивое распределение текста
   ═══════════════════════════════════════════════════════════ */

h1, h2, h3, h4 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* ═══════════════════════════════════════════════════════════
   8. FOOTER POLISH
   ═══════════════════════════════════════════════════════════ */

footer {
  position: relative;
  opacity: 0.75;
  transition: opacity 0.3s ease;
  font-size: 0.65rem !important;
  padding: 3rem 1.5rem 2.5rem !important;
  width: 100%;
}

footer:hover {
  opacity: 1;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.08) 15%, 
    rgba(255, 255, 255, 0.08) 85%, 
    transparent 100%
  );
}

body.light-theme footer::before {
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(0, 0, 0, 0.25) 15%, 
    rgba(0, 0, 0, 0.25) 85%, 
    transparent 100%
  );
}

footer a,
footer span {
  font-size: 0.65rem !important;
}

@media (max-width: 768px) {
  footer {
    font-size: 0.58rem !important;
    padding: 2rem 1rem 1.5rem !important;
  }
  footer a,
  footer span {
    font-size: 0.58rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   9. LINK STYLES - unified hover for text links
   ═══════════════════════════════════════════════════════════ */

a:not(.nav-logo):not(.back):not(.btn):not(.btn-buy):not(.btn-submit):not(.btn-card):not(nav a) {
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════
   10. LOADING SPINNER - красивый
   ═══════════════════════════════════════════════════════════ */

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--text-primary, #fff);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   11. HERO SECTION ENHANCEMENTS
   ═══════════════════════════════════════════════════════════ */

.hero h1 {
  /* Улучшенный letter-spacing для крупных заголовков */
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════
   12. CARD HOVER - ultra smooth
   ═══════════════════════════════════════════════════════════ */

.card,
.info-block,
.sub-block {
  /* Принудительно включаем GPU acceleration */
  will-change: transform, box-shadow, background;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ═══════════════════════════════════════════════════════════
   13. INPUT / TEXTAREA - плавный focus ring
   ═══════════════════════════════════════════════════════════ */

input:focus,
textarea:focus,
select:focus {
  transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              background-color 0.3s ease !important;
}

/* ═══════════════════════════════════════════════════════════
   14. SUBTLE GRAIN OVERLAY - едва заметное зерно
   Добавляет премиальный "filmic" look
   ═══════════════════════════════════════════════════════════ */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.03;
  mix-blend-mode: overlay;
}

body.light-theme::before {
  opacity: 0.02;
}

/* ═══════════════════════════════════════════════════════════
   15. SMOOTH TRANSITIONS для всех переходных элементов
   ═══════════════════════════════════════════════════════════ */

.nav-links a:not(.nav-logo),
.back,
.footer-link a {
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease !important;
}

/* ═══════════════════════════════════════════════════════════
   16. HERO BADGE - тонкая пульсация
   ═══════════════════════════════════════════════════════════ */

.hero-badge {
  position: relative;
}

.hero-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: badge-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   17. TEXT CURSOR на интерактивных элементах где нужно
   ═══════════════════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
  cursor: text;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════
   18. MOBILE OPTIMIZATIONS - отключаем тяжёлые эффекты
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  body::before {
    display: none; /* убираем grain на мобильных для FPS */
  }
  
  .scroll-progress {
    display: none; /* progress bar не нужен на мобилах */
  }
}

/* ═══════════════════════════════════════════════════════════
   19. PRINT STYLES (на всякий случай)
   ═══════════════════════════════════════════════════════════ */

@media print {
  nav, footer, #bg, .scroll-progress, .ui-toast, body::before {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   20. SMOOTH REVEAL для hero элементов
   ═══════════════════════════════════════════════════════════ */

.hero h1 {
  animation: hero-text-in 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-sub,
.hero p,
.hero-badge {
  animation: hero-sub-in 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero .btn-buy,
.hero button {
  animation: hero-sub-in 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

@keyframes hero-text-in {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes hero-sub-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════
   21. FOOTER SINGLE LINE SEPARATORS
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  .footer-separator {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   22. LIGHT THEME ENHANCEMENTS & BORDERS
   ═══════════════════════════════════════════════════════════ */

/* Карточки, блоки и панели - обводка для видимости */
body.light-theme .card,
body.light-theme .feature-block,
body.light-theme .form-box,
body.light-theme .info-block,
body.light-theme .sub-block,
body.light-theme .account-card,
body.light-theme .modal-content,
body.light-theme .status-card,
body.light-theme .news-card {
    border: 1px solid rgba(0, 0, 0, 0.25) !important;
    background: #ffffff !important;
}

/* Навбар - тонкая линия снизу */
body.light-theme nav {
    border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
    background: rgba(248, 248, 248, 0.95) !important;
}

/* Поля ввода - видимые границы */
body.light-theme .field input,
body.light-theme input[type="text"],
body.light-theme input[type="password"],
body.light-theme input[type="email"] {
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    background: #f4f4f4 !important;
    color: #111 !important;
}

body.light-theme .field input:focus,
body.light-theme input:focus {
    border: 1px solid rgba(0, 0, 0, 0.4) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

/* Футер копирайт и ссылки - делаем текст темным */
body.light-theme footer,
body.light-theme footer span,
body.light-theme footer a,
body.light-theme footer span[data-i18n="footer"] {
    color: #222 !important;
}

body.light-theme .footer-separator {
    color: #222 !important;
    opacity: 0.3 !important;
}

/* ═══════════════════════════════════════════════════════════
   23. GLOBAL PANEL SHADOWS (ALL THEMES)
   ═══════════════════════════════════════════════════════════ */

/* Тени для всех панелей в тёмной теме */
.card,
.feature-block,
.form-box,
.info-block,
.sub-block,
.account-card,
.modal-content,
.status-card,
.news-card {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 255, 255, 0.015) !important;
}

/* Ещё более глубокие тени для светлой темы */
body.light-theme .card,
body.light-theme .feature-block,
body.light-theme .form-box,
body.light-theme .info-block,
body.light-theme .sub-block,
body.light-theme .account-card,
body.light-theme .modal-content,
body.light-theme .status-card,
body.light-theme .news-card {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}
