/**
 * Game Comments Styling
 * Unified section design with connected comments
 */

.cas-comments-section {
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.cas-comments-header {
    margin-bottom: 1rem;
}

.cas-comments-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: oklch(0.7451 0.167 183.61); /* Primary color */
    margin: 0;
}

.cas-comments-count {
    color: oklch(0.7451 0.167 183.61);
}

/* Comment Form - Simple, no box */
.cas-comment-form {
    margin-bottom: 1.5rem;
}

.cas-comment-form-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cas-comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.cas-comment-author-name {
    font-weight: 600;
    color: #fff;
}

.cas-comment-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid oklch(0.2569 0.0122 257.46);
    border-radius: 0.5rem;
    background: oklch(0.1313 0.0152 257.47); /* base-100 */
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.cas-comment-textarea:focus {
    outline: none;
    border-color: oklch(0.7451 0.167 183.61);
}

.cas-comment-textarea::placeholder {
    color: oklch(0.5961 0.0115 257.54);
}

.cas-comment-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.cas-comment-char-count {
    font-size: 0.875rem;
    color: oklch(0.5961 0.0115 257.54);
}

.cas-submit-comment-btn {
    min-width: 120px;
}

.cas-comment-message {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    display: none;
}

.cas-comment-message.success {
    display: block;
    background: oklch(0.7206 0.191 142.46);
    color: oklch(0.1313 0.0152 257.47);
}

.cas-comment-message.error {
    display: block;
    background: oklch(0.5827 0.248 29.23);
    color: #fff;
}

/* Login Prompt - Simple, no box */
.cas-login-prompt {
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.cas-login-prompt p {
    margin: 0;
    color: oklch(0.9294 0.0152 257.47);
    font-weight: 400;
    font-size: 0.9375rem;
}

.cas-login-prompt a {
    color: oklch(0.7451 0.167 183.61);
    text-decoration: underline;
    font-weight: 600;
}

/* Comments List - Unified container */
.cas-comments-list {
    background: oklch(0.1569 0.0122 257.46); /* base-300 */
    border-radius: 0.5rem 0.5rem 0 0; /* Top corners rounded, bottom will connect to pagination */
    padding: 1.5rem;
    margin-top: 0;
}

.cas-comments-loading {
    text-align: center;
    padding: 2rem;
    color: oklch(0.5961 0.0115 257.54);
}

.cas-comment-item {
    padding: 1.25rem 0;
    border-bottom: 1px solid oklch(0.2569 0.0122 257.46);
}

.cas-comment-item:first-child {
    padding-top: 0;
}

.cas-comment-item:last-child {
    border-bottom: none;
}

.cas-comment-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Vote Buttons */
.cas-vote-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 40px;
    flex-shrink: 0;
}

.cas-vote-btn {
    background: none;
    border: none;
    color: oklch(0.5961 0.0115 257.54);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s, transform 0.1s;
    line-height: 1;
}

.cas-vote-btn:hover {
    color: oklch(0.7451 0.167 183.61);
}

.cas-vote-btn.active.cas-upvote {
    color: oklch(0.7206 0.191 142.46); /* Green */
}

.cas-vote-btn.active.cas-downvote {
    color: oklch(0.5827 0.248 29.23); /* Red */
}

.cas-vote-btn:active {
    transform: scale(0.9);
}

.cas-vote-score {
    font-size: 0.875rem;
    font-weight: 600;
    color: oklch(0.9294 0.0152 257.47);
    min-width: 30px;
    text-align: center;
}

.cas-vote-readonly {
    pointer-events: none;
}

.cas-vote-btn-placeholder {
    font-size: 1.25rem;
    color: oklch(0.3961 0.0115 257.54); /* Dimmed */
    opacity: 0.3;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.cas-vote-readonly .cas-vote-score {
    color: oklch(0.9294 0.0152 257.47);
}

.cas-comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.cas-comment-actions {
    margin-left: auto;
}

.cas-comment-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.cas-comment-author-info {
    display: flex;
    flex-direction: column;
}

.cas-comment-author-username {
    font-weight: 600;
    color: #fff;
    font-size: 0.9375rem;
}

.cas-comment-date {
    font-size: 0.8125rem;
    color: oklch(0.5961 0.0115 257.54);
}

.cas-comment-actions {
    display: flex;
    gap: 0.5rem;
}

.cas-comment-action-btn {
    background: none;
    border: none;
    color: oklch(0.5961 0.0115 257.54);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: color 0.2s, background-color 0.2s;
}

.cas-comment-action-btn:hover {
    color: oklch(0.7451 0.167 183.61);
    background: oklch(0.2569 0.0122 257.46);
}

.cas-comment-action-btn.delete:hover {
    color: oklch(0.5827 0.248 29.23);
}

.cas-comment-content {
    color: oklch(0.9294 0.0152 257.47);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    margin-left: calc(40px + 0.75rem); /* Align with vote buttons width + gap */
    margin-top: -2.5rem; /* Pull up to align with down arrow area */
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cas-comment-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: calc(40px + 0.75rem); /* Align with vote buttons */
}

.cas-reply-btn {
    background: none;
    border: none;
    color: oklch(0.7451 0.167 183.61);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0;
    transition: opacity 0.2s;
}

.cas-reply-btn:hover {
    opacity: 0.8;
}

.cas-view-replies-btn {
    background: none;
    border: none;
    color: oklch(0.5961 0.0115 257.54);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    transition: color 0.2s;
}

.cas-view-replies-btn:hover {
    color: oklch(0.7451 0.167 183.61);
}

/* Reply Form */
.cas-reply-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid oklch(0.2569 0.0122 257.46);
    display: none;
}

.cas-reply-form.active {
    display: block;
}

.cas-reply-textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.625rem;
    border: 1px solid oklch(0.2569 0.0122 257.46);
    border-radius: 0.375rem;
    background: oklch(0.1313 0.0152 257.47);
    color: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
}

.cas-reply-textarea:focus {
    outline: none;
    border-color: oklch(0.7451 0.167 183.61);
}

.cas-reply-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Replies List */
.cas-replies-list {
    margin-top: 1rem;
    padding-left: 2.5rem;
    border-left: 2px solid oklch(0.2569 0.0122 257.46);
    display: none;
}

.cas-replies-list.active {
    display: block;
}

.cas-reply-item {
    padding: 1rem 0;
    border-bottom: 1px solid oklch(0.2569 0.0122 257.46);
}

.cas-reply-item:first-child {
    padding-top: 0.5rem;
}

.cas-reply-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Pagination */
.cas-comments-pagination {
    text-align: center;
    padding: 1rem 1.5rem;
    background: oklch(0.1569 0.0122 257.46);
    border-radius: 0 0 0.5rem 0.5rem;
    margin-top: 0;
    border-top: 1px solid oklch(0.2569 0.0122 257.46);
}

.cas-load-more-comments {
    min-width: 200px;
}

/* Edit Mode */
.cas-comment-edit-form {
    display: none;
    margin-left: calc(40px + 0.75rem); /* Align with vote buttons */
}

.cas-comment-edit-form.active {
    display: block;
}

.cas-comment-content.editing {
    display: none;
}

.cas-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.625rem;
    border: 1px solid oklch(0.2569 0.0122 257.46);
    border-radius: 0.375rem;
    background: oklch(0.1313 0.0152 257.47);
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.cas-edit-textarea:focus {
    outline: none;
    border-color: oklch(0.7451 0.167 183.61);
}

.cas-edit-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .cas-replies-list {
        padding-left: 1rem;
    }

    .cas-comment-item,
    .cas-reply-item {
        padding: 1rem 0;
    }

    .cas-comment-content,
    .cas-comment-footer,
    .cas-comment-edit-form {
        margin-left: calc(40px + 0.75rem); /* Keep alignment on mobile */
    }

    .cas-comment-actions {
        margin-left: auto;
    }
}
