/* General styles for the Design Customizer page */

.ast-container{
    display: initial !important;
    position: relative;
    z-index: 200;
}

.main-customizer-container{
    width: 100%;
    margin: auto;
    display: flex;
    align-items: center;
}

/* Edit Tools Bar Styling */

.edit-tool-bar{
    display: flex;
    gap: 10px;
    background-color: #fff;
    z-index: 300;
    padding: 10px 40px;
}

.edit-tool-bar button{
    background-color: #fff;
    color: #0D0D0D;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: none;
    
}

.edit-tool-bar button:hover{
    border-radius: 4px;
    background-color: #F3EEFE;
    color: #633EB1;
}

.edit-tool-bar button:hover svg path{
    stroke: #633EB1;
}

.editing-options{
    margin-bottom: 50px;
}

.editing-options .section-title{
    margin-bottom: 20px;
    font-weight: bold;
}

#undo-btn.disabled, 
#redo-btn.disabled, 
#reset-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

#undo-btn:disabled svg path, 
#redo-btn:disabled svg path, 
#reset-btn:disabled svg path {
    stroke: #999;
}

#undo-btn:disabled, 
#redo-btn:disabled, 
#reset-btn:disabled {
    color: #999;
}

.design-selection-container {
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
}

.design-selection-modal {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.design-list {
    margin: 20px 0;
}

.design-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.design-option.deleting {
    opacity: 0.5;
    pointer-events: none;
}

.design-info {
    flex: 1;
}

.design-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.load-design-btn {
    margin-top: 10px;
    padding: 5px 10px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.load-design-btn:hover {
    background: #005177;
}

.delete-design-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #dc3232;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-design-btn:hover {
    color: #a00;
}

.new-design-btn {
    padding: 10px 15px;
    background: #23282d;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.save-options-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.save-options-content {
    background: white;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
}

.save-options-buttons{
    padding: 20px;
}

.save-options-buttons .btns-pair{
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 12px;
}

.save-options-content h3{
    border-bottom: 1px solid #ccc;
    padding: 20px;
}

.save-options-content button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.save-new-btn {
    background: #9EBC8A;
    color: #333;
}
.overwrite-btn {
    background: #8855f3;
    color: #fff;
    border: 1px solid #8855f3 !important;
}

.overwrite-btn:hover {
    background: #fff;
    color: #8855f3;
    border: 1px solid #8855f3 !important;
}

.cancel-save-btn {
    background: #fff;
    color: #8855f3;
    border: 1px solid #8855f3 !important;
}

.position-edit-tools, .transform-edit-tools{
    display: flex;
    gap: 20px;
}

.position-edit-tools button, .transform-edit-tools button{
    background-color: #fff;
    color: #2E2E2E;
    box-shadow: none;
    padding: 0;
}

.transform-edit-tools button{
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

#rotate-slider {
    width: 100%;
    height: 10px;
    background: #C9B3FA;
    border-radius: 5px;
    outline: none;
    box-shadow: none !important;
    margin-right: 10px;
}

#rotate-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: none;
}

#rotate-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: none;
}

#rotate-input {
    width: 60px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}



.resize-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

.dimension-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.dimension-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dimension-control button {
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    border: none;
    background-color: #333;
    color: #fff;
    cursor: pointer;
}

.dimension-control input {
    width: 114px;
    text-align: center;
    border: none;
    border: 1px solid #eee;
}

.link-toggle {
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    margin-top: 30px;
}

.position-edit-tools button {
    background: none;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.position-edit-tools button:hover {
    background-color: #f5f5f5;
}

.position-edit-tools button img {
    width: 20px;
    height: 20px;
}


/* Crop overlay styles */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: none;
}

.crop-box {
    position: absolute;
    border: 2px dashed #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    z-index: 11;
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 1px solid #000;
    z-index: 12;
}

/* Resize handles */
.crop-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.crop-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.crop-handle-n { top: -5px; left: 50%; margin-left: -5px; cursor: n-resize; }
.crop-handle-s { bottom: -5px; left: 50%; margin-left: -5px; cursor: s-resize; }
.crop-handle-w { top: 50%; left: -5px; margin-top: -5px; cursor: w-resize; }
.crop-handle-e { top: 50%; right: -5px; margin-top: -5px; cursor: e-resize; }

/* card */


.design-customizer-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #F3EEFE;
    padding: 40px;
}

.design-customizer-container .inner-box {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

/* Left column for template card */
.left-column {
    width: 50%;
    height: 100%;
    background-color: #fff;
    z-index: 999;
    padding: 24px;
    box-shadow: 0px 0px 5px 0px #bdbdbd;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.template-card {
    width: 100%;
    display: flex;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px 0px rgb(0 0 0 / 10%);
    padding: 12px;
}

/* Template Image */
.card-image {
    width: 240px;
    height: 100%;
}

.card-image img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Template content */
.card-content {
    flex: 1;
    padding: 0 20px;
}

.card-content .cols{
    display: flex;
    justify-content: space-between;
}

.card-content .name-label {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    text-align: left;
}

.card-content .template-name{
    color: #0D0D0D;
    font-size: 16px;
    font-weight: 400;
    text-align: left;
}

/* Print sizes container */
.sizes-container {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.size-button {
    padding: 10px 20px;
    background-color: #F5F5F5;
    color: #0D0D0D;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.size-button.active {
    background-color: #0D0D0D;
    color: white;
}

.aspect-ratio-buttons .active{
    background-color: #8855F3;
}

.size-button:hover {
    background-color: #0D0D0D;
}

/* Price display */
.price-display {
    margin-top: 20px;
    font-size: 20px;
    font-weight: 700;
    text-align: right;
    color: #633EB1;
}

.price-display #price-label {
    color: #0D0D0D;
}

.edit-sections{
    margin-bottom: 50px !important;
}

/* Buttons styling */
.buttons {
    margin-top: 30px;
    display: flex;
    justify-content: right;
    gap: 10px;
}

.buttons button {
    padding: 16px 12px;
    border: none;
    border-radius: 4px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
}

.buttons button:first-child {
    background-color: #fff;
    border-radius: 4px;
    padding: 16px 12px;
    color: #8855F3;
    border: 1px solid #8855F3;
}

.buttons button:last-child {
    background-color: #8855F3;
    border-radius: 4px;
    padding: 16px 12px;
    color: white;
    border: 1px solid #8855F3;
}

/* Right column (currently empty) */
.right-column {
    width: 47%;
    /* height: 652px; */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.small-heading{
    color: #0D0D0D;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    margin-top: 20px;
}




.upload-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 286px;
    height: 286px;
    position: relative;
    cursor: pointer;
}

.upload-box {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    transition: 0.3s;
}

.upload-icon {
    margin-bottom: 10px;
}

.upload-text {
    font-size: 12px;
    color: #2E2E2E;
    line-height: 1.4;
}

.image-preview {
    position: relative;
    width: 286px;
    height: 286px;
    border-radius: 8px;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}



/* canvas css */


.right-column {
    position: relative;
    overflow: hidden; /* Ensure image stays within this */
}

.upload-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

#upload-box,
.image-preview img {
    width: 286px;
    height: 286px;
    /* position: absolute; */
    /* top: 25%;
    left: 28%; */
    cursor: pointer;
}

.image-preview {
    /* position: absolute; */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    color: red;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    background-color: #fff;
    padding: 4px 8px;
    line-height: 1;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}



.right-column .image-preview {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.right-column .image-preview img {
    max-width: 100%;
    height: auto;
}

/* 
Skeleton Loading Animation CSS for Image Upload Feature
*/

.loading-overlay, .data-loading-overlay, .reset-loading-overlay, .cropping-loading-overlay, .saving-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.8); /* fade overlay */
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-spinner, .data-loading-spinner, .reset-loading-spinner, .cropping-loading-spinner, .saving-loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #ccc;
    border-top: 6px solid #2e2e2e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text, .data-loading-text, .reset-loading-text, .cropping-loading-text, .saving-loading-text {
    font-size: 1.2rem;
    color: #333;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



/* 
 Ended -- Skeleton Loading Animation CSS for Image Upload Feature
*/

/* 
 Notifcation CSS
*/

.upload-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #fff;
    border-bottom: 3px solid #81bf64;
    color: #333;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-in-out;
    max-width: 400px;
    font-size: 0.95rem;
}

.upload-toast .close-toast {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


/* 
 Ended - Notification CSS
*/


/* 
Cropping Related CSS
*/

.cropper-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    overflow: hidden;
}

.crop-mask {
    position: absolute;
    overflow: hidden;
}

.crop-box {
    position: absolute;
    border: 2px dashed #fff;
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 1px solid #000;
}

/* Corner handles */
.crop-handle-nw { top: -5px; left: -5px; }
.crop-handle-ne { top: -5px; right: -5px; }
.crop-handle-sw { bottom: -5px; left: -5px; }
.crop-handle-se { bottom: -5px; right: -5px; }

/* Side handles */
.crop-handle-n { 
    top: -5px; 
    left: 50%; 
    margin-left: -5px;
    width: 20px;
    height: 10px;
}
.crop-handle-s { 
    bottom: -5px; 
    left: 50%; 
    margin-left: -5px;
    width: 20px;
    height: 10px;
}
.crop-handle-w { 
    top: 50%; 
    left: -5px; 
    margin-top: -5px;
    width: 10px;
    height: 20px;
}
.crop-handle-e { 
    top: 50%; 
    right: -5px; 
    margin-top: -5px;
    width: 10px;
    height: 20px;
}

.crop-edit-tools {
    display: flex;
    gap: 10px;
}

.crop-edit-tools button {
    padding: 8px 15px;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.crop-edit-tools button:hover {
    background: #555;
}

/* border radius feature styling */

.radius-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.radius-group label {
    min-width: 100px;
}

.dimension-control {
    display: flex;
    align-items: center;
}

.dimension-control input {
    width: 88px;
    text-align: center;
    margin: 0 5px;
}

.radius-unit-toggle {
    padding: 5px !important;
    background-color: #e5e5e5 !important;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

.radius-unit-toggle:hover {
    background: #e0e0e0;
}

#reset-btn, #redo-btn, #undo-btn{
    cursor: pointer !important;
}

#reset-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

#reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#reset-btn:not(:disabled):hover {
    background-color: #f0f0f0;
}


input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  /* background: red; */
  border-radius: 3px;
  box-shadow: none;
}

/* input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #ff3c3c;
  margin-top: -7px; 
  cursor: pointer;
  transition: transform 0.2s;
} */

.edit-feature button.active{
    border-radius: 4px;
    background-color: #F3EEFE;
    color: #633EB1;
}

.edit-feature button.active svg path {
    stroke: #633EB1;
}

.image-preview img {
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
}


/* Mobile Responsive Styles (479px and below) */
@media screen and (max-width: 479px) {
    .ast-container{
        z-index: 50;
    }

    .main-customizer-container {
        padding: 0;
    }
    
    .customizer-inner-container {
        padding: 0;
    }
    
    .edit-tool-bar {
        flex-wrap: wrap;
        padding: 10px;
        gap: 5px;
        justify-content: space-between;
    }
    
    .edit-feature, .undo-edit-feature, .redo-edit-feature, .reset-edit-feature {
        flex: 0 0 calc(33% - 5px);
        margin-bottom: 5px;
    }
    
    .edit-feature button, .undo-edit-feature button, 
    .redo-edit-feature button, .reset-edit-feature button {
        width: 100%;
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .design-customizer-container {
        flex-direction: column;
        padding: 10px;
    }
    
    .design-customizer-container .inner-box {
        flex-direction: column;
        gap: 20px;
    }

    .design-info{
        align-self: flex-start;
    }
    
    .left-column, .right-column {
        width: 100%;
    }
    
    .left-column {
        margin-top: 20px;
        padding: 15px;
    }
    
    .right-column {
        height: auto;
        min-height: 300px;
        order: 1;
    }
    
    .card-image {
        width: 150px;
        height: auto;
        align-self: flex-start;
    }
    
    .card-content .cols {
        flex-direction: column;
    }
    
    .price-display {
        text-align: left;
    }
    
    .buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
    
    .buttons button {
        width: 100%;
    }
    
    .upload-wrapper, #upload-box, .image-preview {
        /* width: 190px;
        height: 190px;
        padding: 10px; */
        width: 100%;
        height: 300px;
    }
    
    .editing-options {
        margin-bottom: 20px;
    }
    
    .transform-edit-tools, .position-edit-tools {
        gap: 10px;
    }
    
    .resize-controls {
        align-items: flex-start;
    }
    
    .link-toggle {
        margin: 10px 0;
        align-self: center;
    }
    
    .dimension-control input {
        width: 60px;
    }
    
    /* Adjust crop handles for mobile */
    .crop-handle {
        width: 15px;
        height: 15px;
    }
    
    /* Loading overlays */
    .loading-overlay, .data-loading-overlay, 
    .reset-loading-overlay, .cropping-loading-overlay, 
    .saving-loading-overlay {
        width: 100%;
        height: 100%;
    }
    
    /* Hide some elements to save space */
    .upload-text br {
        display: none;
    }
    
    /* Adjust transform controls */
    #rotate-slider {
        width: calc(100% - 70px);
    }
    
    .design-selection-modal {
        width: 350px !important;
        padding: 15px;
    }
    
    .design-option {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .design-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
    
    /* Save options dialog */
    .save-options-content {
        width: 95%;
    }
}
