/* Full-page animated background: travel routes + logo */
.bg-layer {
  position: fixed;
  inset: 0;
  background:
    url('/static/img/travel-routes.svg') no-repeat center center / cover,
    url('/static/img/logo.svg') no-repeat center center / 50% auto;
  opacity: 0.17;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgPulse {
  0% { opacity: 0.14; }
  50% { opacity: 0.20; }
  100% { opacity: 0.14; }
}

.bg-layer {
  animation: bgPulse 8s ease-in-out infinite;
}

/* Floating particles */
@keyframes floatAcross1 {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.7; }
  100% { transform: translate(100vw, 20vh); opacity: 0; }
}
@keyframes floatAcross2 {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.5; }
  100% { transform: translate(-30vw, 40vh); opacity: 0; }
}
.bg-layer::before {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-blue);
  box-shadow: 0 0 12px var(--color-blue);
  top: 30%; left: 20%;
  animation: floatAcross1 14s linear infinite;
}
.bg-layer::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-red);
  box-shadow: 0 0 10px var(--color-red);
  top: 60%; right: 10%;
  animation: floatAcross2 18s linear infinite;
}

.ai-spinner {
  display: none;
  vertical-align: middle;
}
.htmx-request .ai-spinner,
.htmx-request.ai-spinner {
  display: inline-block;
}
.htmx-request .ai-btn-text {
  display: none;
}
button:disabled,
.htmx-request {
  opacity: 0.7;
  cursor: wait;
}

/* Short version footer with AI icon */
.short-version-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: var(--space-md);
}

.ai-icon-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.ai-icon-big object {
  display: block;
  width: 72px;
  height: 72px;
}

.short-version-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-soft);
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.main {
  min-height: calc(100vh - 160px);
  padding: var(--space-3xl) 0;
  position: relative;
  z-index: 1;
}

/* Grid for news cards */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 640px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .news-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .news-grid .news-card:first-child {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--space-5xl) 0 var(--space-4xl);
  margin-bottom: var(--space-2xl);
  overflow: hidden;
  background: linear-gradient(135deg, #F8F6F3 0%, #EEF5FA 40%, #F8F6F3 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(27, 136, 201, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(235, 39, 43, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0%   { opacity: 0.6; transform: scale(1); }
  50%  { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0.6; transform: scale(1); }
}

.hero__particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero__particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-blue);
  opacity: 0;
}

.hero__particle:nth-child(1) { top: 15%; left: 8%; animation: floatParticle 12s ease-in-out infinite; background: var(--color-blue); width: 8px; height: 8px; }
.hero__particle:nth-child(2) { top: 70%; left: 15%; animation: floatParticle 15s ease-in-out 2s infinite; background: var(--color-red); width: 5px; height: 5px; }
.hero__particle:nth-child(3) { top: 25%; right: 20%; animation: floatParticle 10s ease-in-out 4s infinite; background: var(--color-blue); width: 10px; height: 10px; opacity: 0.08; }
.hero__particle:nth-child(4) { bottom: 20%; right: 8%; animation: floatParticle 14s ease-in-out 1s infinite; background: var(--color-red); width: 6px; height: 6px; }
.hero__particle:nth-child(5) { top: 50%; left: 5%; animation: floatParticle 18s ease-in-out 6s infinite; background: var(--color-dark); width: 4px; height: 4px; }
.hero__particle:nth-child(6) { top: 10%; right: 35%; animation: floatParticle 11s ease-in-out 3s infinite; background: var(--color-blue); width: 7px; height: 7px; }

@keyframes floatParticle {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  20%  { opacity: 0.7; }
  80%  { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-120px) scale(1.2); }
}

.hero__watermark {
  position: absolute;
  top: -30%; right: -5%;
  width: 50%; height: 160%;
  background: url('/static/img/logo.svg') no-repeat right top / contain;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  animation: watermarkPulse 6s ease-in-out infinite alternate;
}

@keyframes watermarkPulse {
  0%   { opacity: 0.03; transform: scale(1) translateY(0); }
  100% { opacity: 0.07; transform: scale(1.03) translateY(-10px); }
}

.hero__accent {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-blue) 30%, var(--color-white) 50%, var(--color-red) 100%);
  z-index: 1;
}

.hero > *:not(.hero__particles):not(.hero__watermark):not(.hero__accent) {
  position: relative;
  z-index: 1;
}

.hero__title {
  font-size: var(--text-6xl);
  font-weight: 800;
  margin-bottom: var(--space-lg);
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 800px;
}

.hero__title span {
  background: linear-gradient(135deg, var(--color-blue) 0%, #3F9FD9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-soft);
  max-width: 600px;
  line-height: 1.5;
}

/* ============================================
   Block Sections
   ============================================ */
.blocks-wrapper {
  padding-top: var(--space-4xl);
}

.block-section {
  position: relative;
  padding: var(--space-3xl) 0;
  margin-bottom: var(--space-xl);
}

/* Alternating backgrounds: odd = clean, even = full-width solid */
.block-section::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 100vw;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
}

.block-section:nth-child(even)::before {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.block-section > * {
  position: relative;
  z-index: 1;
}

/* Large faded number */
.block-section__number {
  position: absolute;
  top: -0.3em;
  font-family: var(--font-heading);
  font-size: 12rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-light);
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

.block-section:nth-child(odd) .block-section__number { right: -0.05em; }
.block-section:nth-child(even) .block-section__number { left: -0.05em; }

/* Colored accent bar */
.block-section__header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
}

.block-section__header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 4rem;
  height: 3px;
  border-radius: 2px;
}

.block-section:nth-child(4n+1) .block-section__header::after { background: var(--color-blue); }
.block-section:nth-child(4n+2) .block-section__header::after { background: var(--color-red); }
.block-section:nth-child(4n+3) .block-section__header::after { background: var(--color-dark); }
.block-section:nth-child(4n) .block-section__header::after { background: var(--color-blue); }

.block-section__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.block-section:nth-child(even) .block-section__header::after { left: auto; right: 0; }
.block-section:nth-child(even) .block-section__header { flex-direction: row-reverse; }

/* Admin stats cards */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}
.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.stat-card__value {
  display: block;
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-dark);
  line-height: 1;
  margin-bottom: var(--space-xs);
}
.stat-card__label {
  font-size: var(--text-xs);
  color: var(--color-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card--success .stat-card__value { color: var(--color-success); }
.stat-card--warning .stat-card__value { color: var(--color-warning); }
.stat-card--danger .stat-card__value { color: var(--color-error); }
.stat-card--info .stat-card__value { color: var(--color-blue); }

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2xl);
}

.dashboard-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.dashboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.dashboard-item__info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.dashboard-item__title { font-weight: 500; }

.dashboard-item__actions { display: flex; gap: var(--space-xs); }

.status--draft { color: var(--color-text-soft); }
.status--pending { color: var(--color-warning); }
.status--approved { color: var(--color-success); }
.status--rejected { color: var(--color-error); }
.status--published { color: var(--color-success); }

.empty-state {
  text-align: center;
  padding: var(--space-4xl);
  color: var(--color-text-soft);
}

.empty-state p { margin-bottom: var(--space-lg); }

/* News form */
.news-form-container { max-width: 800px; margin: 0 auto; }
.news-form-container h1 { margin-bottom: var(--space-2xl); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.form-actions { margin-top: var(--space-2xl); }

/* Moderation */
.mod-tabs { display: flex; gap: var(--space-sm); margin-bottom: var(--space-xl); }
.mod-tab {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-soft);
}
.mod-tab--active { background: var(--color-blue); color: white; border-color: var(--color-blue); }
.mod-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-sm);
}
.mod-item__info { display: flex; align-items: center; gap: var(--space-md); flex: 1; }
.mod-item__actions { flex-shrink: 0; }
.mod-review { max-width: 800px; margin: 0 auto; }
.mod-review__header { display: flex; align-items: center; gap: var(--space-lg); margin-bottom: var(--space-xl); }
.mod-review__header h1 { flex: 1; }
.mod-review__meta { display: flex; gap: var(--space-md); margin-bottom: var(--space-2xl); }
.mod-review__content h3 { margin-top: var(--space-xl); margin-bottom: var(--space-md); }
.mod-review__text, .mod-review__short {
  background: var(--color-white); padding: var(--space-lg);
  border-radius: var(--radius-md); border: 1px solid var(--color-border);
}
.mod-review__comment { background: #FFF8E6; padding: var(--space-lg); border-radius: var(--radius-md); margin-top: var(--space-xl); }
.mod-review__actions { display: flex; gap: var(--space-md); margin-top: var(--space-2xl); flex-wrap: wrap; align-items: center; }

/* Admin */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%; background: var(--color-white);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td { padding: var(--space-md) var(--space-lg); text-align: left; font-size: var(--text-sm); }
.admin-table th {
  background: var(--color-bg); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  font-size: var(--text-xs); color: var(--color-text-soft);
}
.admin-table tr:not(:last-child) td { border-bottom: 1px solid var(--color-border); }
/* ============================================
   Mobile Responsive Fixes
   ============================================ */
@media (max-width: 640px) {
  .container { padding: 0 var(--space-md); }

  .hero__title { font-size: var(--text-3xl); }
  .hero__subtitle { font-size: var(--text-base); }

  .block-section__title { font-size: var(--text-xl); }
  .block-section { padding: var(--space-xl) 0; }
  .blocks-wrapper { padding-top: var(--space-xl); }

  .block-section__number { font-size: 6rem; }

  .news-article { padding: var(--space-lg); }
  .news-article__title { font-size: var(--text-2xl); }
  .news-article__content { font-size: var(--text-base); }

  .auth-form { padding: var(--space-lg); }
  .auth-page { padding: var(--space-xl) var(--space-md); }

  .news-form-container { padding: 0; }
  .form-row { grid-template-columns: 1fr; }
  .ProseMirror { min-height: 250px; }

  .dashboard-item { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .mod-item { flex-direction: column; gap: var(--space-sm); }
  .mod-tabs { flex-wrap: wrap; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .stat-card { padding: var(--space-md); }

  .news-grid { gap: var(--space-md); }

  .hero-slide__city { font-size: var(--text-2xl); }
  .hero-slide.is-active .hero-slide__city { font-size: var(--text-3xl); }
  .hero-slideshow { flex-direction: column; min-height: 60vh; }
  .hero-slide { min-height: 15vh; }
  .hero-slide.is-active { min-height: 40vh; }
  .hero-slide__label { writing-mode: horizontal-tb; bottom: 5px; font-size: var(--text-xs); }

  .short-version-footer { flex-wrap: wrap; }
  .ai-icon-big { width: 48px; height: 48px; }
  .ai-icon-big object { width: 48px; height: 48px; }

  .news-article__cta { padding: var(--space-md); }
}
