#cpd_designer_container {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    min-height: 100vh;
}

.cpd-designer-content {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #dde0e5;
    box-shadow: 0 16px 42px rgba(30,40,90,0.16);
    padding: 28px 36px;
    width: 100%;
    max-width: 1000px;   /* 🔹 Increased desktop width */
    min-width: 280px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 22px;
    box-sizing: border-box;
    position: absolute;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

#cpd_image_selector {
    margin-bottom: 12px;
    text-align: center;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.cpd-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    background: #fafbfe;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid #e8e8ec;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: border-color 0.25s, transform 0.2s, box-shadow 0.2s;
}
.cpd-thumb:hover, .cpd-thumb.active {
    border-color: #0073aa;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(20,90,255,0.15);
}

#cpd_canvas {
    border: 1.5px solid #ccd1da;
    background: #fafbfe;
    max-width: 520px;  /* 🔹 Scales with new popup width */
    width: 100%;
    height: 340px;
    margin-bottom: 8px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(17,47,128,0.07);
}

.cpd-toolbar {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
    max-width: 520px;
    box-sizing: border-box;
}

.cpd-toolbar label {
    font-weight: 600;
    font-size: 0.95em;
    letter-spacing: 0.03em;
    color: #2e3642;
}

.cpd-toolbar select,
.cpd-toolbar input[type="color"] {
    padding: 8px 12px;
    font-size: 1em;
    border-radius: 7px;
    border: 1.5px solid #c7cbd3;
    width: 100%;
    background: #f6f8fc;
    transition: border 0.25s, box-shadow 0.25s;
}
.cpd-toolbar select:focus,
.cpd-toolbar input[type="color"]:focus {
    border: 1.5px solid #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.15);
    outline: none;
}

.cpd-stickers {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.cpd-stickers img {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    background: #f5f8fa;
    box-shadow: 0 2px 6px rgba(0,50,153,0.07);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.cpd-stickers img:hover {
    border-color: #0073aa;
    background: #e6f0fa;
    transform: scale(1.08);
}

#cpd_save_design, #cpd_cancel_design {
    padding: 12px 0;
    font-size: 1.05em;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: background .22s, color .22s, transform .18s;
}
#cpd_save_design {
    background: linear-gradient(90deg, #0073aa 85%, #005177 100%);
    color: #fff;
    margin-top: 6px;
}
#cpd_save_design:hover {
    background: linear-gradient(90deg, #00609a 70%, #003a5d 100%);
    transform: translateY(-1px);
}
#cpd_cancel_design {
    background: #f4f5f7;
    color: #2d2d34;
    margin-top: 8px;
}
#cpd_cancel_design:hover {
    background: #e8e9eb;
    color: #111;
    transform: translateY(-1px);
}

/* 🔹 Tablet Adjustments */
@media (max-width: 900px) {
    .cpd-designer-content {
        max-width: 95vw;
        padding: 18px 20px;
    }
    #cpd_canvas {
        max-width: 100%;
        height: 240px;
    }
}

/* 🔹 Mobile Adjustments */
@media (max-width: 650px) {
    #cpd_designer_container {
        padding: 12px;
        align-items: flex-start;
    }
    .cpd-designer-content {
        padding: 16px 14px;
        width: 100%;
        max-width: 100%;  /* 🔹 Full width on mobile */
        border-radius: 14px;
        min-height: auto;
    }
    #cpd_canvas {
        width: 100%;      /* 🔹 Fit inside popup width */
        height: 180px;
    }
    .cpd-thumb {
        width: 44px;
        height: 44px;
    }

    .cpd-designer-content {
    
    display: flex;
    flex-direction: column;
    
}


}

/* 🔹 Extra Small (Android phones <420px) */
@media (max-width: 420px) {

     .cpd-designer-content {
    
    display: flex;
    flex-direction: column;
    
}

    .cpd-designer-content {
        padding: 12px 10px;
        width: 100vw;     /* 🔹 Take full viewport width */
        max-width: 100%;
    }
    #cpd_canvas {
        width: 100%;      /* 🔹 Shrink with popup */
        height: 150px;
    }
    .cpd-thumb {
        width: 36px;
        height: 36px;
    }
}