/* /home/siisi/vertex/media_app/static/css/comment.css */

/* ============================================= */
/* 1. COMMENTS SECTION SCROLLBAR & STYLING       */
/* ============================================= */

/* Beautiful Colored Scrollbar for Comments */
.comments-list {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Webkit browsers (Chrome, Safari, Edge) */
.comments-list::-webkit-scrollbar {
    width: 12px;
}

.comments-list::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 2px solid #f8f9fa;
}

.comments-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--bs-primary) 0%, #0d6efd 100%);
    border-radius: 10px;
    border: 2px solid #f8f9fa;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #0b5ed7 0%, #0a58ca 100%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.comments-list::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #0a58ca 0%, #0a53be 100%);
}

.comments-list::-webkit-scrollbar-corner {
    background: #f8f9fa;
}

/* Firefox */
.comments-list {
    scrollbar-width: thin;
    scrollbar-color: var(--bs-primary) #f8f9fa;
}

/* Smooth scrolling */
.comments-list {
    scroll-behavior: smooth;
}

/* Comment item animations */
.comment-item {
    transition: all 0.3s ease;
    border-left: 3px solid transparent !important;
}

.comment-item:hover {
    border-left-color: var(--bs-primary) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

/* Delete button animation */
.delete-comment-btn {
    transition: all 0.2s ease;
    opacity: 0.7;
}

.delete-comment-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Empty state styling */
.comments-list .text-muted {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.comments-list .text-muted:hover {
    opacity: 1;
}

/* Style for comments that media owner can delete */
.media-owner-comment {
    border-left: 4px solid #ffc107 !important;
    background-color: rgba(255, 193, 7, 0.05);
}

/* Different button styling for media owner deletion */
.btn-outline-warning.delete-comment-btn:hover {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}


/* ============================================= */
/* 2. DYNAMIC ASPECT RATIO VIDEO HANDLING        */
/* ============================================= */

/* Base image wrapper for all media */
.image-wrapper {
    background: #000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Video wrapper - Base Styles */
.image-wrapper.video-wrapper {
    width: 100%;
    /* Default min-height ensures visibility */
    min-height: 400px;
    /* Dark background looks best for portrait on wide screens */
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

/* Adaptive video element */
.adaptive-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

/* Video player container */
.video-player-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* --- LANDSCAPE (16:9, 4:3) --- */
.image-wrapper.video-wrapper.landscape-video {
    aspect-ratio: 16 / 9;
    max-height: 70vh;
}

.image-wrapper.video-wrapper.landscape-video .adaptive-video {
    object-fit: contain;
}

/* --- PORTRAIT (9:16, TikTok style) --- */
.image-wrapper.video-wrapper.portrait-video {
    /* Force a taller container for portrait videos so they don't look tiny */
    height: 85vh;
    min-height: 600px;
}

.image-wrapper.video-wrapper.portrait-video .adaptive-video {
    /* Contain ensures we see the whole video (head to toe) */
    object-fit: contain;
    width: 100%;
    height: 100%;
    /* Optional: Add a subtle shadow to separate video from black bg */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* --- SQUARE (1:1) --- */
.image-wrapper.video-wrapper.square-video {
    aspect-ratio: 1 / 1;
    max-height: 70vh;
}

/* Default Fallback (if JS hasn't run yet) */
.image-wrapper.video-wrapper:not(.landscape-video):not(.portrait-video):not(.square-video) .adaptive-video {
    object-fit: contain;
    aspect-ratio: 16/9;
}


/* ============================================= */
/* 3. IMAGE DISPLAY HANDLING                     */
/* ============================================= */

/* Images: Keep object-fit: contain for proper display */
.image-wrapper:not(.video-wrapper) {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-wrapper:not(.video-wrapper) img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Image display container */
.image-display-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}


/* ============================================= */
/* 4. MISC UI ELEMENTS                           */
/* ============================================= */

/* Ensure the media card doesn't have any content that overlaps */
.media-display-card .card-body {
    display: none;
}

/* Badge for media owner indicator */
.badge.bg-warning {
    font-size: 0.7em;
    padding: 0.25em 0.5em;
}

/* Social overlay adjustments */
.image-wrapper .social-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
    padding: 1rem;
    z-index: 2;
}

/* Ensure social overlay text is visible on all backgrounds */
.social-overlay .text-white {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Video duration badge positioning */
.video-player-container .position-absolute.bottom-0.end-0.m-3 {
    z-index: 3;
}

/* Aspect ratio indicator */
.aspect-ratio-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
}

/* Video loading state */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    z-index: 1;
}

.video-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}


/* ============================================= */
/* 5. RESPONSIVE ADJUSTMENTS                     */
/* ============================================= */

@media (max-width: 768px) {

    /* Image Adjustments */
    .image-wrapper:not(.video-wrapper) {
        min-height: 300px;
    }

    .image-wrapper:not(.video-wrapper) img {
        max-height: 60vh;
    }

    /* Standard Video Adjustments */
    .image-wrapper.video-wrapper {
        min-height: 300px;
        max-height: 60vh;
    }

    /* PORTRAIT Mobile specific override */
    .image-wrapper.video-wrapper.portrait-video {
        /* On mobile, allow it to take up a lot of space, but fit within viewport */
        height: 80vh;
        min-height: auto;
    }

    .image-wrapper.video-wrapper.portrait-video .adaptive-video {
        max-height: 80vh;
    }
}
