/* /home/siisi/vertex/gallery_app/static/css/gallery.css */

/* =========================================
   1. Carousel Styling
   ========================================= */
.carousel .ratio img,
.carousel .ratio video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 576px) {
    .carousel .ratio.ratio-16x9 {
        aspect-ratio: 4 / 3;
    }
}

.carousel-control-prev,
.carousel-control-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.carousel-control-prev svg,
.carousel-control-next svg {
    width: 2rem;
    height: 2rem;
    fill: currentColor;
}

/* =========================================
   2. Card & Container Styling
   ========================================= */
.gallery-card {
    border: none;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 280px;
    background-color: #f8f9fa;
}

.image-wrapper img,
.image-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover .image-wrapper img,
.gallery-card:hover .image-wrapper video {
    transform: scale(1.05);
}

/* =========================================
   3. Horizontal Layout (Public Gallery) - FIXED PADDING
   ========================================= */
.horizontal-scroll-wrapper {
    position: relative;
    width: 100%;
    /* REMOVED all padding from wrapper */
}

.horizontal-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.5rem;
    padding: 10px 5px 25px 5px;
    /* REMOVED left padding */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f0f2f5;
    flex: 1;
    scroll-snap-type: x mandatory;
}

.horizontal-grid .gallery-col {
    flex: 0 0 auto;
    width: 350px;
    height: 350px;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

/* Custom scrollbar for webkit browsers */
.horizontal-grid::-webkit-scrollbar {
    height: 8px;
}

.horizontal-grid::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 4px;
    margin: 0;
    /* REMOVED margin */
}

.horizontal-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.horizontal-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Hide scrollbar when not scrolling */
.horizontal-grid:not(:hover)::-webkit-scrollbar-thumb {
    background: transparent;
}

.horizontal-grid:hover::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

/* Scroll buttons - COMPACT VERSION */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 40px;
    /* Smaller */
    height: 40px;
    /* Smaller */
    border-radius: 50%;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    /* Lighter shadow */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
    color: #4a5568;
    font-size: 1rem;
    /* Smaller icon */
}

.scroll-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
    color: #2d3748;
}

.scroll-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.scroll-left {
    left: -15px;
    /* Minimal spacing */
}

.scroll-right {
    right: -15px;
    /* Minimal spacing */
}

.scroll-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.8);
}

/* =========================================
   4. Vertical Layout (Private Gallery)
   ========================================= */
.vertical-grid {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.vertical-grid .col {
    display: flex;
}

.vertical-grid .gallery-card {
    width: 100%;
}

.vertical-grid .image-wrapper {
    aspect-ratio: 1 / 1;
    min-height: auto;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   5. Video Container & Play Controls
   ========================================= */
.video-container {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    /* Essential for absolute positioning of the play button */
    z-index: 1;
    cursor: pointer;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: block;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensures video isn't cropped */
    position: relative;
    z-index: 1;
    display: block;
}

/* --- THE CENTERING MAGIC --- */
.video-container .play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Moves the element back by 50% of its own width/height to center perfectly */
    transform: translate(-50%, -50%);

    z-index: 2;
    pointer-events: auto;
    /* Ensures the click is captured */

    /* Visual styling */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    /* Optional: Defines a hit area size */
    height: 80px;
    /* Optional: Defines a hit area size */
    transition: all 0.3s ease;
    opacity: 0.8;
}

/* Hover Effect */
.video-container:hover .play-overlay {
    opacity: 1 !important;
    /* IMPORTANT: You must repeat translate(-50%, -50%) here, 
       otherwise the button will jump to the corner when scaling */
    transform: translate(-50%, -50%) scale(1.1);
}

/* The Icon itself */
.video-container .play-overlay i {
    font-size: 3.5rem;
    /* Adjust size of the triangle */
    color: #fff;
    pointer-events: none;
    /* Clicks pass through icon to the overlay div */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    transition: color 0.3s ease;
}

/* Hide overlay when native controls are active or playing */
.video-container video[controls]~.play-overlay,
.video-container.playing .play-overlay {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* --- Image Wrapper Adjustments --- */
.image-wrapper {
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 280px;
    background-color: #000;
}

.image-wrapper .video-container {
    background: #000;
    width: 100%;
    height: 100%;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8f9fa;
    transition: transform 0.5s ease;
}

/* =========================================
   6. Social Features & Overlays
   ========================================= */
.social-overlay {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.gallery-card:hover .social-overlay {
    opacity: 1;
}

.social-actions {
    pointer-events: auto;
}

.social-actions .btn {
    padding: 0.4rem 0.6rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.social-actions .btn:hover {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.2);
}

/* User Overlay */
.user-overlay {
    background: linear-gradient(rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.gallery-card:hover .user-overlay {
    opacity: 1;
}

.user-overlay a {
    color: white !important;
    text-decoration: none;
    pointer-events: auto;
}

.user-overlay a:hover {
    text-decoration: underline;
}

.user-profile-link {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 3 !important;
    position: relative !important;
}

.user-overlay a.user-profile-link:hover {
    text-decoration: underline !important;
    color: #fff !important;
}

/* Social Stats */
.social-stats {
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.social-stats span {
    display: inline-flex;
    align-items: center;
    margin-right: 0.75rem;
}

.social-stats i {
    margin-right: 0.25rem;
    opacity: 0.9;
}

/* Engagement Metrics */
.engagement-metrics {
    border-left: 3px solid #007bff;
    padding-left: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 0 6px 6px 0;
    margin: 0.5rem 0;
    font-size: 0.8rem;
}

.engagement-metrics small {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

.engagement-metrics i {
    margin-right: 0.25rem;
    opacity: 0.7;
}

/* Privacy Controls */
.form-check.form-switch {
    margin-bottom: 0;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label {
    font-size: 0.8rem;
    color: #43DC80;
    cursor: pointer;
}

/* Delete Button */
.delete-missing-btn {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 0.25rem !important;
}

.delete-missing-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

/* Media Link */
.media-link {
    transition: all 0.3s ease;
    display: block;
    height: 100%;
}

.media-link:hover {
    opacity: 0.9;
}

/* =========================================
   7. Media Detail Page Styles
   ========================================= */
.media-display-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.media-display-card .card-body {
    border-radius: 0 0 1rem 1rem;
    overflow: hidden;
}

.media-content-wrapper {
    border-radius: 0.5rem;
    overflow: hidden;
    background: #000;
}

.social-engagement-bar {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    backdrop-filter: blur(10px);
}

.info-card,
.action-card,
.share-card {
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover,
.action-card:hover,
.share-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Social Buttons */
.btn-twitter,
.btn-tiktok {
    background: linear-gradient(135deg, #1da1f2, #0d8bd9);
    color: white;
    border: none;
}

.btn-facebook {
    background: linear-gradient(135deg, #3b5998, #2d4373);
    color: white;
    border: none;
}

.btn-linkedin {
    background: linear-gradient(135deg, #0077b5, #005885);
    color: white;
    border: none;
}

.btn-twitter:hover,
.btn-facebook:hover,
.btn-linkedin:hover,
.btn-tiktok:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: white;
}

.media-badges .badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.engagement-stats {
    font-weight: 500;
}

.engagement-actions .btn {
    border-radius: 2rem;
    padding: 0.5rem 1rem;
}

/* Image Zoom Effect */
.image-display-container.zoomed img {
    transform: scale(1.5);
    cursor: zoom-out;
}

.image-display-container img {
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

/* Breadcrumb Styling */
.breadcrumb {
    background: transparent;
    padding: 0;
}

.breadcrumb-item a {
    color: #6c757d;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #007bff;
}

/* Accordion Styling */
.accordion-gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    color: white;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.accordion-gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.accordion-gradient-bg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.accordion__header--icon::before {
    margin-right: 10px;
    font-size: 1.2rem;
}

.accordion__header--text {
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    z-index: 2;
}

.accordion__header--indicator {
    position: relative;
    z-index: 2;
}

/* =========================================
   8. Animations & Effects
   ========================================= */
@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(1);
    }

    75% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.like-btn.animate {
    animation: heartBeat 0.6s ease;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-count.updated,
.like-count.updated,
.comment-count.updated {
    animation: countUp 0.5s ease;
}

/* Featured Badge */
.gallery-card.featured {
    border: 2px solid #ffc107;
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.3);
}

.featured-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #000;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
}

/* =========================================
   9. Responsive Design - FIXED PADDING
   ========================================= */

/* Mobile - Horizontal Layout */
@media (max-width: 768px) {
    .horizontal-scroll-wrapper {
        padding: 0;
        /* REMOVED padding */
    }

    .horizontal-grid {
        padding: 10px 0 25px 0;
        /* REMOVED left padding */
    }

    .horizontal-grid .gallery-col {
        width: 300px;
        height: 300px;
    }

    .video-container {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        cursor: pointer;
    }

    /* Larger play button for mobile */
    .video-container .play-overlay {
        width: 100px !important;
        height: 100px !important;
        opacity: 0.95 !important;
    }

    .video-container .play-overlay i {
        font-size: 4rem !important;
    }

    /* When video is playing, show different cursor */
    .video-container.video-playing {
        cursor: default;
    }

    /* Ensure video controls don't interfere with clicks */
    video::-webkit-media-controls {
        pointer-events: none;
    }

    video::-webkit-media-controls-panel {
        pointer-events: auto;
    }

    .scroll-btn {
        width: 35px;
        /* Even smaller on mobile */
        height: 35px;
        font-size: 0.9rem;
    }

    .scroll-left {
        left: 2px;
        /* Minimal spacing */
    }

    .scroll-right {
        right: 2px;
        /* Minimal spacing */
    }
}

@media (max-width: 576px) {
    .horizontal-scroll-wrapper {
        padding: 0;
        /* REMOVED padding */
    }

    .horizontal-grid {
        padding: 10px 0 25px 0;
        /* REMOVED left padding */
    }

    .horizontal-grid .gallery-col {
        width: 340px;
        height: 340px;
    }

    .scroll-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

@media (max-width: 400px) {
    .horizontal-scroll-wrapper {
        padding: 0;
        /* REMOVED padding */
    }

    .horizontal-grid .gallery-col {
        width: 320px;
        height: 320px;
    }

    .scroll-btn {
        width: 30px;
        height: 30px;
    }
}

/* Mobile - Social Overlays */
@media (max-width: 768px) {
    .social-overlay {
        opacity: 1 !important;
        visibility: visible !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%) !important;
        pointer-events: auto;
        padding: 0.75rem;
    }

    .user-overlay {
        opacity: 1 !important;
        visibility: visible !important;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%) !important;
        pointer-events: auto;
        padding: 0.75rem;
    }

    .social-stats span {
        margin-bottom: 0;
        margin-right: 0.75rem;
    }

    .social-actions .btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        background-color: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
        min-width: 44px;
        min-height: 44px;
    }

    .social-actions .btn:active {
        transform: scale(0.95);
        background-color: rgba(255, 255, 255, 0.3);
    }

    .gallery-card:hover {
        transform: none;
    }

    .gallery-card:active {
        transform: scale(0.98);
    }

    .video-container .play-overlay {
        opacity: 1 !important;
    }

    .video-container video {
        min-height: 44px;
    }

    .video-play-btn {
        display: flex !important;
        opacity: 0.9 !important;
    }

    .video-redirect-area {
        z-index: 2;
    }

    /* Media Detail Page Mobile */
    .media-content-wrapper {
        margin: 0 -1rem;
        border-radius: 0;
    }

    .social-engagement-bar {
        position: relative !important;
        background: rgba(0, 0, 0, 0.9);
    }

    .engagement-actions {
        margin-top: 1rem;
        justify-content: center !important;
    }
}

@media (max-width: 576px) {
    .social-overlay {
        padding: 0.5rem;
    }

    .user-overlay {
        padding: 0.5rem;
    }

    .social-stats span {
        margin-right: 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 400px) {
    .social-stats {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Desktop - Social Overlays */
@media (min-width: 769px) {
    .social-overlay {
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .user-overlay {
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .gallery-card:hover .social-overlay {
        opacity: 1;
    }

    .gallery-card:hover .user-overlay {
        opacity: 1;
    }

    .social-actions {
        pointer-events: auto;
    }
}

/* =========================================
   10. Accessibility & Special Modes
   ========================================= */
/* Focus States */
.social-actions .btn:focus,
.delete-missing-btn:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
    outline: none;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    .gallery-card,
    .image-wrapper img,
    .image-wrapper video,
    .social-overlay,
    .user-overlay {
        transition: none;
    }

    .gallery-card:hover {
        transform: none;
    }

    .like-btn.animate {
        animation: none;
    }
}

/* Dark Mode */
[data-bs-theme="dark"] .gallery-card {
    background: #2d3748;
    border: 1px solid #4a5568;
}

[data-bs-theme="dark"] .engagement-metrics {
    background-color: #4a5568;
    border-left-color: #63b3ed;
}

/* Touch Device */
.touch-device .gallery-card {
    cursor: pointer;
}

.touch-device .gallery-card:active {
    background-color: rgba(0, 0, 0, 0.02);
}

.touch-device .video-play-btn {
    min-width: 60px;
    min-height: 60px;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.touch-device .video-play-btn i {
    font-size: 2.5rem !important;
}

/* Make sure badges stay above everything */
.video-container .badge {
    z-index: 1 !important;
}
