body {font-family: Arial, sans-serif; margin:0; padding:0;}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap:10px;
    padding:20px;
}
.gallery img {
    width:100%;
    cursor:pointer;
    border-radius:8px;
    transition:.3s;
}
.gallery img:hover {
    transform:scale(1.05);
}

/* Popup */
.popup {
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.7);
    justify-content:center;
    align-items:center;
    z-index:9999;
}
.popup-content {
    background:#fff;
    width:90%;
    height:85%;
    border-radius:12px;
    display:flex;
    overflow:hidden;
    position:relative;
}
.popup-left {
    flex:2;
    display:flex;
    justify-content:center;
    align-items:center;
    background:#f5f5f5;
    position:relative;
}
.popup-left img {
    max-width:95%;
    max-height:95%;
    border-radius:8px;
    position:absolute;
}
.popup-left #mainImage {position:relative; z-index:1;}
.popup-left #frameLayer {z-index:2;}
.popup-left #fabricLayer {z-index:3;}

/* Right Panel */
.popup-right {
    flex:1;
    padding:20px;
    display:flex;
    flex-direction:column;
    background:#fff;
    overflow-y:auto;
}

/* Tabs */
.tabs {
    display:flex;
    border-bottom:2px solid #ddd;
    margin-bottom:10px;
}
.tabs button {
    flex:1;
    padding:10px;
    border:none;
    cursor:pointer;
    background:#eee;
    transition:0.3s;
}
.tabs button.active {
    background:#fff;
    border-bottom:2px solid #000;
    font-weight:bold;
}
.tab-content {
    flex:1;
    padding:10px;
    overflow-y:auto;
    display:none;
}
.tab-content.active {
    display:block;
}

/* Frame images */
.frame-options img {
    width:70px;
    height:70px;
    margin:5px;
    cursor:pointer;
    border:2px solid transparent;
    border-radius:6px;
    transition:.3s;
}
.frame-options img:hover {transform:scale(1.05);}
.frame-options img.selected {border-color:red;}

/* Fabric swatches */
.fabric-options img {
    width:70px;
    height:70px;
    margin:5px;
    cursor:pointer;
    border:2px solid transparent;
    border-radius:6px;
    transition:.3s;
}
.fabric-options img:hover {transform:scale(1.05);}
.fabric-options img.selected {border-color:red;}

/* Share form */
.share-form {
    display:flex;
    flex-direction:column;
    gap:10px;
}
.share-form input,
.share-form textarea {
    width:100%;
    padding:8px;
    border:1px solid #ccc;
    border-radius:6px;
}
.share-form button {
    padding:10px;
    background:#007bff;
    color:#fff;
    border:none;
    border-radius:6px;
    cursor:pointer;
    transition:.3s;
}
.share-form button:hover {
    background:#0056b3;
}

/* Close Button */
.close-btn {
    position:absolute;
    top:15px;
    right:25px;
    font-size:28px;
    color:#fff;
    cursor:pointer;
    z-index:99999;
}

/* Responsive */
@media(max-width:900px){
    .popup-content{flex-direction:column;}
    .popup-left{flex:3;width:100%;height:50%;}
    .popup-right{flex:2;width:100%;height:50%;}
    .gallery {grid-template-columns: repeat(2, 1fr);}
}
@media(max-width:500px){
    .gallery {grid-template-columns: 1fr;}
}
