// Variables
$primary-color: #00a346;
$background-dark: #1c1f23;
$text-white: #ffffff;
$hover-scale: 1.05;
$loading-height: 50vh;

.poster-gallery {
  margin-top: 5rem;
  margin-bottom: 2rem;

  .content-paper {
    padding: 1.5rem;
    border-radius: 4px;
    background-color: $background-dark;
  }

  .lang-filter-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
  }

  .lang-toggle-group {
    border: 1px solid #2c3038 !important;
    border-radius: 4px !important;
    overflow: hidden;
  }

  .lang-toggle-btn {
    color: #667788 !important;
    border: none !important;
    border-left: 1px solid #2c3038 !important;
    padding: 4px 14px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: none !important;
    min-width: unset !important;
    background-color: transparent !important;

    &:first-child {
      border-left: none !important;
    }

    &:hover {
      color: #ffffff !important;
      background-color: rgba(102, 119, 136, 0.15) !important;
    }

    &.Mui-selected {
      color: #ffffff !important;
      background-color: #667788 !important;
    }
  }

  .no-posters-msg {
    color: #667788;
    padding: 3rem 0;
  }

  .title {
    color: $text-white;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 400;
  }

  .poster-card {
    position: relative;
    background-color: transparent;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 4px;
    overflow: hidden;

    &:hover {
      transform: scale($hover-scale);
    }

    &.selected-poster {
      outline: 4px solid $primary-color;
    }

    .check-icon {
      position: absolute;
      top: 0.5rem;
      right: 0.5rem;
      background-color: $primary-color;
      color: $text-white;
      border-radius: 50%;
      padding: 0.25rem;
    }
  }

  .poster-aspect-wrapper {
    position: relative;
    padding-top: 150%;
    border-radius: 4px;
    overflow: hidden;
  }

  .poster-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #1c1f23 25%, #2a2e33 50%, #1c1f23 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    transition: opacity 0.3s ease;

    &--hidden {
      opacity: 0;
      pointer-events: none;
    }
  }

  .poster-image-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;

    &--loaded {
      opacity: 1;
    }
  }

  @keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  .loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: $loading-height;
  }
}
