/* ========================================
   Portfolio Itsmolab - Styles
   ======================================== */

/* Filters */
.itsmolab-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding: 0;
}

.itsmolab-filter-btn {
    padding: 10px 20px;
    border: 2px solid #000;
    background: transparent;
    color: #000;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 30px;
}

.itsmolab-filter-btn:hover,
.itsmolab-filter-btn.active {
    background: #000;
    color: #fff;
}

/* Grid - CSS Grid Layout */
.itsmolab-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    grid-auto-rows: 10px;
    grid-auto-flow: dense;
    gap: 8px;
    padding: 20px 0;
}

@media (max-width: 992px) {
    .itsmolab-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Adjust spans for tablet */
    .itsmolab-item.orientation-horizontal {
        grid-row: span 16;
    }

    .itsmolab-item.orientation-vertical {
        grid-row: span 30;
    }

    .itsmolab-item.orientation-square {
        grid-row: span 22;
    }
}

@media (max-width: 576px) {
    .itsmolab-grid {
        grid-template-columns: 1fr;
    }
    
    .itsmolab-filters {
        justify-content: center;
    }
    
    /* Adjust spans for mobile */
    .itsmolab-item.orientation-horizontal {
        grid-row: span 22;
    }

    .itsmolab-item.orientation-vertical {
        grid-row: span 45;
    }

    .itsmolab-item.orientation-square {
        grid-row: span 32;
    }
}

/* Grid Items */
.itsmolab-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease;
    background: #fff;
}

/* Grid spans based on orientation */
.itsmolab-item.orientation-horizontal {
    grid-row: span 18;
}

.itsmolab-item.orientation-vertical {
    grid-row: span 35;
}

.itsmolab-item.orientation-square {
    grid-row: span 26;
}

.itsmolab-item.hidden {
    display: none;
}

.itsmolab-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.itsmolab-item-inner {
    position: relative;
    overflow: hidden;
    line-height: 0;
    height: 100%;
}

.itsmolab-item-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.itsmolab-item:hover .itsmolab-item-inner img {
    transform: scale(1.05);
}

.itsmolab-item-inner video.itsmolab-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.itsmolab-item:hover .itsmolab-item-inner video.itsmolab-video {
    transform: scale(1.03);
}

/* Bunny iframe in grid */
.itsmolab-bunny-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.itsmolab-bunny-wrapper .itsmolab-bunny-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    transition: transform 0.5s ease;
}

.itsmolab-item:hover .itsmolab-bunny-wrapper .itsmolab-bunny-iframe {
    transform: scale(1.05);
}

.itsmolab-placeholder {
    width: 100%;
    height: 100%;
    min-height: 150px;
    background: linear-gradient(135deg, #333 0%, #666 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

/* Overlay - Black text */
.itsmolab-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 60%, transparent 100%);
    padding: 60px 20px 20px;
    color: #000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.itsmolab-overlay h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: #000;
}

.itsmolab-overlay .itsmolab-tags {
    font-size: 12px;
    color: #333;
    display: block;
}

/* ========================================
   Modal/Popup - Fixed Size
   ======================================== */
.itsmolab-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.itsmolab-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.itsmolab-modal-content {
    background: #fff;
    width: 100%;
    max-width: 1100px;
    height: 650px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    animation: itsmolab-modalFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes itsmolab-modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Close Button - Black */
.itsmolab-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border: none;
    background: #000;
    color: #fff;
    border-radius: 50%;
    font-size: 26px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.itsmolab-modal-close:hover {
    background: #333;
    transform: scale(1.1);
}

.itsmolab-modal-body {
    display: flex;
    height: 100%;
}

@media (max-width: 768px) {
    .itsmolab-modal-body {
        flex-direction: column;
    }
    
    .itsmolab-modal-content {
        height: auto;
        max-height: 95vh;
    }
}

/* Gallery Section (Left) - Fixed */
.itsmolab-modal-gallery {
    flex: 0 0 60%;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.itsmolab-gallery-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    height: calc(100% - 100px);
    overflow: hidden;
}

.itsmolab-gallery-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.itsmolab-gallery-main video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.itsmolab-gallery-main iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 6px;
}

.itsmolab-gallery-thumbs {
    flex: 0 0 100px;
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #050505;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.itsmolab-gallery-thumbs::-webkit-scrollbar {
    height: 6px;
}

.itsmolab-gallery-thumbs::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.itsmolab-gallery-thumbs::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.itsmolab-gallery-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.25s ease;
    border: 2px solid transparent;
}

.itsmolab-gallery-thumb:hover {
    opacity: 0.85;
}

.itsmolab-gallery-thumb.active {
    opacity: 1;
    border-color: #fff;
}

.itsmolab-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.itsmolab-gallery-thumb.video-thumb {
    position: relative;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

.itsmolab-gallery-thumb.video-thumb::after {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent rgba(255,255,255,0.9);
    position: absolute;
}

.itsmolab-gallery-thumb.video-thumb img {
    position: absolute;
    top: 0;
    left: 0;
}

/* Info Section (Right) - Fixed */
.itsmolab-modal-info {
    flex: 0 0 40%;
    padding: 40px 35px;
    overflow-y: auto;
    height: 100%;
    background: #fff;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .itsmolab-modal-info {
        padding: 30px 25px;
        flex: none;
        height: auto;
    }
    
    .itsmolab-modal-gallery {
        flex: none;
        height: 350px;
    }
}

.itsmolab-modal-info .itsmolab-project-title {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 700;
    color: #000;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

/* Meta Info Styles */
.itsmolab-project-meta {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.itsmolab-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.itsmolab-meta-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.itsmolab-meta-item.meta-full {
    grid-column: 1 / -1;
}

.itsmolab-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    font-weight: 600;
}

.itsmolab-meta-value {
    font-size: 15px;
    color: #000;
    font-weight: 500;
}

.itsmolab-meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 3px;
}

.itsmolab-meta-tag {
    display: inline-block;
    padding: 5px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.itsmolab-meta-tag.tool-tag {
    background: #000;
    color: #fff;
}

/* Description */
.itsmolab-modal-info .itsmolab-project-description {
    font-size: 15px;
    line-height: 1.75;
    color: #444;
}

.itsmolab-modal-info .itsmolab-project-description p {
    margin-bottom: 16px;
}

/* Loading state */
.itsmolab-item-inner img.loading {
    opacity: 0;
}

.itsmolab-item-inner img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}