/* static/style.css */

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0 20px;
  background-color: #f5f5f5;
  color: #222;
}

header {
  padding: 20px 0;
  background-color: #222;
  color: #fff;
}

.site-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 18px;
}

.site-header-inner .logo {
  grid-column: 2;
}

.language-switcher {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.language-switcher__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 34px;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.language-switcher__item:hover,
.language-switcher__item.is-active {
  background: #fff;
  color: #202939;
  text-decoration: none;
}

.language-switcher__flag {
  display: block;
  width: 24px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .18);
}

.language-switcher__code {
  line-height: 1;
}

h1 {
  margin: 0;
  font-size: 28px;
}

form input, form textarea {
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

form button {
  padding: 10px 20px;
  background-color: #007BFF;
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

form button:hover {
  background-color: #0056b3;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  padding: 20px 0;
  max-width: 1400px;
  margin: 0 auto;
}

.grid img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.poster-year-layer {
  position: relative;
  display: block;
  line-height: 0;
}

.poster-year-layer--inline {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.poster-year-badge {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  min-width: 44px;
  box-sizing: border-box;
  padding: 5px 9px;
  border: 1px solid rgba(202, 218, 241, .95);
  border-radius: 999px;
  background: rgba(247, 251, 255, .92);
  color: #245a9d;
  box-shadow: 0 8px 18px rgba(13, 31, 58, .24);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

.poster-year-badge--small {
  top: 6px;
  right: 6px;
  min-width: 38px;
  padding: 4px 7px;
  font-size: 10px;
  box-shadow: 0 6px 13px rgba(13, 31, 58, .22);
}

.grid h2 {
  font-size: 16px;
  margin: 8px 0 0;
  text-align: center;
}

main {
  padding: 20px 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-align: center;
  padding: 10px 0;
}

[dir="rtl"] .language-switcher {
  grid-column: 1;
  justify-content: flex-start;
}

[dir="rtl"] .site-header-inner .logo {
  grid-column: 2;
}

@media (max-width: 760px) {
  .site-header-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0 12px;
  }

  .site-header-inner .logo,
  .language-switcher {
    grid-column: auto;
  }

  .language-switcher {
    justify-content: center;
    flex-wrap: wrap;
  }

  .language-switcher__item {
    min-width: 38px;
    min-height: 32px;
    padding: 4px 7px;
  }

  .language-switcher__code {
    display: none;
  }
}

.film-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.poster-container {
  width: 300px;
  flex-shrink: 0;
}

.info-container {
  max-width: 600px;
  flex-grow: 1;
}

.film-title {
  font-size: 24px;
  word-break: break-word;
  line-height: 1.3;
  margin-top: 0;
}

.form-wrapper {
  max-width: 600px;
  margin: 40px auto;
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.button-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

.submit-button {
  background-color: #28a745;
}

.submit-button:hover {
  background-color: #218838;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.tag-chip {
  background-color: #e0e0e0;
  color: #333;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.tag-chip:hover {
  background-color: #ccc;
}

.suggested-tag {
  background-color: #f0f0f0;
  border-radius: 12px;
  padding: 4px 10px;
  margin-right: 5px;
  cursor: pointer;
  display: inline-block;
}

.suggested-tag:hover {
  background-color: #ddd;
}

.suggested-platform {
  background-color: #e8f0ff;
  border-radius: 12px;
  padding: 4px 10px;
  margin: 3px 5px 5px 0;
  cursor: pointer;
  display: inline-block;
  color: #0056b3;
  font-size: 14px;
}

.suggested-platform:hover {
  background-color: #cce0ff;
}

.similar-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.similar-grid h2 {
  font-size: 16px;
  text-align: center;
  margin: 8px 0 0;
  height: 40px; /* фиксированная высота названий */
  overflow: hidden;
}

.film-card {
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.film-card img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.film-name {
  font-size: 14px;
  text-align: center;
  margin: 8px 0 0;
  height: 40px; /* фиксированная высота */
  overflow: hidden;
}



/* --------------------- */
/* 📱 Mobile Adaptation  */
/* --------------------- */
@media (max-width: 768px) {
  body {
    padding: 10px;
    font-size: 16px;
  }

  .film-container {
    flex-direction: column;
    align-items: center;
  }

  .poster-container {
    width: 100%;
    text-align: center;
  }

  .poster-container img {
    width: 100%;
    height: auto;
  }

  .info-container {
    width: 100%;
    max-width: 100%;
    padding: 0 10px;
  }

  .form-wrapper {
    margin: 20px auto;
    padding: 15px;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 10px 0;
  }

  .poster-year-badge {
    top: 7px;
    right: 7px;
    min-width: 38px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .similar-grid {
    flex-direction: column;
    align-items: center;
  }

  form input, form textarea {
    font-size: 16px;
  }

  form button {
    font-size: 16px;
    width: 100%;
  }

  .tags {
    justify-content: center;
  }
}

/* 🎥 Lightbox for screenshots */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 0 20px #000;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 30px;
  padding: 0 10px;
}

.tag {
  background-color: #f3f4f6;
  color: #111827;
  padding: 6px 20px; /* чуть шире */
  border-radius: 999px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  white-space: nowrap; /* 🔒 не переносить */
  display: inline-block;
}

.tag:hover {
  background-color: #e5e7eb;
  transform: translateY(-2px);
}

/* -------------------------------------- */
/* Film Page Refresh                      */
/* -------------------------------------- */
.film-page {
  --similar-card-width: 160px;
  --similar-gap: 14px;
  --similar-row-width: calc(var(--similar-card-width) * 5 + var(--similar-gap) * 4);
  --film-main-max: 1040px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 8px 0 24px;
}

.film-page .film-container {
  background:
    radial-gradient(1200px 300px at 95% -20%, rgba(30, 133, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid #e3ebf5;
  border-radius: 20px;
  padding: 20px;
  gap: 26px;
  box-shadow: 0 14px 34px rgba(28, 44, 68, 0.08);
  align-items: stretch;
  width: 100%;
  max-width: var(--film-main-max);
  box-sizing: border-box;
  margin: 0 auto;
}

.film-page .film-poster-card {
  background: #ffffff;
  border: 1px solid #e4eaf2;
  border-radius: 16px;
  padding: 14px 14px 16px;
  box-shadow: 0 10px 24px rgba(26, 39, 60, 0.08);
}

.film-page .film-poster-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.film-page #rating-section {
  margin-top: 14px !important;
  padding: 10px;
  border-radius: 12px;
  background: #f6f9ff;
  border: 1px solid #dce7ff;
}

.film-page #stars {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
}

.film-page .star {
  transition: transform 0.18s ease, text-shadow 0.18s ease;
  color: #f4b400;
}

.film-page .star:hover {
  transform: translateY(-2px) scale(1.06);
  text-shadow: 0 4px 12px rgba(244, 180, 0, 0.35);
}

.film-page .film-info-card {
  background: #ffffff;
  border: 1px solid #e4eaf2;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 10px 24px rgba(26, 39, 60, 0.06);
}

.film-page .film-title {
  font-size: 38px;
  line-height: 1.16;
  margin-bottom: 14px;
  letter-spacing: -0.4px;
}

.film-page .info-container p {
  margin: 8px 0;
  line-height: 1.55;
}

.film-page .film-views-badge {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #c7dcff;
  background: linear-gradient(180deg, #eef5ff 0%, #e0ecff 100%);
  box-shadow: 0 8px 18px rgba(24, 63, 120, 0.12);
}

.film-page .film-views-icon {
  color: #2b5fa8;
  font-size: 16px;
  line-height: 1;
}

.film-page .film-views-value {
  font-size: 18px;
  font-weight: 800;
  color: #12396f;
  line-height: 1;
}

.film-page .tag-chip {
  background: linear-gradient(180deg, #f4f8ff 0%, #e9f1ff 100%);
  border: 1px solid #d4e2ff;
  color: #1b4c9a;
  font-weight: 600;
}

.film-page .tag-chip:hover {
  background: linear-gradient(180deg, #e8f1ff 0%, #dce9ff 100%);
  text-decoration: none;
}

.film-page .film-section {
  background: #ffffff;
  border: 1px solid #e4eaf2;
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(26, 39, 60, 0.06);
  padding: 18px 20px;
  width: 100%;
  max-width: var(--film-main-max);
  box-sizing: border-box;
  margin: 30px auto 0;
}

.film-page .film-description p {
  font-size: 16px;
  line-height: 1.72;
  color: #2a3444;
  margin-bottom: 0;
  max-width: none;
}

.film-page .film-trailer {
  text-align: center;
}

.film-page .film-pagination {
  text-align: center;
}

.film-page .film-screenshots img {
  border: 1px solid #d8e0ec;
  box-shadow: 0 8px 18px rgba(24, 38, 56, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.film-page .film-screenshots img:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 22px rgba(20, 36, 58, 0.18);
}

.film-page .film-trailer iframe {
  width: 100%;
  max-width: calc(var(--film-main-max) - 40px);
  height: clamp(220px, 43vw, 460px);
  border-radius: 12px;
  border: 1px solid #d8e0ec;
  box-shadow: 0 14px 28px rgba(22, 34, 53, 0.18);
}

.film-page .film-similar .similar-grid {
  display: grid;
  grid-template-columns: repeat(5, var(--similar-card-width));
  gap: var(--similar-gap);
  width: min(100%, var(--similar-row-width));
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.film-page .film-similar .film-card {
  width: var(--similar-card-width);
  min-width: var(--similar-card-width);
  max-width: var(--similar-card-width);
}

.film-page .film-similar .film-card a {
  display: block;
}

.film-page .film-similar .film-card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(16, 27, 43, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.film-page .film-similar .film-card:hover img {
  transform: translateY(-4px);
  box-shadow: 0 14px 26px rgba(14, 24, 38, 0.22);
}

.film-page .film-similar .film-name {
  height: auto;
  min-height: 34px;
  margin-top: 7px;
}

.film-page .film-comment-form form,
.film-page .film-comments > div {
  margin-top: 12px;
}

.film-page .film-comment-form input,
.film-page .film-comment-form textarea {
  border: 1px solid #ced7e5;
  border-radius: 10px;
  background: #fdfefe;
}

.film-page .film-comment-form button {
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.film-page .film-comments [style*="border: 1px solid #ddd"] {
  border: 1px solid #dbe3ef !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 6px 14px rgba(20, 32, 50, 0.06);
}

.film-page .film-pagination a,
.film-page .film-pagination strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  border: 1px solid #d0d7e2;
  background: #fff;
}

.film-page .film-pagination strong {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

@media (max-width: 768px) {
  .film-page {
    padding: 0 0 16px;
  }

  .film-page .film-container {
    border-radius: 14px;
    padding: 12px;
    gap: 14px;
  }

  .film-page .film-poster-card,
  .film-page .film-info-card,
  .film-page .film-section {
    border-radius: 12px;
    padding: 12px;
    margin-top: 18px;
  }

  .film-page .film-title {
    font-size: 28px;
    line-height: 1.2;
  }

  .film-page .film-description p {
    font-size: 15px;
    line-height: 1.62;
  }

  .film-page .film-similar .similar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 12px;
  }

  .film-page .film-similar .film-card {
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .film-page .film-pagination a,
  .film-page .film-pagination strong {
    min-width: 30px;
    height: 30px;
    font-size: 14px;
  }
}

.comment-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.comment-user-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #d3deef;
  flex: 0 0 auto;
}

.comment-user-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf3ff;
  color: #44618d;
  font-size: 12px;
  font-weight: 700;
}

.comment-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.comment-auth-btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.comment-auth-login {
  background: linear-gradient(180deg, #1f7aff 0%, #0f62df 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(16, 85, 179, 0.2);
}

.comment-auth-login:hover {
  background: linear-gradient(180deg, #1a6de4 0%, #0b54c4 100%);
}

.comment-auth-register {
  background: #fff;
  color: #0f62df;
  border-color: #b7cff5;
}

.comment-auth-register:hover {
  background: #eef5ff;
  border-color: #9dbff0;
}

@media (max-width: 768px) {
  .comment-auth-btn {
    width: 100%;
    justify-content: center;
  }
}
