@use "../../scss/globals.scss";

.game-details {
  &__reviews-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(globals.$spacing-unit * 2);

    @media (max-width: 768px) {
      flex-direction: column;
      align-items: flex-start;
      gap: calc(globals.$spacing-unit * 1.5);
    }
  }

  &__reviews-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: globals.$muted-color;
    margin: 0;
  }

  &__review-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
  }

  &__review-form-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  &__review-score-container {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  &__review-score-select {
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition:
      border-color 0.2s ease,
      background-color 0.2s ease;

    &:focus {
      outline: none;
    }

    &--red {
      border-color: #e74c3c;
      background-color: rgba(231, 76, 60, 0.1);
    }

    &--yellow {
      border-color: #f39c12;
      background-color: rgba(243, 156, 18, 0.1);
    }

    &--green {
      border-color: #27ae60;
      background-color: rgba(39, 174, 96, 0.1);
    }

    option {
      background-color: #2a2a2a;
      color: #ffffff;
    }
  }

  &__star-rating {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  &__star {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;

    &:hover {
      color: #ffffff;
      background-color: rgba(255, 255, 255, 0.1);
      transform: scale(1.1);
    }

    &--filled {
      color: #ffffff;

      &.game-details__review-score-select--red {
        color: #e74c3c;
      }

      &.game-details__review-score-select--yellow {
        color: #f39c12;
      }

      &.game-details__review-score-select--green {
        color: #27ae60;
      }
    }

    &--empty {
      color: #666666;

      &:hover {
        color: #ffffff;
      }
    }

    svg {
      fill: currentColor;
    }
  }

  &__review-input-container {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background-color: globals.$dark-background-color;
    overflow: hidden;
  }

  &__review-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: globals.$background-color;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  &__review-editor-toolbar {
    display: flex;
    gap: 4px;
  }

  &__editor-button {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #ffffff;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;

    &:hover {
      background-color: rgba(255, 255, 255, 0.08);
      border-color: rgba(255, 255, 255, 0.2);
    }

    &.is-active {
      background-color: globals.$brand-blue;
      border-color: globals.$brand-blue;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  &__review-char-counter {
    font-size: 12px;
    color: #888888;

    .over-limit {
      color: #ff6b6b;
    }
  }

  &__review-input {
    min-height: 120px;
    padding: 12px;
    cursor: text;

    .ProseMirror {
      outline: none;
      color: #ffffff;
      font-size: 14px;
      line-height: 1.5;
      min-height: 96px; // 120px - 24px padding
      width: 100%;
      cursor: text;

      &:focus {
        outline: none;
      }

      p {
        margin: 0 0 8px 0;

        &:last-child {
          margin-bottom: 0;
        }
      }

      strong {
        font-weight: bold;
      }

      em {
        font-style: italic;
      }

      u {
        text-decoration: underline;
      }
    }
  }
}
