/* WPUF User Comments Block Styles */

/* Comments Container */
.wpuf-user-comments {
    --wpuf-comments-font-size: 0.95rem;
    --wpuf-comments-spacing: 1rem;
    --wpuf-comments-text-color: var(--wp--preset--color--foreground, #404040);
    --wpuf-comments-link-color: var(--wp--preset--color--primary, #0073aa);
    --wpuf-comments-meta-color: #666;
    --wpuf-comments-border-color: #e0e0e0;
    --wpuf-comments-bg-color: #f9f9f9;
}

.wpuf-comments-container {
    margin-bottom: var(--wpuf-comments-spacing);
}

/* Section Label */
.wpuf-comments-label {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--wpuf-comments-text-color);
}

/* Comment Item Base */
.wpuf-comment-item {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--wpuf-comments-bg-color);
    border-radius: 8px;
    border-left: 3px solid var(--wpuf-comments-link-color);
    transition: background-color 0.2s ease;
    display: flex;
}

.wpuf-comment-item:last-child {
    margin-bottom: 0;
}

.wpuf-comment-item:hover {
    background: #f0f0f0;
}

/* Comment Avatar */
.wpuf-comment-avatar {
    flex-shrink: 0;
}

.wpuf-comment-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--wpuf-comments-border-color);
}

/* Comment Content */
.wpuf-comment-content {
    flex: 1;
    min-width: 0;
}

.wpuf-comment-content p {
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
    color: var(--wpuf-comments-text-color);
    font-size: var(--wpuf-comments-font-size);
}

/* Comment Meta */
.wpuf-comment-meta {
    display: flex;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--wpuf-comments-meta-color);
    margin-top: 0.5rem;
}

.wpuf-comment-post,
.wpuf-comment-date {
    display: flex;
    align-items: center;
}

.wpuf-comment-post a {
    color: var(--wpuf-comments-link-color);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.wpuf-comment-post a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Layout Variations */

/* List Layout (default) */
.wpuf-layout-list .wpuf-comment-item {
    display: flex;
    align-items: flex-start;
}

/* Compact Layout */
.wpuf-layout-compact .wpuf-comment-item {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-left-width: 2px;
}

.wpuf-layout-compact .wpuf-comment-content p {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.wpuf-layout-compact .wpuf-comment-meta {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Card Layout */
.wpuf-layout-card .wpuf-comment-item {
    background: white;
    border: 1px solid var(--wpuf-comments-border-color);
    border-left: 3px solid var(--wpuf-comments-link-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
}

.wpuf-layout-card .wpuf-comment-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

/* Minimal Layout */
.wpuf-layout-minimal .wpuf-comment-item {
    background: none;
    border: none;
    border-bottom: 1px solid var(--wpuf-comments-border-color);
    border-radius: 0;
    padding: 1rem 0;
}

.wpuf-layout-minimal .wpuf-comment-item:last-child {
    border-bottom: none;
}

.wpuf-layout-minimal .wpuf-comment-item:hover {
    background: none;
}

/* Empty State */
.wpuf-comments-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
    background: var(--wpuf-comments-bg-color);
    border-radius: 8px;
    border: 1px dashed var(--wpuf-comments-border-color);
}

/* Without Avatar Styles */
.wpuf-user-comments:not(.wpuf-show-avatar) .wpuf-comment-avatar {
    display: none;
}

.wpuf-user-comments:not(.wpuf-show-avatar) .wpuf-comment-item {
    gap: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wpuf-user-comments {
        --wpuf-comments-font-size: 0.9rem;
        --wpuf-comments-spacing: 0.75rem;
    }

    .wpuf-comments-label {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .wpuf-comment-item {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }

    .wpuf-comment-content p {
        font-size: 0.875rem;
    }

    .wpuf-comment-meta {
        gap: 0.5rem;
        font-size: 0.8125rem;
    }

    .wpuf-comment-avatar img {
        width: 28px;
        height: 28px;
    }

    .wpuf-layout-card .wpuf-comment-item {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .wpuf-user-comments {
        --wpuf-comments-font-size: 0.875rem;
    }

    .wpuf-comment-item {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .wpuf-comment-avatar {
        align-self: flex-start;
    }

    .wpuf-comment-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .wpuf-layout-compact .wpuf-comment-item {
        padding: 0.5rem;
    }

    .wpuf-layout-card .wpuf-comment-item {
        padding: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wpuf-comment-item,
    .wpuf-comment-post a {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .wpuf-comments-empty {
        border-color: #000;
        background-color: #fff;
        color: #000;
    }

    .wpuf-comment-item {
        background-color: #fff;
        border-left-color: #000;
        border: 1px solid #000;
    }

    .wpuf-layout-card .wpuf-comment-item {
        border-color: #000;
        background-color: #fff;
    }

    .wpuf-comment-avatar img {
        border-color: #000;
    }
}

/* Print styles */
@media print {
    .wpuf-comment-post a {
        color: inherit;
        text-decoration: underline;
    }

    .wpuf-comment-item {
        background: none;
        border: 1px solid #000;
        box-shadow: none;
        margin-bottom: 0.5rem;
        page-break-inside: avoid;
    }

    .wpuf-layout-card .wpuf-comment-item {
        box-shadow: none;
        background: none;
    }

    .wpuf-comment-avatar img {
        filter: grayscale(100%);
    }
}

/* Theme Integration */
.wp-block-wpuf-user-comments {
    margin-bottom: 1.5rem;
}

/* Block Editor Specific Styles */
.wp-block-editor .wpuf-user-comments {
    min-height: auto;
}

.wp-block-editor .wpuf-comment-item {
    pointer-events: none;
}

.wp-block-editor .wpuf-comment-post a {
    pointer-events: none;
    cursor: default;
}
