/* Recent Comments Carousel */

/* Prevent horizontal overflow on container */
.container:has(.recent-comments-section) {
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Mobile: prevent overflow */
@media (max-width: 768px) {
    .container:has(.recent-comments-section) {
        overflow-x: hidden;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Desktop: allow overflow for shadow */
@media (min-width: 1024px) {
    .container:has(.recent-comments-section) {
        overflow-x: visible;
        overflow-y: visible;
    }
}

/* Force all internal elements to respect container width */
.recent-comments-section * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Mobile: ensure all elements stay within bounds */
@media (max-width: 768px) {
    .recent-comments-section * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .recent-comments-header {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .recent-comments-title {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

.recent-comments-section {
    margin-bottom: 0;
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
    overflow-y: visible;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    padding: 10px 0;
}

/* Reduce gap between comments and text below */
.site-main > .container:last-of-type {
    margin-top: 10px !important;
    padding-top: 0 !important;
}

.site-main .text-info {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
}

.page-outer:has(.recent-comments-section) {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.recent-comments-header {
    margin-bottom: 16px;
}

.recent-comments-title {
    color: hsl(var(--color-white-50));
    font-size: var(--font-4xl);
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.recent-comments-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(40, 34, 48, 0.6);
    padding: 20px;
    min-height: 180px;
    width: 100%;
    box-sizing: border-box;
}

/* Desktop: allow overflow for shadow */
@media (min-width: 1024px) {
    .recent-comments-carousel {
        overflow: visible;
    }
}

.recent-comments-track {
    position: relative;
    min-height: 180px;
    height: 180px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Desktop: allow overflow for shadow */
@media (min-width: 1024px) {
    .recent-comments-track {
        overflow: visible;
    }
}

.recent-comment-item {
    width: 100%;
    max-width: 100%;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
    pointer-events: none;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 1;
}

.recent-comment-item.active {
    opacity: 1;
    visibility: visible;
    position: absolute;
    pointer-events: auto;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
    z-index: 2;
}

.recent-comment-card {
    background: linear-gradient(135deg, rgba(52, 45, 62, 0.8) 0%, rgba(74, 55, 99, 0.6) 100%);
    border: 1px solid rgba(255, 158, 253, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.recent-comment-card:hover {
    border-color: rgba(255, 158, 253, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(255, 158, 253, 0.25);
}

/* Desktop: ensure shadow is visible */
@media (min-width: 1024px) {
    .recent-comment-card {
        margin: 0;
    }
    
    .recent-comment-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(255, 158, 253, 0.25);
    }
}

.recent-comment-link {
    display: flex;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.recent-comment-thumbnail {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    min-width: 80px;
    max-width: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 158, 253, 0.3);
    background: rgba(40, 34, 48, 0.8);
    flex-shrink: 0;
    box-sizing: border-box;
}

.recent-comment-thumbnail img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.recent-comment-card:hover .recent-comment-thumbnail img {
    transform: scale(1.05);
}

.recent-comment-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.recent-comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.recent-comment-author,
.recent-comment-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.recent-comment-icon {
    color: #ff9efd;
    flex-shrink: 0;
}

.recent-comment-author-name {
    font-weight: 600;
    color: #ff9efd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    flex: 1;
    min-width: 0;
}

.recent-comment-date {
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    flex: 1;
    min-width: 0;
}

.recent-comment-date time {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
}

.recent-comment-text {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-size: 15px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    word-break: break-word;
    max-height: calc(1.6em * 2);
    min-height: calc(1.6em * 2);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.recent-comment-post {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 158, 253, 0.1);
    font-size: 13px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
}

.recent-comment-post-label {
    color: rgba(255, 255, 255, 0.5);
}

.recent-comment-post-title {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1023px) {
    .recent-comments-section {
        margin-bottom: 0;
        margin-top: 20px;
    }
    
    .site-main > .container:last-of-type {
        margin-top: 10px !important;
    }
    
    .recent-comments-carousel {
        padding: 20px;
        min-height: 200px;
    }
    
    .recent-comments-track {
        min-height: 200px;
        height: 200px;
    }
    
    .recent-comment-card {
        min-height: 200px;
    }
    
    .recent-comment-card {
        padding: 20px;
    }
    
    .recent-comment-link {
        gap: 18px;
    }
    
    .recent-comment-thumbnail {
        flex: 0 0 90px;
        width: 90px;
        height: 90px;
    }
    
    .recent-comment-content {
        gap: 14px;
    }
    
    .recent-comment-meta {
        gap: 20px;
    }
    
    .recent-comment-text {
        font-size: 15px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .recent-comments-section {
        margin-bottom: 0;
        margin-top: 25px;
        max-width: 70%;
        margin-left: auto;
        margin-right: auto;
        padding: 20px 0;
        overflow: visible;
    }
    
    .site-main > .container:last-of-type {
        margin-top: 15px !important;
    }
    
    .recent-comments-carousel {
        padding: 30px;
        min-height: 220px;
        overflow: visible;
        margin: 0;
    }
    
    .recent-comments-track {
        min-height: 220px;
        height: 220px;
        overflow: visible;
        padding: 0;
        margin: 0;
        position: relative;
    }
    
    .recent-comment-item {
        overflow: visible;
        height: auto;
    }
    
    .recent-comment-item.active {
        overflow: visible;
        margin: 0;
        height: auto;
    }
    
    .recent-comment-card {
        overflow: visible;
    }
    
    .recent-comment-card {
        min-height: 220px;
    }
    
    .recent-comment-card {
        padding: 25px;
    }
    
    .recent-comment-link {
        gap: 25px;
    }
    
    .recent-comment-thumbnail {
        flex: 0 0 100px;
        width: 100px;
        height: 100px;
    }
    
    .recent-comment-content {
        gap: 16px;
    }
    
    .recent-comment-meta {
        gap: 24px;
    }
    
    .recent-comment-text {
        font-size: 16px;
        line-height: 1.7;
    }
    
    .recent-comment-author,
    .recent-comment-date {
        font-size: 15px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .recent-comments-section {
        margin-bottom: 0;
        margin-top: 20px;
        overflow-x: hidden;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin-left: 0;
        margin-right: 0;
    }
    
    .recent-comments-section .container {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-left: 0;
        padding-right: 0;
    }
    
    .site-main > .container:last-of-type {
        margin-top: 10px !important;
    }
    
    .recent-comments-title {
        font-size: 20px;
    }
    
    .recent-comments-carousel {
        padding: 15px;
        height: 200px;
        min-height: 200px;
        max-height: 200px;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .recent-comments-track {
        height: 170px;
        min-height: 170px;
        max-height: 170px;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        position: relative;
    }
    
    .recent-comment-item {
        width: 100%;
        max-width: 100%;
        height: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .recent-comment-item.active {
        width: 100%;
        max-width: 100%;
        position: absolute;
    }
    
    .recent-comment-card {
        padding: 16px;
        height: 170px;
        min-height: 170px;
        max-height: 170px;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .recent-comment-link {
        gap: 12px;
        align-items: flex-start;
        height: 100%;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .recent-comment-thumbnail {
        flex: 0 0 60px;
        width: 60px;
        height: 60px;
        min-width: 60px;
        max-width: 60px;
        flex-shrink: 0;
        box-sizing: border-box;
    }
    
    .recent-comment-content {
        gap: 10px;
        min-width: 0;
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        height: 100%;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .recent-comment-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        flex-shrink: 0;
        width: 100%;
        overflow: hidden;
    }
    
    .recent-comment-author,
    .recent-comment-date {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1;
    }
    
    .recent-comment-author-name {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
        flex: 1;
        min-width: 0;
    }
    
    .recent-comment-date time {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }
    
    .recent-comment-text {
        font-size: 14px;
        line-height: 1.5;
        max-height: calc(1.5em * 2);
        min-height: calc(1.5em * 2);
        -webkit-line-clamp: 2;
        flex: 1;
        overflow: hidden;
        word-wrap: break-word;
        word-break: break-word;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .recent-comment-post {
        font-size: 12px;
        padding-top: 10px;
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        min-width: 0;
        box-sizing: border-box;
    }
    
    .recent-comment-post-label {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .recent-comment-post-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        min-width: 0;
        flex: 1;
        display: block;
    }
}
