/* =========================================
   ShowMyAura Frontend Styles
   Version: 4.2 (Final Responsive Fix)
   ========================================= */

/* 1. Base Variables & Reset */
:root {
    --sma-primary: #0f172a;
    --sma-accent: #667eea;
    --sma-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --sma-shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --sma-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --sma-radius: 16px;
    --sma-transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sma-gallery-wrap { 
    width: 100%; position: relative; margin: 40px 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    box-sizing: border-box; color: #111;
}
.sma-gallery-wrap * { box-sizing: border-box; }

/* 2. Category Filters */
.sma-category-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; justify-content: center; }
.sma-cat-btn { 
    background: #fff; border: 1px solid #e2e8f0; padding: 10px 24px; 
    border-radius: 50px; cursor: pointer; font-weight: 600; font-size: 14px; 
    transition: all var(--sma-transition); color: #475569; 
    box-shadow: var(--sma-shadow-sm);
}
.sma-cat-btn:hover { border-color: var(--sma-accent); color: var(--sma-accent); transform: translateY(-2px); }
.sma-cat-btn.active { background: var(--sma-primary); color: #fff; border-color: var(--sma-primary); box-shadow: var(--sma-shadow-lg); }

/* 3. Media Box (Universal) */
.sma-media-box { 
    position: relative; overflow: hidden; background: #f1f5f9; 
    height: 100%; width: 100%; display: block; 
}
.sma-img-scroller { 
    width: 100%; height: 100%; 
    background-size: cover; 
    background-position: top center; 
    background-repeat: no-repeat; 
    transition: background-position var(--scroll-speed, 3s) ease-in-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); 
}
.sma-card:hover .sma-img-scroller { background-position: bottom center; }
video { width: 100%; height: 100%; object-fit: cover; }
.sma-audio-placeholder { 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    height: 100%; width: 100%; color: #94a3b8; font-size: 18px; text-align: center; 
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}
.sma-audio-placeholder i { font-size: 48px; margin-bottom: 15px; color: #cbd5e1; }

/* 4. Modern Grid Layout */
.layout-grid .sma-items-container { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 30px; }
.layout-grid .sma-card { border-radius: var(--sma-radius); height: 380px; position: relative; overflow: hidden; box-shadow: var(--sma-shadow-md); transition: transform var(--sma-transition), box-shadow var(--sma-transition); }
.layout-grid .sma-card:hover { transform: translateY(-10px) scale(1.02); box-shadow: var(--sma-shadow-lg); z-index: 2; }
.layout-grid .sma-card:hover .sma-img-scroller { transform: scale(1.1); }

/* 5. Smart Masonry Layout (FIXED) */
.layout-masonry .sma-items-container { columns: var(--cols); column-gap: 30px; }
.layout-masonry .sma-card { 
    break-inside: avoid; margin-bottom: 30px; border-radius: var(--sma-radius); 
    overflow: hidden; display: inline-block; width: 100%; 
    box-shadow: var(--sma-shadow-md); transition: transform var(--sma-transition), box-shadow var(--sma-transition);
}
.layout-masonry .sma-card:hover { transform: translateY(-8px); box-shadow: var(--sma-shadow-lg); }
/* CRITICAL FIX: Ensure media box has height so background image is visible */
.layout-masonry .sma-media-box { 
    min-height: 300px !important; 
    height: auto; 
    width: 100%;
    position: relative;
}
.layout-masonry .sma-img-scroller {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

/* 6. Swipe Slider Layout */
.layout-slider .swiper-container { padding: 10px 10px 60px 10px; }
.layout-slider .sma-card { 
    display: flex; flex-direction: column; background: #fff; 
    border-radius: 20px; overflow: hidden; box-shadow: var(--sma-shadow-lg); 
    height: auto; border: 1px solid rgba(255,255,255,0.5);
}
.layout-slider .sma-media-box { height: 320px; border-radius: 20px 20px 0 0; }
.layout-slider .sma-slider-info { padding: 30px; text-align: center; display: flex; flex-direction: column; flex: 1; background: #fff; }
.layout-slider .sma-slider-info h3 { margin: 0 0 15px; font-size: 22px; font-weight: 700; color: var(--sma-primary); }
.layout-slider .sma-desc-clamp { font-size: 15px; color: #64748b; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 25px; }
.layout-slider .sma-view-btn { margin-top: auto; align-self: center; background: var(--sma-primary); color: #fff; border: none; padding: 12px 30px; border-radius: 50px; cursor: pointer; transition: 0.3s; font-weight: 600; box-shadow: 0 4px 15px rgba(15, 23, 42, 0.2); }
.layout-slider .sma-view-btn:hover { background: #334155; transform: scale(1.05); }

/* Slider Navigation */
.swiper-pagination-bullet { background: #cbd5e1; opacity: 1; width: 10px; height: 10px; }
.swiper-pagination-bullet-active { background: var(--sma-primary) !important; width: 30px; border-radius: 10px; }
.swiper-button-next, .swiper-button-prev { color: var(--sma-primary) !important; background: #fff; width: 44px; height: 44px; border-radius: 50%; box-shadow: var(--sma-shadow-md); transition: all 0.3s; }
.swiper-button-next:hover, .swiper-button-prev:hover { background: var(--sma-primary); color: #fff !important; }

/* 7. Overlay Styles */
.sma-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(15,23,42,0.9) 0%, rgba(15,23,42,0.2) 50%, transparent 100%); opacity: 0; transition: opacity 0.4s ease; display: flex; align-items: flex-end; padding: 30px; cursor: pointer; z-index: 2; }
.sma-card:hover .sma-overlay { opacity: 1; }
.sma-overlay-content { width: 100%; }
.sma-overlay-content h3 { color: #fff; margin: 0 0 10px; font-size: 22px; transform: translateY(20px); opacity: 0; transition: 0.4s 0.1s cubic-bezier(0.16, 1, 0.3, 1); }
.sma-btn-glass { background: rgba(255,255,255,0.15); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.2); color: #fff; padding: 8px 16px; border-radius: 30px; font-size: 13px; font-weight: 500; transform: translateY(20px); opacity: 0; transition: 0.4s 0.2s cubic-bezier(0.16, 1, 0.3, 1); display: inline-flex; align-items: center; gap: 5px; }
.sma-card:hover .sma-overlay-content h3, .sma-card:hover .sma-btn-glass { transform: translateY(0); opacity: 1; }

/* 8. Premium Layouts */
/* Bento */
.layout-bento .sma-items-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; grid-auto-rows: 250px; }
.layout-bento .sma-card { border-radius: 20px; overflow: hidden; position: relative; }
.layout-bento .sma-card:nth-child(4n+1) { grid-column: span 2; grid-row: span 2; }
.layout-bento .sma-card:nth-child(4n+2), .layout-bento .sma-card:nth-child(4n+3) { grid-column: span 1; grid-row: span 1; }
.layout-bento .sma-card:nth-child(4n+4) { grid-column: span 2; grid-row: span 1; }

/* Framed */
.layout-framed .sma-items-container { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 40px; background: #f8fafc; padding: 20px; border-radius: 12px; }
.layout-framed .sma-card { border: 12px solid #fff; box-shadow: 0 20px 40px rgba(0,0,0,0.08); background: #fff; padding-bottom: 0; height: 400px; position: relative; }

/* Zigzag */
.layout-zigzag .sma-items-container { display: flex; flex-direction: column; gap: 100px; }
.layout-zigzag .sma-card { display: flex; align-items: center; gap: 60px; opacity: 0; transform: translateY(40px); transition: 0.8s ease-out; }
.layout-zigzag .sma-card.is-visible { opacity: 1; transform: translateY(0); }
.layout-zigzag .sma-card:nth-child(even) { flex-direction: row-reverse; }
.layout-zigzag .sma-media-box { flex: 1; height: 500px; border-radius: 24px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); cursor: pointer; }
.layout-zigzag .sma-zigzag-info { flex: 1; }
.layout-zigzag .sma-zigzag-info h3 { font-size: 36px; margin: 0 0 15px; font-weight: 800; line-height: 1.2; }
.layout-zigzag .sma-badge { display: inline-block; background: #e2e8f0; color: #475569; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; margin-bottom: 20px; letter-spacing: 1px; }
.layout-zigzag .sma-desc-clip { font-size: 16px; color: #475569; line-height: 1.8; margin-bottom: 30px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.layout-zigzag .sma-view-btn { background: transparent; border: 2px solid var(--sma-primary); color: var(--sma-primary); padding: 12px 28px; border-radius: 30px; font-weight: 600; cursor: pointer; transition: 0.3s; display: inline-flex; align-items: center; gap: 10px; }
.layout-zigzag .sma-view-btn:hover { background: var(--sma-primary); color: #fff; }

/* Carousel */
.layout-carousel .swiper-container { width: 320px; height: 450px; padding: 20px 0; }
.layout-carousel .sma-card { width: 100%; height: 100%; border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }

/* Filmstrip */
.layout-filmstrip .swiper-slide { width: 400px; height: 300px; border-radius: 16px; }

/* 9. Backlink */
.sma-backlink { display: block; text-align: center; margin-top: 50px; font-size: 11px; color: #94a3b8; text-decoration: none; opacity: 0.5; transition: 0.3s; font-weight: 500; letter-spacing: 0.5px; }
.sma-backlink:hover { opacity: 1; }

/* 10. Universal Modal */
.sma-modal { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; }
.sma-modal-bg { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(12px); }
.sma-modal-content { position: relative; width: 95%; max-width: 1200px; height: 90vh; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); display: flex; flex-direction: column; animation: smaPop 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes smaPop { 0% { opacity: 0; transform: scale(0.95) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

.sma-modal-close-btn { position: absolute; top: 20px; right: 20px; background: #f1f5f9; border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; cursor: pointer; z-index: 10; color: #475569; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.sma-modal-close-btn:hover { background: #e2e8f0; color: #ef4444; transform: rotate(90deg); }

.sma-modal-split { display: flex; width: 100%; height: 100%; }
.sma-modal-media-wrap { flex: 1.5; background: #f8fafc; overflow-y: auto; overflow-x: hidden; position: relative; }
.sma-modal-media { width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.sma-modal-media img { width: 100%; height: auto; display: block; }
.sma-modal-media video { width: 100%; height: auto; }

.sma-modal-info { flex: 1; padding: 60px 40px; overflow-y: auto; background: #fff; display: flex; flex-direction: column; }
.sma-m-title { font-size: 32px; font-weight: 800; margin: 0 0 20px; color: var(--sma-primary); line-height: 1.2; }
.sma-m-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid #e2e8f0; font-size: 14px; color: #64748b; }
.sma-m-meta span { display: flex; align-items: center; gap: 6px; }
.sma-m-tech { margin-bottom: 20px; font-weight: 600; color: #3b82f6; font-size: 14px; }
.sma-m-desc { font-size: 16px; color: #475569; line-height: 1.8; margin-bottom: 30px; flex: 1; }

.sma-visit-btn { display: inline-flex; align-items: center; gap: 8px; background: #2563eb; color: #fff; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: 0.2s; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); }
.sma-visit-btn:hover { background: #1d4ed8; transform: translateY(-2px); color: #fff; }

.sma-m-actions { margin-top: auto; padding-top: 30px; display: flex; gap: 12px; border-top: 1px solid #f1f5f9; }
.sma-action-btn { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; padding: 14px; border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--sma-primary); display: flex; flex-direction: column; align-items: center; gap: 6px; transition: all 0.2s; text-decoration: none; font-size: 13px; }
.sma-action-btn:hover { border-color: var(--sma-primary); background: #fff; color: var(--sma-primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.sma-action-btn i { font-size: 20px; }
.sma-like-btn.liked i { color: #ef4444; animation: smaHeartBounce 0.5s; }

@keyframes smaHeartBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }

/* =========================================
   RESPONSIVE ADJUSTMENTS
   ========================================= */

/* Tablet & Small Desktop */
@media(max-width: 1200px) {
    .layout-bento .sma-items-container { grid-template-columns: repeat(2, 1fr); }
    .layout-bento .sma-card:nth-child(n) { grid-column: span 1; grid-row: span 1; }
}

@media(max-width: 1024px) {
    .sma-modal-split { flex-direction: column; }
    .sma-modal-media-wrap { flex: none; height: 50vh; }
    .sma-modal-info { padding: 30px 20px; }
}

/* Mobile Devices */
@media(max-width: 768px) {
    
    /* 1. Popup Image Scrollable Fix */
    .sma-modal-content { width: 100%; height: 100vh; border-radius: 0; }
    .sma-modal-media-wrap { 
        flex: none; 
        height: 45vh; /* Fixed height on mobile */
        overflow-y: auto !important; /* Enables scrolling */
        -webkit-overflow-scrolling: touch; 
    }
    .sma-modal-media img {
        width: 100%;
        height: auto;
        min-height: 100%; /* Ensures image is at least as tall as container */
        object-fit: cover;
    }
    .sma-modal-info { flex: 1; padding: 25px 20px; }
    .sma-m-actions { flex-wrap: wrap; gap: 10px; }
    .sma-action-btn { flex: 1 1 45%; flex-direction: row; justify-content: center; }
    .sma-modal-close-btn { top: 10px; right: 10px; background: rgba(255,255,255,0.9); }

    /* 2. Grid Layout */
    .layout-grid .sma-items-container { grid-template-columns: 1fr !important; gap: 20px; }
    .layout-grid .sma-card { height: 320px; }

    /* 3. Smart Masonry */
    .layout-masonry .sma-items-container { columns: 1 !important; }
    .layout-masonry .sma-media-box { min-height: 250px !important; }

    /* 4. Swipe Slider */
    .layout-slider .swiper-container { padding-left: 0; padding-right: 0; }
    .layout-slider .sma-media-box { height: 220px; } /* Smaller image height */
    .layout-slider .sma-slider-info { padding: 20px 15px; }
    .layout-slider .sma-slider-info h3 { font-size: 18px; }
    .layout-slider .sma-desc-clamp { -webkit-line-clamp: 3; font-size: 14px; } /* Less text on mobile */
    /* Force full width slides on mobile */
    .layout-slider .swiper-slide { width: 100% !important; } 

    /* 5. Elegant Framed */
    .layout-framed .sma-items-container { grid-template-columns: 1fr !important; gap: 20px; padding: 10px; }
    .layout-framed .sma-card { height: 280px; border-width: 6px; } /* Thinner border */

    /* 6. Continuous Filmstrip */
    .layout-filmstrip .swiper-slide { width: 280px !important; height: 200px; }

    /* 7. Zigzag Layout (Side-by-Side Fix) */
    .layout-zigzag .sma-card,
    .layout-zigzag .sma-card:nth-child(even) { 
        flex-direction: row !important; 
        gap: 15px; 
        align-items: flex-start;
    }
    .layout-zigzag .sma-media-box { 
        height: 180px !important; 
        min-width: 120px; 
        flex: 0 0 40%; 
        border-radius: 12px;
    }
    .layout-zigzag .sma-zigzag-info { flex: 0 0 60%; text-align: left !important; }
    .layout-zigzag .sma-zigzag-info h3 { font-size: 16px !important; margin-bottom: 5px; }
    .layout-zigzag .sma-desc-clip { display: none; } /* Hide description to save space */
    .layout-zigzag .sma-badge { font-size: 10px; margin-bottom: 5px; }
    .layout-zigzag .sma-view-btn { padding: 6px 14px; font-size: 11px; }

    /* 8. General Typography */
    .sma-cat-btn { padding: 6px 14px; font-size: 13px; }
}