/* ==========================================
   AnotherLine.Music — Components (Design System)
   Единые стили для кнопок, скелетонов, тостов,
   пустых состояний, модалок, якорей.
   v1.0 – 22 февраля 2026
   ========================================== */

/* ==========================================
   0. TOKENS (добавляем к уже существующим :root)
   ========================================== */
:root {
  /* цвета */
  --al-primary:       #00B0B9;
  --al-primary-light: #00ffff;
  --al-primary-10:    rgba(0, 176, 185, 0.10);
  --al-primary-20:    rgba(0, 176, 185, 0.20);
  --al-danger:        #ef4444;
  --al-danger-10:     rgba(239, 68, 68, 0.10);
  --al-success:       #22c55e;
  --al-success-10:    rgba(34, 197, 94, 0.10);
  --al-warning:       #f59e0b;
  --al-warning-10:    rgba(245, 158, 11, 0.10);
  --al-bg-dark:       #0a0a0a;
  --al-bg-card:       #141414;
  --al-text:          #ffffff;
  --al-text-muted:    #888888;
  --al-border:        rgba(255, 255, 255, 0.12);
  --al-border-hover:  rgba(255, 255, 255, 0.22);

  /* радиусы */
  --al-radius-sm:     10px;
  --al-radius-md:     14px;
  --al-radius-lg:     18px;
  --al-radius-full:   999px;

  /* тени */
  --al-shadow:        0 4px 14px rgba(0, 0, 0, 0.24);
  --al-shadow-hover:  0 8px 18px rgba(0, 176, 185, 0.18);
  --al-shadow-lg:     0 14px 34px rgba(0, 0, 0, 0.38);

  /* переходы */
  --al-ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --al-dur:           0.22s;
}

/* ==========================================
   1. КНОПКИ (.al-btn)
   ========================================== */

/* base */
.al-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition:
    background var(--al-dur) var(--al-ease),
    color var(--al-dur) var(--al-ease),
    border-color var(--al-dur) var(--al-ease),
    box-shadow var(--al-dur) var(--al-ease),
    transform var(--al-dur) var(--al-ease),
    opacity var(--al-dur) var(--al-ease);
}

.al-btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* --- sizes --- */
.al-btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--al-radius-sm);
}

.al-btn-md,
.al-btn:not(.al-btn-sm):not(.al-btn-lg) {
  font-size: 0.9rem;
  padding: 0.6rem 1.3rem;
  border-radius: var(--al-radius-md);
}

.al-btn-lg {
  font-size: 1rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--al-radius-lg);
}

/* --- PRIMARY --- */
.al-btn-primary {
  background: linear-gradient(135deg, var(--al-primary), rgba(0, 176, 185, 0.82));
  color: var(--al-bg-dark);
  box-shadow: var(--al-shadow);
}

.al-btn-primary:hover {
  background: var(--al-primary);
  transform: translateY(-1px);
  box-shadow: var(--al-shadow-hover);
}

.al-btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--al-shadow);
}

/* --- SECONDARY (outline) --- */
.al-btn-secondary {
  background: var(--al-primary-10);
  border-color: var(--al-primary);
  color: var(--al-primary);
}

.al-btn-secondary:hover {
  background: var(--al-primary-20);
  color: var(--al-primary-light);
  transform: translateY(-1px);
}

.al-btn-secondary:active {
  transform: translateY(0);
}

/* --- GHOST (transparent) --- */
.al-btn-ghost {
  background: transparent;
  color: var(--al-text);
  border-color: var(--al-border);
}

.al-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--al-border-hover);
  color: var(--al-primary);
}

.al-btn-ghost:active {
  background: rgba(255, 255, 255, 0.04);
}

/* --- DANGER --- */
.al-btn-danger {
  background: var(--al-danger-10);
  border-color: var(--al-danger);
  color: var(--al-danger);
}

.al-btn-danger:hover {
  background: var(--al-danger);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.25);
}

.al-btn-danger:active {
  transform: translateY(0);
}

/* --- DISABLED --- */
.al-btn:disabled,
.al-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* --- LOADING (spinner inside) --- */
.al-btn.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

.al-btn.is-loading::after {
  content: '';
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: al-spin 0.6s linear infinite;
  flex-shrink: 0;
}

/* --- ICON-ONLY (square) --- */
.al-btn-icon {
  padding: 0;
  border-radius: var(--al-radius-md);
}

.al-btn-icon.al-btn-sm  { width: 32px; height: 32px; }
.al-btn-icon.al-btn-md,
.al-btn-icon:not(.al-btn-sm):not(.al-btn-lg) { width: 40px; height: 40px; }
.al-btn-icon.al-btn-lg  { width: 48px; height: 48px; }

/* --- PILL (fully rounded) --- */
.al-btn-pill { border-radius: var(--al-radius-full); }


/* ==========================================
   2. СКЕЛЕТОНЫ (.al-skeleton)
   Shimmer-волна на тёмном фоне
   ========================================== */

.al-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--al-radius-md);
  /* no text, no children visible */
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

.al-skeleton * {
  visibility: hidden;
}

.al-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 40%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.06) 60%,
    transparent 100%
  );
  animation: al-shimmer 1.6s ease-in-out infinite;
}

@keyframes al-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* type helpers */
.al-skeleton-text {
  height: 1em;
  border-radius: 6px;
  margin-bottom: 0.5em;
}

.al-skeleton-text.w-60 { width: 60%; }
.al-skeleton-text.w-80 { width: 80%; }
.al-skeleton-text.w-40 { width: 40%; }

.al-skeleton-circle {
  border-radius: 50%;
}

.al-skeleton-card {
  border-radius: var(--al-radius-lg);
  border: 1px solid var(--al-border);
}

.al-skeleton-cover {
  aspect-ratio: 1 / 1;
  border-radius: var(--al-radius-lg) var(--al-radius-lg) 0 0;
}


/* ==========================================
   3. ПУСТЫЕ СОСТОЯНИЯ (.al-empty)
   ========================================== */

.al-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 1rem;
  min-height: 200px;
}

.al-empty-icon {
  width: 64px;
  height: 64px;
  color: var(--al-text-muted);
  opacity: 0.5;
}

.al-empty-icon svg {
  width: 100%;
  height: 100%;
}

.al-empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--al-text);
}

.al-empty-text {
  font-size: 0.92rem;
  color: var(--al-text-muted);
  max-width: 380px;
  line-height: 1.55;
}

.al-empty-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}


/* ==========================================
   4. ТОСТЫ (.al-toast)
   Стопка в правом нижнем углу (над плеером)
   ========================================== */

.al-toast-container {
  position: fixed;
  bottom: 86px;           /* выше плеера */
  right: 18px;
  z-index: 6000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 36px));
}

body:not(.has-player) .al-toast-container {
  bottom: 18px;
}

.al-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--al-border);
  border-radius: var(--al-radius-md);
  box-shadow: var(--al-shadow-lg);
  color: var(--al-text);
  font-size: 0.9rem;
  line-height: 1.45;
  animation: al-toast-in 0.35s var(--al-ease) forwards;
  max-width: 100%;
}

.al-toast.is-removing {
  animation: al-toast-out 0.28s var(--al-ease) forwards;
}

.al-toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.al-toast-body {
  flex: 1;
  min-width: 0;
}

.al-toast-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.al-toast-msg {
  color: var(--al-text-muted);
  font-size: 0.84rem;
}

.al-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--al-text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.al-toast-close:hover {
  color: var(--al-text);
  background: rgba(255, 255, 255, 0.08);
}

.al-toast-close svg {
  width: 16px;
  height: 16px;
}

/* toast color accents */
.al-toast-success { border-left: 3px solid var(--al-success); }
.al-toast-success .al-toast-icon { color: var(--al-success); }

.al-toast-error { border-left: 3px solid var(--al-danger); }
.al-toast-error .al-toast-icon { color: var(--al-danger); }

.al-toast-info { border-left: 3px solid var(--al-primary); }
.al-toast-info .al-toast-icon { color: var(--al-primary); }

.al-toast-warning { border-left: 3px solid var(--al-warning); }
.al-toast-warning .al-toast-icon { color: var(--al-warning); }

/* progress bar (auto-dismiss countdown) */
.al-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--al-radius-md) var(--al-radius-md);
  background: currentColor;
  opacity: 0.3;
  transform-origin: left;
  animation: al-toast-timer linear forwards;
}

.al-toast { position: relative; overflow: hidden; }

@keyframes al-toast-in {
  0% {
    opacity: 0;
    transform: translateX(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes al-toast-out {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(30px) scale(0.92);
  }
}

@keyframes al-toast-timer {
  0%   { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}


/* ==========================================
   5. МОДАЛЬНЫЕ ОКНА (.al-modal)
   ========================================== */

.al-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--al-ease), visibility 0.25s;
}

.al-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.al-modal {
  position: relative;
  width: min(520px, 100%);
  background: rgba(14, 14, 14, 0.98);
  border: 1px solid var(--al-border);
  border-radius: var(--al-radius-lg);
  box-shadow: var(--al-shadow-lg);
  padding: 24px;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s var(--al-ease);
}

.al-modal-overlay.open .al-modal {
  transform: translateY(0) scale(1);
}

.al-modal-sm  { width: min(380px, 100%); }
.al-modal-lg  { width: min(680px, 100%); }

.al-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.al-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--al-text);
  letter-spacing: -0.2px;
}

.al-modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--al-radius-sm);
  border: 1px solid var(--al-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--al-text);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.al-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--al-border-hover);
}

.al-modal-body {
  color: var(--al-text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.al-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}


/* ==========================================
   6. КНОПКА «НАВЕРХ» (.al-scroll-top)
   ========================================== */

.al-scroll-top {
  position: fixed;
  right: 18px;
  bottom: 86px;
  width: 44px;
  height: 44px;
  border-radius: var(--al-radius-md);
  border: 1px solid var(--al-border);
  background: rgba(14, 14, 14, 0.88);
  backdrop-filter: blur(10px);
  color: var(--al-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4500;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s var(--al-ease), transform 0.25s var(--al-ease),
    background 0.15s, border-color 0.15s;
}

body:not(.has-player) .al-scroll-top {
  bottom: 18px;
}

.al-scroll-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.al-scroll-top:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: var(--al-primary);
}

.al-scroll-top svg {
  width: 20px;
  height: 20px;
}


/* ==========================================
   7. ЯКОРЬ-NAV для длинных страниц (.al-anchor-nav)
   ========================================== */

.al-anchor-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 1.5rem;
  scrollbar-width: none;
}

.al-anchor-nav::-webkit-scrollbar { display: none; }

.al-anchor-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 1rem;
  border-radius: var(--al-radius-full);
  border: 1px solid var(--al-border);
  background: transparent;
  color: var(--al-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.al-anchor-link:hover,
.al-anchor-link.active {
  background: var(--al-primary-10);
  border-color: var(--al-primary);
  color: var(--al-primary);
}


/* ==========================================
   8. ОБЩИЕ УТИЛИТИ
   ========================================== */

@keyframes al-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* sr-only (для aria) */
.al-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* focus ring (доступность) */
.al-btn:focus-visible,
.al-anchor-link:focus-visible,
.al-modal-close:focus-visible,
.al-toast-close:focus-visible,
.al-scroll-top:focus-visible {
  outline: 2px solid var(--al-primary);
  outline-offset: 2px;
}


/* ==========================================
   9. MOBILE OVERRIDES
   ========================================== */

@media (max-width: 600px) {
  .al-toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .al-toast {
    font-size: 0.84rem;
  }

  .al-modal {
    padding: 18px;
    border-radius: var(--al-radius-md);
  }

  .al-empty {
    padding: 2rem 1rem;
  }

  .al-empty-icon {
    width: 48px;
    height: 48px;
  }
}

/* ===========================================
   RELEASE CARD — .al-release-card
   =========================================== */

.al-release-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--al-bg-card, #141414);
  border: 1px solid var(--al-border, rgba(255,255,255,.08));
  border-radius: var(--al-radius-lg);
  overflow: hidden;
  transition: transform .25s var(--al-ease), box-shadow .25s var(--al-ease), border-color .25s;
  box-shadow: 0 3px 12px rgba(0,0,0,.22);
}
.al-release-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,.3);
  border-color: rgba(255,255,255,.13);
}

/* Cover wrapper */
.al-release-card__cover {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  flex-shrink: 0;
}
.al-release-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s var(--al-ease);
}
.al-release-card:hover .al-release-card__cover img {
  transform: scale(1.03);
}

/* Play overlay */
.al-release-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.38);
  opacity: 0;
  transition: opacity .25s var(--al-ease);
  cursor: pointer;
}
.al-release-card__play svg {
  width: 42px;
  height: 42px;
  fill: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
  transition: transform .2s;
}
.al-release-card:hover .al-release-card__play {
  opacity: 1;
}
.al-release-card__play:hover svg {
  transform: scale(1.12);
}

/* Badge row on cover */
.al-release-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  z-index: 1;
}

.al-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .02em;
  white-space: nowrap;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.al-badge--type {
  background: rgba(0,176,185,.85);
  color: #fff;
}
.al-badge--mood {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.9);
}
.al-badge--upcoming {
  background: rgba(238, 90, 111, 0.9);
  color: #fff;
}
.al-badge--year {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  font-weight: 600;
}
.al-badge--duration {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  font-weight: 600;
}

/* Content */
.al-release-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
  flex: 1;
}

.al-release-card__title {
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--al-text, #fff);
  margin: 0;
}
.al-release-card__title a {
  color: inherit;
  text-decoration: none;
}
.al-release-card__title a:hover {
  color: var(--al-primary);
}

.al-release-card__artists {
  font-size: .82rem;
  color: var(--al-primary);
  line-height: 1.3;
}
.al-release-card__artists a {
  color: inherit;
  text-decoration: none;
}
.al-release-card__artists a:hover {
  text-decoration: underline;
}

.al-release-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--al-muted, #777);
  margin-top: auto;
}

.al-release-card__moods {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.al-release-card__moods .al-badge--mood {
  font-size: .68rem;
  padding: 2px 7px;
}

.al-release-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* Carousel variant — fixed width */
.al-release-card--carousel {
  flex: 0 0 260px;
  scroll-snap-align: start;
}

/* Compact variant (e.g. sidebar) */
.al-release-card--compact .al-release-card__body {
  padding: 10px 12px 12px;
}
.al-release-card--compact .al-release-card__title {
  font-size: .88rem;
}

/* Grid helper */
.al-release-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 20px;
}
@media (max-width: 1400px) {
  .al-release-grid { grid-template-columns: repeat(3, minmax(200px, 1fr)); }
}
@media (max-width: 1100px) {
  .al-release-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
}
@media (max-width: 620px) {
  .al-release-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .al-release-card__body { padding: 10px 12px 12px; }
  .al-release-card__title { font-size: .88rem; }
  .al-release-card__play svg { width: 36px; height: 36px; }
}
@media (max-width: 400px) {
  .al-release-grid { grid-template-columns: 1fr; max-width: 320px; margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .al-skeleton::after,
  .al-toast,
  .al-toast.is-removing,
  .al-toast-progress,
  .al-btn.is-loading::after {
    animation-duration: 0.01ms !important;
  }
  .al-release-card,
  .al-release-card__cover img,
  .al-release-card__play {
    transition-duration: 0.01ms !important;
  }
}
