#comments {
  margin-top: 40px;
  padding: 20px;
  direction: rtl;

  /* Comments List */
  .comments-list {
    margin-bottom: 30px;

    .comment-item {
      display: flex;
      flex-direction: column;
      margin-bottom: 20px;
      padding-bottom: 20px;
      border-bottom: 1px solid var(--border);

      .comment-avatar {
        margin-left: 15px;

        img {
          border-radius: 50%;
          width: 50px;
          height: 50px;
        }
      }

      .comment-content {
        flex: 1;

        .comment-meta {
          display: flex;
          justify-content: space-between;
          margin-bottom: 10px;

          .comment-author {
            font-weight: bold;
            color: var(--text);

            .comment-rating-display {
              display: inline-block;
              margin-right: 10px;

              .star {
                color: #ddd;
                font-size: 14px;

                &.filled {
                  color: var(--gold);
                }
              }
            }
          }

          .comment-date {
            color: var(--text-gray);
            font-size: 12px;
          }
        }

        .comment-text {
          margin-bottom: 10px;
          line-height: 1.6;
          color: var(--text-gray);
        }

        .comment-actions {
          text-align: left;

          .comment-reply-link {
            color: var(--gold);
            text-decoration: none;
            font-size: 12px;
          }
        }
      }
    }
  }

  /* Comment Navigation */
  .comment-navigation {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;

    a {
      color: var(--gold);
      text-decoration: none;
    }
  }

  /* Nested Comments */
  .comment-item {
    .children {
      margin-right: 50px;
      padding-top: 20px;

      .comment-item {
        border-bottom: none;
        border-top: 1px solid var(--border);
        padding-top: 20px;
        padding-bottom: 0;
        margin-bottom: 0;
      }
    }
  }

  /* Cancel Reply */
  #cancel-comment-reply-link {
    color: var(--text-gray);
    font-size: 12px;
    margin-right: 10px;
    text-decoration: none;

    &:hover {
      color: var(--gold);
    }
  }
}

/* Comment Form */
.comment-respond {
  margin-top: 30px;

  .comment-reply-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text);
  }

  .comment-notes {
    margin-bottom: 20px;
    color: var(--text-gray);
    font-size: 13px;
  }

  .comment-form-author,
  .comment-form-email {
    width: 50%;
  }

  .comment-form-author,
  .comment-form-email,
  .comment-form-comment {
    margin-bottom: 15px;

    input[type="text"],
    input[type="email"],
    textarea {
      width: 100%;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 4px;
      font-family: inherit;

      &.error {
        border-color: #ff6b6b;
      }
    }
  }

  .comment-form-comment textarea {
    height: 150px;
    resize: vertical;
  }

  .error-message {
    color: #ff6b6b;
    margin-bottom: 15px;
    font-size: 13px;
  }

  .form-submit {
    text-align: left;

    input[type="submit"] {
      background-color: var(--gold);
      color: white;
      border: none;
      padding: 10px 20px;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.3s;

      &:hover {
        background-color: var(--gold-dark);
      }
    }
  }

  /* Comment Rating */
  .comment-rating {
    margin-bottom: 15px;

    p {
      margin-bottom: 5px;
      color: var(--text-gray);
    }

    .rating-stars {
      display: flex;
      flex-direction: row-reverse;
      justify-content: flex-end;

      input {
        display: none;
      }

      label {
        cursor: pointer;
        color: #ddd;
        font-size: 20px;
        padding: 0 2px;

        &:before {
          content: "★";
        }
      }

      input:checked ~ label {
        color: var(--gold);
      }

      &:hover {
        label:hover,
        label:hover ~ label {
          color: var(--gold);
        }
      }
    }
  }
}

/* Product Rating Display */
.product-rating {
  display: flex;
  align-items: center;
  margin: 10px 0;
  justify-content: center;

  .star {
    color: #ddd;
    font-size: 18px;
    margin: 0 1px;

    &.filled {
      color: var(--gold);
    }

    &.half-filled {
      position: relative;
      color: #ddd;

      &:before {
        content: "★";
        position: absolute;
        left: 0;
        top: 0;
        width: 50%;
        overflow: hidden;
        color: var(--gold);
      }
    }
  }

  .rating-value {
    margin-right: 10px;
    color: var(--text-gray);
    font-size: 14px;
  }
}
