/* ================================================
   ENHANCED GALLERY SECTION STYLES
   File: assets/css/components/gallery.css
   ================================================ */

/* Gallery Section - Two-Tone Rhythm */
.gallery {
    padding: 80px 0;
    background: #e0f2fe;
    /* Slightly darker light blue for two-tone rhythm */
    position: relative;
    overflow: hidden;
}

/* No circuit pattern */
.gallery::before {
    display: none !important;
}

/* Ensure content appears above background */
.gallery .container {
    position: relative;
    z-index: 1;
}

/* Gallery Carousel */
.gallery-carousel {
    margin: 40px 0 60px;
}

.carousel-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.15);
    background: white;
}

/* Slide Counter */
.slide-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.current-slide {
    color: #3b82f6;
}

/* Autoplay Progress Bar */
.autoplay-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(59, 130, 246, 0.15);
    z-index: 20;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    width: 0%;
    transition: none;
    will-change: width;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    position: relative;
}

.carousel-slide {
    min-width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
}

.carousel-slide.active {
    opacity: 1;
}

/* Default slide content - can be overridden by magazine layout */
.slide-content {
    display: flex;
    min-height: 400px;
    height: 400px;
    overflow: hidden;
}

/* Override for magazine layout */
.slide-content.slide-content-magazine {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px !important;
    padding: 40px !important;
    min-height: 500px !important;
    height: auto !important;
    overflow: visible !important;
    align-items: center !important;
    background: #fff !important;
    /* DEBUG: White background */
    border: 5px solid lime !important;
    /* DEBUG: Lime border to see if magazine CSS is applied */
}

/* DEBUG: Test if magazine media is applied */
.slide-content-magazine .slide-media-magazine {
    border: 5px solid blue !important;
}

/* DEBUG: Test if magazine info is applied */
.slide-content-magazine .slide-info-magazine {
    border: 5px solid orange !important;
}

.slide-media {
    flex: 0 0 50%;
    width: 50%;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.slide-media img,
.slide-media video,
.slide-media iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

/* Video loading placeholder */
.slide-media video {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1e3a8a 100%);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Play icon overlay for videos */
.slide-media video::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.media-placeholder {
    font-size: 80px;
    color: #64748b;
    opacity: 0.8;
}

/* Carousel images - specific class for better control */
.carousel-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

/* Video placeholder for carousel */
.video-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.play-button-overlay {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.play-triangle {
    width: 0;
    height: 0;
    border-left: 36px solid white;
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    margin-left: 8px;
}

/* Slide Badges */
.slide-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

.slide-badge.featured {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.slide-badge.popular {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.slide-badge.warranty {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.slide-badge.gaming {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.slide-badge.critical {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.slide-info {
    flex: 0 0 50%;
    width: 50%;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: white;
    overflow-y: auto;
}

/* Slide Metadata */
.slide-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.meta-date,
.meta-time {
    font-size: 13px;
    color: #9ca3af;
    font-weight: 500;
}

.slide-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
    line-height: 1.3;
}

/* Option 1: Device/Type header with border separator */
.device-type-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.device-icon-wrapper,
.type-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.device-icon-wrapper i {
    width: 20px;
    height: 20px;
    color: #3b82f6;
    flex-shrink: 0;
}

.type-icon-wrapper i {
    width: 20px;
    height: 20px;
    color: #10b981;
    flex-shrink: 0;
}

.slide-info p {
    font-size: 16px;
    color: #374151;
    line-height: 1.8;
    margin-bottom: 24px;
}

/* Limit carousel description to 3 lines with ellipsis */
.slide-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px !important;
    line-height: 1.5 !important;
    margin-bottom: 20px !important;
    max-height: 4.5em;
    /* 3 lines × 1.5 line-height */
}

/* Multi-line carousel description - Option 3 spacious layout */
/* Updated 2025-11-15: Option 3 with breathing room */
.slide-description-single {
    font-size: 16px !important;
    color: #374151 !important;
    line-height: 1.8 !important;
    margin-bottom: auto !important;
    overflow: visible !important;
    display: block !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    text-align: left !important;
}

/* Allow nested divs in problem-solution template */
.slide-description-single div {
    line-height: 1.8 !important;
    margin-bottom: 8px !important;
}

/* Problem and solution lines with icons */
.slide-description-single .problem-line,
.slide-description-single .solution-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.slide-description-single .problem-line {
    color: #dc2626;
}

.slide-description-single .solution-line {
    color: #059669;
}

/* ========================================
   MAGAZINE LAYOUT STYLES
   ======================================== */

/* Magazine slide content styles moved to line 105-114 above */

/* Magazine-style media container - MUST override .slide-media defaults */
.slide-content-magazine .slide-media-magazine {
    width: 100% !important;
    flex: none !important;
    /* Override default flex */
    aspect-ratio: 1 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    height: auto !important;
    /* Override default height */
}

.slide-media-magazine img,
.slide-media-magazine video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Magazine-style info section - MUST override .slide-info defaults */
.slide-content-magazine .slide-info-magazine {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 16px !important;
    flex: none !important;
    /* Override default flex */
    width: 100% !important;
    /* Override default width */
    padding: 0 !important;
    /* Remove default padding, handled by parent */
    background: transparent !important;
    /* Remove default background */
    overflow: visible !important;
    /* Override default overflow */
}

/* Magazine-style title - MUST override .slide-info h3 */
.slide-content-magazine .slide-info-magazine .slide-title-magazine,
.slide-content-magazine .slide-title-magazine {
    font-size: 32px !important;
    color: #1f2937 !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    margin-bottom: 4px !important;
}

/* Magazine-style description - MUST override .slide-info p */
.slide-content-magazine .slide-info-magazine .slide-description-magazine,
.slide-content-magazine .slide-description-magazine {
    font-size: 15px !important;
    color: #4b5563 !important;
    line-height: 1.6 !important;
    margin-bottom: 8px !important;
    margin-top: 0 !important;
}

/* Detail section styling */
.detail-section {
    margin-top: 16px !important;
    padding: 16px 20px !important;
    background: #f9fafb !important;
    border-radius: 8px !important;
    border-left: 4px solid #3b82f6 !important;
}

.detail-section h4 {
    font-size: 12px !important;
    color: #3b82f6 !important;
    margin-bottom: 8px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.detail-section p {
    color: #4b5563 !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    margin: 0 !important;
}

/* Responsive adjustments for magazine layout */
@media (max-width: 900px) {
    .slide-content-magazine {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        padding: 24px !important;
        min-height: auto !important;
    }

    .slide-content-magazine .slide-media-magazine {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    .slide-content-magazine .slide-title-magazine {
        font-size: 24px !important;
    }

    .slide-content-magazine .slide-description-magazine {
        font-size: 14px !important;
    }
}

@media (max-width: 600px) {
    .slide-content-magazine {
        padding: 20px !important;
        gap: 16px !important;
    }

    .slide-content-magazine .slide-media-magazine {
        max-width: 100% !important;
        width: 100% !important;
    }

    .slide-content-magazine .slide-title-magazine {
        font-size: 20px !important;
    }

    .slide-content-magazine .slide-description-magazine {
        font-size: 13px !important;
    }

    .detail-section {
        padding: 12px 14px !important;
    }

    .detail-section h4 {
        font-size: 11px !important;
    }

    .detail-section p {
        font-size: 13px !important;
    }
}

/* Slide Footer - Option 3 spacing */
.slide-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.repair-tag {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.price-tag {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid #10b981;
}

/* Carousel Navigation */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 18px;
    color: #3b82f6;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    outline: none !important;
    /* Remove default focus outline */
}

.carousel-btn:focus {
    outline: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* Keep original shadow */
}

.carousel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2);
}

.carousel-btn-prev {
    left: 20px;
}

.carousel-btn-next {
    right: 20px;
}

/* Carousel Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 2px solid #3b82f6;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.indicator.active {
    background: #3b82f6;
    transform: scale(1.3);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.5);
}

.indicator:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.15);
}

/* Quick Browse Grid */
.gallery-grid-section {
    margin-top: 60px;
}

.grid-title {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 30px;
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
}

.gallery-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #64748b;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-placeholder {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: white;
    padding: 30px 20px 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.overlay-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.overlay-content p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.overlay-price {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.9);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
}

/* Gallery CTA Button */
.gallery-cta {
    margin-top: 40px;
    text-align: center;
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-view-all::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transition: left 0.4s ease;
    z-index: -1;
    border-radius: 30px;
}

.btn-view-all:hover::before {
    left: 0;
}

.btn-view-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-view-all:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-arrow {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.btn-view-all:hover .btn-arrow {
    transform: translateX(5px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gallery {
        padding: 40px 0;
        /* Reduced from 60px for more compact mobile */
    }

    .slide-counter {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 12px;
    }

    .slide-content {
        flex-direction: column;
        min-height: auto;
        height: auto;
        /* Allow content to expand */
    }

    .slide-media {
        width: 100%;
        flex: none;
        height: 200px;
        /* Reasonable height for mobile */
    }

    .slide-badge {
        top: 15px;
        left: 15px;
        font-size: 11px;
        padding: 5px 12px;
    }

    .slide-info {
        width: 100%;
        flex: none;
        padding: 24px 20px;
        /* More padding to prevent cutoff */
        overflow: visible;
        /* Allow content to show */
        min-height: 280px;
        /* Ensure enough space for all content */
    }

    .slide-info h3 {
        font-size: 20px;
        /* Slightly smaller for mobile */
        margin-bottom: 12px;
    }

    .slide-info p {
        font-size: 14px;
        /* Readable on mobile */
        line-height: 1.6;
        margin-bottom: 16px;
        /* More space after paragraphs */
    }

    /* Allow descriptions to show more lines on mobile */
    .slide-description {
        -webkit-line-clamp: 5;
        /* Show 5 lines for full content */
        line-clamp: 5;
        max-height: 7.5em;
        /* 5 lines × 1.5 line-height */
    }

    .slide-meta {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
    }

    .slide-footer {
        justify-content: center;
    }

    /* Device/Type header mobile optimization */
    .device-type-header {
        gap: 15px;
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .device-icon-wrapper,
    .type-icon-wrapper {
        font-size: 13px;
        gap: 6px;
    }

    .device-icon-wrapper i,
    .type-icon-wrapper i {
        width: 18px !important;
        height: 18px !important;
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .carousel-btn-prev {
        left: 10px;
    }

    .carousel-btn-next {
        right: 10px;
    }

    .carousel-indicators {
        bottom: 15px;
        gap: 8px;
    }

    .indicator {
        width: 10px;
        height: 10px;
    }

    /* IMPROVED: Single column gallery grid for mobile */
    .gallery-grid {
        grid-template-columns: 1fr;
        /* Single column for maximum clarity */
        gap: 24px;
        /* More breathing room between items */
        padding: 0 16px;
        /* Side padding for better framing */
    }

    .gallery-item {
        border-radius: 16px;
        /* Rounder corners for modern look */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        /* Softer, more elevated shadow */
        transition: all 0.3s ease;
    }

    .gallery-item:active {
        transform: scale(0.98);
        /* Subtle press feedback */
    }

    .gallery-placeholder {
        height: 220px;
        /* Taller for better visibility and impact */
        font-size: 48px;
        /* Larger icon */
    }

    /* Make overlay always visible on mobile for better UX */
    .gallery-overlay {
        transform: translateY(0) !important;
        /* Always visible */
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
        padding: 60px 20px 20px;
        /* More top padding for gradient */
        position: absolute;
        pointer-events: none;
        /* Allow clicks to pass through to parent */
    }

    .overlay-content h4 {
        font-size: 18px;
        /* Slightly larger for readability */
        margin-bottom: 6px;
    }

    .overlay-content p {
        font-size: 14px;
        /* Better readability */
        line-height: 1.4;
    }

    .overlay-price {
        font-size: 14px;
        /* Larger price tag */
        padding: 6px 14px;
    }

    .grid-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .gallery {
        padding: 50px 0 40px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0 10px;
    }

    .gallery-grid-section {
        margin-top: 40px;
    }

    .gallery-placeholder {
        height: 140px;
    }

    .slide-info {
        padding: 25px 15px;
    }

    .slide-info h3 {
        font-size: 20px;
    }

    /* Extra compact device/type header for small screens */
    .device-type-header {
        gap: 12px;
        margin-bottom: 10px;
        padding-bottom: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .device-icon-wrapper,
    .type-icon-wrapper {
        font-size: 12px;
        gap: 5px;
    }

    .device-icon-wrapper i,
    .type-icon-wrapper i {
        width: 16px !important;
        height: 16px !important;
    }

    .slide-meta {
        font-size: 13px;
    }

    .slide-footer {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        flex-wrap: wrap !important;
    }

    .btn-view-all {
        width: 100%;
        justify-content: center;
    }
}