/**
 * Advanced Comments System - Matching poem-viewer.css design
 * Black, Navy, Terracotta, Pink - Clean & Minimal
 */

:root {
    /* Use same variables as poem-viewer.css */
    --black-bg: #000000;
    --navy-card: #0a1e43;
    --navy-hover: #1a3a5c;
    --terracotta: #95472d;
    --terracotta-hover: #b86847;
    --pink-active: #6e0f3d;
    --text-white: #FFFFFF;
    --text-grey: #A0A0A0;
    --text-dim: #707070;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.2);
}

/* ============================================================================
   COMMENTS SECTION - MAIN CONTAINER
   ============================================================================ */

.comments-section {
    margin: 60px 0;
    padding: 40px;
    background: var(--navy-card);
    border-radius: 16px;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.comments-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.comments-title .icon {
    font-size: 1.5rem;
}

.comment-count {
    color: var(--text-grey);
    font-weight: 400;
}

.comment-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-grey);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(149, 71, 45, 0.1);
    border-color: var(--terracotta);
    color: var(--terracotta);
}

.filter-btn.active {
    background: rgba(149, 71, 45, 0.1);
    color: var(--terracotta);
    border-color: var(--terracotta);
}

.comment-sort {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 14px;
    cursor: pointer;
}

.comment-sort:focus {
    outline: none;
    border-color: var(--terracotta);
}

/* ============================================================================
   COMMENT FORM
   ============================================================================ */

.comment-form-container {
    margin-bottom: 30px;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comment-input-wrapper {
    position: relative;
}

.comment-input {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 1rem;
    font-family: 'Crimson Pro', Georgia, serif;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
}

.comment-input::placeholder {
    color: var(--text-dim);
}

.comment-input:focus {
    outline: none;
    border-color: var(--terracotta);
    background: rgba(255, 255, 255, 0.08);
}

.commenting-on-verse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(149, 71, 45, 0.1);
    border-radius: 6px;
}

.verse-indicator {
    color: var(--terracotta);
    font-size: 13px;
    font-weight: 600;
}

.clear-verse-selection {
    background: none;
    border: none;
    color: var(--text-grey);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.clear-verse-selection:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.comment-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.cancel-reply-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-grey);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-reply-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
}

.submit-comment-btn {
    padding: 12px 30px;
    background: var(--terracotta);
    border: none;
    border-radius: 8px;
    color: var(--text-white);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-comment-btn:hover {
    background: var(--terracotta-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(149, 71, 45, 0.4);
}

/* Login Prompt */
.login-prompt {
    text-align: center;
    padding: 30px;
    color: var(--text-grey);
}

.login-prompt p {
    margin-bottom: 20px;
}

.login-btn {
    padding: 12px 32px;
    background: var(--terracotta);
    border: none;
    border-radius: 8px;
    color: var(--text-white);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    background: var(--terracotta-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(149, 71, 45, 0.4);
}

.login-prompt a {
    color: var(--terracotta);
    text-decoration: none;
}

.login-prompt a:hover {
    text-decoration: underline;
}

/* ============================================================================
   COMMENTS LIST
   ============================================================================ */

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.comment:hover {
    border-color: var(--border-medium);
}

.comment.highlight-new {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0%, 100% {
        border-color: var(--border-subtle);
    }
    50% {
        border-color: var(--terracotta);
    }
}

/* Threaded Replies */
.comment-reply {
    border-left: 2px solid var(--border-subtle);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    background: var(--terracotta);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-weight: 700;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.comment-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.author-name {
    color: var(--terracotta);
    font-weight: bold;
}

.comment-time {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.verse-reference {
    background: rgba(149, 71, 45, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

.verse-link {
    color: var(--terracotta);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.verse-link:hover {
    text-decoration: underline;
}

/* Comment Body */
.comment-body {
    color: var(--text-grey);
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.verse-quote {
    margin: 16px 0;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--terracotta);
    border-radius: 8px;
}

.verse-quote .arabic {
    display: block;
    font-family: 'UKIJ Merdane', 'HSN Naskh', serif;
    font-size: 1.1rem;
    color: var(--text-white);
    margin-bottom: 8px;
}

.verse-quote .english {
    display: block;
    font-size: 0.95rem;
    color: var(--text-grey);
    font-style: italic;
}

/* Comment Footer Actions */
.comment-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.comment-action {
    background: none;
    border: none;
    color: var(--text-grey);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.comment-action:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.upvote-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}

.upvote-btn.voted {
    color: var(--terracotta);
}

.vote-icon {
    font-size: 16px;
}

.vote-count {
    font-weight: 700;
}

.reply-btn:hover,
.share-btn:hover {
    color: var(--terracotta);
}

.edit-btn:hover {
    color: #FFD700;
}

.delete-btn:hover {
    color: #FF6B6B;
}

/* Reply Form Container */
.reply-form-container {
    margin-top: 12px;
}

/* ============================================================================
   VERSE COMMENT BUTTONS
   ============================================================================ */

.verse-line {
    position: relative;
}

.verse-comment-btn {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(149, 71, 45, 0.1);
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.verse-line:hover .verse-comment-btn {
    opacity: 1;
}

.verse-comment-btn:hover {
    background: rgba(149, 71, 45, 0.2);
    border-color: var(--terracotta);
    transform: translateY(-50%) scale(1.05);
}

.verse-comment-btn.has-comments {
    opacity: 1;
    background: rgba(149, 71, 45, 0.2);
    border-color: var(--terracotta);
}

.verse-line.commenting {
    background: rgba(149, 71, 45, 0.05);
    padding: 8px;
    margin: 4px -8px;
    border-radius: 6px;
    border-left: 3px solid var(--terracotta);
}

/* MOBILE: Always show verse comment buttons */
@media (max-width: 768px) {
    .verse-comment-btn {
        opacity: 0 !important; /* Hide completely on mobile */
        pointer-events: none;
    }

    .verse-comment-btn.has-comments {
        opacity: 0 !important; /* Hide even when comments exist */
    }
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--navy-card);
    border: 1px solid var(--border-medium);
    padding: 16px 24px;
    border-radius: 8px;
    color: var(--text-white);
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 10000;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    border-color: var(--terracotta);
}

.notification.error {
    border-color: #FF6B6B;
}

/* ============================================================================
   EMPTY STATES
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-grey);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 8px;
}

.empty-text {
    color: var(--text-dim);
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .comments-section {
        padding: 30px 20px;
    }

    .comments-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-filters {
        width: 100%;
        flex-wrap: wrap;
    }

    .comment-sort {
        width: 100%;
    }

    .comment-reply {
        margin-left: 0;
        padding-left: 15px;
    }

    .notification {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }

    .comment-footer {
        flex-wrap: wrap;
    }
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-grey);
}
