/**
 * Eador: Adrageron — UI Components
 * Based on DESIGN_PROPOSAL.md (lines 180-250)
 */

/* ==========================================================================
   1. Кнопки (Buttons)
   ========================================================================== */

/* Базовый сброс и общие стили для кнопок */
.button-primary,
.button-secondary,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-ui, 'Montserrat', 'Inter', sans-serif);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border-radius: 999px;
  line-height: 1.2;
  transition: all 0.3s ease;
  user-select: none;
  text-align: center;
  white-space: nowrap;
}

/* Первичная кнопка (Скачать игру) */
.button-primary {
  background: linear-gradient(180deg, #2ECC71 0%, #229954 100%);
  color: #FFFFFF;
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2.5rem);
  border: 2px solid var(--gold-bright, #F4D03F);
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  letter-spacing: 0.03em;
  box-shadow: 
    0 0 20px rgba(46, 204, 113, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.5);
}

.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 0 30px rgba(46, 204, 113, 0.6),
    0 6px 16px rgba(0, 0, 0, 0.6);
  border-color: #FFFFFF;
}

.button-primary:active {
  transform: translateY(0);
  box-shadow: 
    0 0 15px rgba(46, 204, 113, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Вторичная кнопка (Сообщество, VK, Discord) */
.button-secondary {
  background: linear-gradient(180deg, var(--gold-primary, #D4AF37) 0%, var(--gold-dark, #8B7355) 100%);
  color: var(--surface-deepest, #070302);
  border: 2px solid var(--gold-bright, #F4D03F);
  padding: clamp(0.6rem, 1.5vw, 0.85rem) clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(0.9rem, 1vw, 1rem);
  letter-spacing: 0.02em;
  box-shadow: 
    0 0 15px rgba(212, 175, 55, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

.button-secondary:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, var(--gold-bright, #F4D03F) 0%, var(--gold-primary, #D4AF37) 100%);
  box-shadow: 
    0 0 25px rgba(244, 208, 63, 0.5),
    0 6px 14px rgba(0, 0, 0, 0.5);
  color: #070302;
}

.button-secondary:active {
  transform: translateY(0);
  box-shadow: 
    0 0 10px rgba(212, 175, 55, 0.2),
    0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Призрачная кнопка (Ghost) */
.button-ghost {
  background: transparent;
  color: var(--gold-primary, #D4AF37);
  border: 2px solid var(--gold-primary, #D4AF37);
  padding: clamp(0.6rem, 1.5vw, 0.85rem) clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(0.875rem, 1vw, 0.95rem);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.button-ghost:hover {
  background: var(--gold-primary, #D4AF37);
  color: var(--surface-deepest, #070302);
  border-color: var(--gold-bright, #F4D03F);
  transform: translateY(-2px);
  box-shadow: 
    0 0 20px rgba(212, 175, 55, 0.4),
    0 6px 14px rgba(0, 0, 0, 0.4);
}

.button-ghost:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


/* ==========================================================================
   2. Карточки (Cards)
   ========================================================================== */

/* Базовая карточка */
.card {
  background: linear-gradient(135deg, var(--surface-elevated, #1A2438) 0%, var(--surface-mid, #12192B) 100%);
  border: 1px solid rgba(139, 115, 85, 0.4);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.card:hover {
  border-color: var(--gold-primary, #D4AF37);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(212, 175, 55, 0.15);
  transform: translateY(-3px);
}

/* Карточка новости (News Card) */
.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-card__image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 соотношение */
  overflow: hidden;
  background: var(--surface-deepest, #070302);
}

.news-card__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.news-card:hover .news-card__image {
  transform: scale(1.05);
}

.news-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 0.75rem;
}

.news-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gold-muted, #C19A6B);
}

.news-card__title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 1.2rem;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.3;
}

.news-card__excerpt {
  font-family: var(--font-body, 'Lora', serif);
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

/* Пергаментная панель (Об игре, старинный свиток) */
.parchment-panel {
  background: linear-gradient(135deg, 
    var(--parchment-light, #E8DCC8) 0%, 
    var(--parchment-base, #D4C4A8) 100%);
  color: #2C1810;
  border: 3px solid var(--gold-dark, #8B7355);
  border-radius: 24px;
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.6);
  position: relative;
  font-family: var(--font-body, 'Lora', serif);
}

.parchment-panel h2,
.parchment-panel h3 {
  font-family: var(--font-display, 'Cinzel', serif);
  color: #4A2E12;
  margin-top: 0;
}

.parchment-panel p {
  color: #382415;
  line-height: 1.7;
}


/* ==========================================================================
   3. Бейджи категорий (Category Badges)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-family: var(--font-ui, 'Montserrat', sans-serif);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 6px;
  line-height: 1.2;
}

/* Бейдж: Новое (#2ECC71) */
.badge-new {
  background: rgba(46, 204, 113, 0.15);
  color: #2ECC71;
  border: 1px solid #2ECC71;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.2);
}

/* Бейдж: Исправление (#4ECDC4) */
.badge-fix {
  background: rgba(78, 205, 196, 0.15);
  color: #4ECDC4;
  border: 1px solid #4ECDC4;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.2);
}

/* Бейдж: Баланс (#F39C12) */
.badge-balance {
  background: rgba(243, 156, 18, 0.15);
  color: #F39C12;
  border: 1px solid #F39C12;
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.2);
}


/* ==========================================================================
   4. Аккордеон changelog (Changelog Accordion)
   ========================================================================== */

.accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.accordion-item {
  background: rgba(18, 25, 43, 0.85);
  border: 1px solid var(--gold-dark, #8B7355);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.accordion-item:hover,
.accordion-item.active {
  border-color: var(--gold-primary, #D4AF37);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 1.1rem;
  color: var(--gold-primary, #D4AF37);
  text-align: left;
  transition: background 0.3s ease, color 0.3s ease;
}

.accordion-header:hover {
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold-bright, #F4D03F);
}

.accordion-icon {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  fill: currentColor;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-body, 'Lora', serif);
  font-size: 0.95rem;
  line-height: 1.6;
}

.accordion-item.active .accordion-content {
  max-height: 1200px;
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(139, 115, 85, 0.3);
}


/* ==========================================================================
   5. Модальные окна и Lightbox (Modals & Lightbox)
   ========================================================================== */

/* Оверлей модального окна */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
}

.modal-overlay.active,
.modal-overlay.is-open {
  display: flex !important;
  opacity: 1;
  visibility: visible;
}

/* Диалог модального окна */
.modal-dialog {
  background: linear-gradient(135deg, 
    rgba(26, 36, 56, 0.98) 0%, 
    rgba(18, 25, 43, 0.99) 100%);
  border: 2px solid var(--gold-primary, #D4AF37);
  border-radius: 20px;
  box-shadow: 
    0 12px 48px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(212, 175, 55, 0.25);
  max-width: 640px;
  width: 100%;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  position: relative;
  transform: scale(0.92);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

/* Кнопка закрытия */
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--gold-primary, #D4AF37);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gold-bright, #F4D03F);
  transform: scale(1.15) rotate(90deg);
  text-shadow: 0 0 10px var(--gold-bright, #F4D03F);
}

/* Модальное окно в виде компактного пергаментного свитка */
/* Модальное окно в виде компактного пергаментного свитка */
.modal-dialog.parchment-panel {
  max-width: 540px;
  width: 95vw;
  max-height: 88vh;
  margin: auto;
  border-width: 46px 44px 54px 44px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  color: #261B11;
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.95));
}

.modal-dialog.parchment-panel .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.4rem 0.45rem;
  border-bottom: 1px solid rgba(80, 50, 20, 0.25);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.modal-dialog.parchment-panel .modal-title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #3D2210;
  margin: 0;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

.modal-dialog.parchment-panel .modal-close {
  position: static;
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.25rem;
  color: #5C3A1E;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(80, 50, 20, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-dialog.parchment-panel .modal-close:hover {
  color: #1A0D05;
  background: rgba(80, 50, 20, 0.12);
  border-color: rgba(80, 50, 20, 0.4);
  transform: scale(1.05);
}

.modal-dialog.parchment-panel .modal-body {
  overflow-y: auto;
  padding: 0 0.4rem;
  max-height: calc(88vh - 160px);
  scrollbar-width: thin;
  scrollbar-color: #8B7355 transparent;
  flex: 1 1 auto;
}

.modal-dialog.parchment-panel .modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-dialog.parchment-panel .modal-body::-webkit-scrollbar-thumb {
  background: #8B7355;
  border-radius: 3px;
}

.modal-dialog.parchment-panel .requirements-box,
.modal-dialog.parchment-panel .requirements-columns,
.modal-dialog.parchment-panel .req-column {
  background: rgba(80, 50, 20, 0.05);
  border: 1px solid rgba(80, 50, 20, 0.15);
  border-radius: 6px;
  padding: 0.75rem 0.95rem;
  margin: 0.25rem 0;
}

.modal-dialog.parchment-panel .req-title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: #4A2810;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed rgba(80, 50, 20, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-dialog.parchment-panel .req-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-dialog.parchment-panel .req-list li {
  font-family: var(--font-body, 'Lora', serif);
  font-size: 0.88rem;
  color: #2C1810;
  line-height: 1.4;
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(80, 50, 20, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.modal-dialog.parchment-panel .req-list li:last-child {
  border-bottom: none;
}

.modal-dialog.parchment-panel .req-list strong {
  color: #4A2E12;
  font-weight: 700;
  white-space: nowrap;
}

.modal-dialog.parchment-panel .modal-footer {
  display: flex;
  justify-content: center;
  padding: 0.45rem 0 0.2rem;
  border-top: 1px solid rgba(80, 50, 20, 0.2);
  margin-top: 0.45rem;
  flex-shrink: 0;
}

.modal-dialog.parchment-panel .modal-btn-close {
  background: linear-gradient(180deg, #3A2213 0%, #24130A 100%);
  color: #EBDCB9;
  border: 1px solid #7D5C3B;
  border-radius: 4px;
  padding: 0.4rem 1.75rem;
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.modal-dialog.parchment-panel .modal-btn-close:hover {
  background: linear-gradient(180deg, #4F2E1A 0%, #301A0E 100%);
  color: #FFF3D6;
  border-color: #B58D5D;
  box-shadow: 0 0 10px rgba(181, 141, 93, 0.4);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .modal-dialog.parchment-panel {
    border-width: 30px 24px 36px 24px;
    padding: 0 4px;
    max-height: 94vh;
  }
  .modal-dialog.parchment-panel .requirements-columns {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .modal-dialog.parchment-panel .modal-title {
    font-size: 0.98rem;
  }
}

/* Lightbox модальное окно для скриншотов */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-modal__content {
  max-width: 90vw;
  max-height: 85vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-modal__image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--gold-dark, #8B7355);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 175, 55, 0.2);
}

.lightbox-modal__caption {
  font-family: var(--font-body, 'Lora', serif);
  color: var(--parchment-light, #E8DCC8);
  font-size: 1rem;
  margin-top: 0.75rem;
  text-align: center;
}


/* ==========================================================================
   6. Анимации (Keyframes & Utilities)
   ========================================================================== */

/* Пульсация свечения */
@keyframes glow-pulse {
  0% {
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(244, 208, 63, 0.6), 0 0 10px rgba(212, 175, 55, 0.4);
  }
  100% {
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
  }
}

/* Плавное парение (Float) */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Пробегающий световой блик (Shimmer) */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Утилитарные классы анимаций */
.animate-glow {
  animation: glow-pulse 3s infinite ease-in-out;
}

.animate-float {
  animation: float 4s infinite ease-in-out;
}

.animate-shimmer {
  background: linear-gradient(
    90deg, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(244, 208, 63, 0.25) 50%, 
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
}
