/* Comment Replies Styling */

.comments-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.no-comments {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

.comment-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card, rgba(30, 30, 30, 0.5));
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.comment-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.comment-content {
    padding: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* Link do profilu publicznego – nie zmienia wyglądu nicku */
a.comment-author-profile-link {
    color: inherit;
    text-decoration: none;
    display: inline;
}
a.comment-author-profile-link:hover .author-name {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Role-based colors for author names */
.author-name.role-admin {
    color: #ff4444;
}

.author-name.role-moderator {
    color: #4488ff;
}

.author-name.role-user {
    color: #44ff88;
}

.comment-date {
    font-size: 0.8125rem;
    color: #ff9944;
}

.comment-text {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    word-wrap: break-word;
}

.comment-delete-btn {
    background: transparent;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-delete-btn:hover {
    background: rgba(255, 68, 68, 0.1);
    color: #ff6666;
}

.comment-replies {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
}

.comment-item[data-level="0"] {
    margin-bottom: 1.5rem;
}

/* Flat design - odpowiedzi z subtelnym tłem zamiast wcięć */
.comment-item[data-level="1"] {
    background: rgba(99, 102, 241, 0.05);
    border-left: 3px solid rgba(99, 102, 241, 0.4);
    margin-left: 0;
}

.comment-item[data-level="2"] {
    background: rgba(139, 92, 246, 0.05);
    border-left: 3px solid rgba(139, 92, 246, 0.4);
    margin-left: 0;
}

.comment-item[data-level="3"] {
    background: rgba(168, 85, 247, 0.05);
    border-left: 3px solid rgba(168, 85, 247, 0.4);
    margin-left: 0;
}

/* Tag odpowiedzi */
.reply-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: #8b87ff;
    margin-bottom: 0.5rem;
}

.reply-tag i {
    font-size: 0.65rem;
}

.reply-tag .reply-to-user {
    font-weight: 600;
    color: #a5a1ff;
}

/* Przycisk toggle dla odpowiedzi */
.replies-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 0.5rem;
    color: #8b87ff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.replies-toggle:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateX(2px);
}

.replies-toggle i {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.replies-toggle.expanded i {
    transform: rotate(90deg);
}

.replies-toggle .replies-count {
    background: rgba(99, 102, 241, 0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
    color: #a5a1ff;
}

/* Ukryte odpowiedzi */
.comment-replies.collapsed {
    display: none;
}

.comment-replies.expanded {
    display: block;
    animation: slideDown 0.3s ease;
}

/* Load more button */
.load-more-comments {
    list-style: none;
    padding: 1.5rem 0;
    margin: 0;
    display: flex;
    justify-content: center;
    border-bottom: none;
}

.load-more-btn {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
    padding: 0.875rem 1.75rem;
    border-radius: 0.625rem;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    position: relative;
    overflow: hidden;
}

.load-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    transition: left 0.5s ease;
}

.load-more-btn:hover::before {
    left: 100%;
}

.load-more-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn i {
    color: rgba(99, 102, 241, 0.8);
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.load-more-btn:hover i {
    transform: translateY(2px);
}

.load-more-btn .remaining-count {
    font-size: 0.8125rem;
    color: rgba(99, 102, 241, 0.7);
    font-weight: 400;
}

.comment-reply-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
}

.comment-reply-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary, #6366f1);
    transform: translateY(-2px);
}

.comment-reply-btn:active {
    transform: translateY(0);
}

.comment-reply-btn i {
    font-size: 0.85rem;
}

.reply-indicator {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-left: 3px solid var(--primary, #6366f1);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: 0.875rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reply-indicator i {
    color: var(--primary, #6366f1);
    margin-right: 0.5rem;
}

.reply-indicator strong {
    color: var(--primary, #6366f1);
}

.reply-indicator button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.reply-indicator button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.comment-react-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.comment-react-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.comment-reactions {
    display: none;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.5rem;
    flex-wrap: wrap;
}

.comment-reactions.show {
    display: flex;
}

.comment-reactions .reaction-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-reactions .reaction-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.comment-reactions .reaction-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: #6366f1;
}

.reaction-summary {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.reaction-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.reaction-summary-item.user-reacted {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.reaction-emoji {
    font-size: 1rem;
}

.reaction-count {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

/* Reactions Container - chmurka z reakcjami */
.reactions-container {
    position: relative;
    display: inline-block;
}

.reaction-main-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 13px;
    height: 36px;
}

.reaction-main-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.reaction-main-btn.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.4);
}

.reaction-picker {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;
    background: rgba(30, 30, 45, 0.98);
    border: 2px solid rgba(99, 102, 241, 0.5);
    border-radius: 26px;
    padding: 7px;
    display: flex;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}

.reactions-container:hover .reaction-picker,
.reactions-container .reaction-main-btn.show-picker + .reaction-picker {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
}

.reaction-picker::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 24px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(30, 30, 45, 0.98);
}

.reaction-picker::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.reaction-option {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.reaction-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.3) translateY(-3px);
}

.reaction-option.selected {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.reaction-option .emoji {
    font-size: 22px;
    line-height: 1;
    filter: grayscale(20%);
    transition: filter 0.3s;
}

.reaction-option:hover .emoji,
.reaction-option.selected .emoji {
    filter: grayscale(0%);
}

.reaction-option .mini-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary, #6366f1);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    border: 2px solid rgba(30, 30, 45, 0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .comment-item {
        padding: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .comment-replies {
        margin-left: 0.75rem;
        padding-left: 0.5rem;
        border-left-width: 1px;
    }
    
    .author-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .author-name {
        font-size: 0.875rem;
    }
    
    .comment-date {
        font-size: 0.75rem;
    }
    
    .comment-text {
        font-size: 0.9375rem;
    }
    
    .reply-indicator {
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .reply-indicator button {
        align-self: flex-end;
    }
    
    .comment-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .comment-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .comment-reply-btn {
        width: 32px;
        height: 32px;
    }
    
    .comment-reply-btn i {
        font-size: 0.8rem;
    }
    
    .load-more-comments {
        padding: 1rem 0;
    }
    
    .load-more-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        gap: 0.5rem;
    }
    
    .load-more-btn .remaining-count {
        font-size: 0.75rem;
    }
    
    .reaction-main-btn {
        height: 32px;
        padding: 0 10px;
        font-size: 12px;
    }
    
    .reactions-container {
        position: relative;
    }
    
    .reaction-picker {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(10px);
        padding: 6px 8px;
        gap: 4px;
        width: max-content;
        max-width: calc(100vw - 40px);
        white-space: nowrap;
    }
    
    .reactions-container:hover .reaction-picker,
    .reactions-container .reaction-main-btn.show-picker + .reaction-picker {
        transform: translateX(-50%) translateY(0);
    }
    
    .reaction-picker::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .reaction-option {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .reaction-option .emoji {
        font-size: 20px;
    }
    
    .reaction-option:hover {
        transform: scale(1.2);
    }
    
    .comment-delete-btn {
        padding: 0.25rem;
    }
}

@media (max-width: 480px) {
    .comment-item {
        padding: 0.75rem;
        border-radius: 0.5rem;
    }
    
    .comment-header {
        flex-wrap: wrap;
    }
    
    .author-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    
    .comment-text {
        font-size: 0.875rem;
    }
    
    /* Flat design - wszystkie komentarze równo */
    .comment-item[data-level="1"],
    .comment-item[data-level="2"],
    .comment-item[data-level="3"] {
        margin-left: 0 !important;
        padding-left: 0.75rem !important;
    }
    
    .reply-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .replies-toggle {
        font-size: 0.8125rem;
        padding: 0.4rem 0.6rem;
    }
    
    .replies-toggle .replies-count {
        font-size: 0.75rem;
    }
    
    .comment-reply-btn {
        width: 30px;
        height: 30px;
    }
    
    .reaction-main-btn {
        height: 30px;
        padding: 0 8px;
        font-size: 11px;
    }
    
    .reaction-option {
        width: 36px;
        height: 36px;
    }
    
    .reaction-option .emoji {
        font-size: 16px;
    }
}

/* Post reactions container */
.post-reactions-container {
    position: relative;
    display: inline-block;
}

.post-reactions-container .reaction-main-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.post-reactions-container .reaction-main-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.post-reactions-container .reaction-main-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.6);
}

.post-reactions-container .reaction-picker {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;
    background: rgba(30, 30, 45, 0.98);
    border: 2px solid rgba(99, 102, 241, 0.5);
    border-radius: 26px;
    padding: 7px;
    display: flex;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 100;
}

.post-reactions-container:hover .reaction-picker,
.post-reactions-container .reaction-main-btn.show-picker + .reaction-picker {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
}

.post-reactions-container .reaction-picker::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 24px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(99, 102, 241, 0.5);
}

.post-reactions-container .reaction-option {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.post-reactions-container .reaction-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.3) translateY(-3px);
}

.post-reactions-container .reaction-option.selected {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.post-reactions-container .reaction-option .emoji {
    font-size: 22px;
    line-height: 1;
    filter: grayscale(20%);
    transition: filter 0.3s;
}

.post-reactions-container .reaction-option:hover .emoji,
.post-reactions-container .reaction-option.selected .emoji {
    filter: grayscale(0%);
}

.post-reactions-container .reaction-option .mini-count {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: rgba(99, 102, 241, 0.9);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.25rem;
    border-radius: 0.5rem;
    min-width: 1rem;
    text-align: center;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .comment-replies {
        border-left-color: rgba(99, 102, 241, 0.4);
    }
    
    .comment-item[data-level="1"] .comment-content,
    .comment-item[data-level="2"] .comment-content,
    .comment-item[data-level="3"] .comment-content {
        background: rgba(0, 0, 0, 0.2);
    }
}
