@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap");

body {
    font-family: "Poppins", sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
}

.container {
    max-width: 800px;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

button {
    background-color: #60b5da;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #4a91ad;
}

#progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
}

#progress-bar {
    width: 0;
    height: 100%;
    background-color: #60b5da;
    transition: width 0.3s;
}

#image-container {
    max-width: 100%;
    margin-bottom: 20px;
}

#image {
    max-width: 100%;
    height: auto;
}

#crop-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

select {
    padding: 5px;
    font-size: 16px;
}

#result-section {
    text-align: center;
}

#cropped-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 30px;
}

#continue-button {
    float: right;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #60b5da;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

a {
    color: #424949;
    font-size: 15px;
    letter-spacing: 3px;
    text-decoration: none;
    cursor: pointer;
}

a:active, a:visited {
    color: #424949;
}

a:hover {
    color: #60b5da;
}

.overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    transition: opacity 500ms;
    visibility: hidden;
    opacity: 0;
    z-index: 1000;
}

.overlay:target {
    visibility: visible;
    opacity: 1;
}

.popup {
    margin: 70px auto;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    width: 30%;
    position: relative;
    transition: all 5s ease-in-out;
}

.popup h2 {
    margin-top: 0;
    color: #333;
    font-family: "Poppins", sans-serif;
}

.popup .close {
    position: absolute;
    top: 20px;
    right: 30px;
    transition: all 200ms;
    font-size: 30px;
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

.popup .close:hover {
    color: #06D85F;
}

.popup .content {
    max-height: 30%;
    overflow: auto;
}

.option-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin: -10px;
}

.option {
    width: calc(33.33% - 20px);
    min-width: 150px;
    margin: 10px;
    text-align: center;
    box-sizing: border-box;
}

.option img {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.option img.selected {
    border-color: #60b5da;
}

.option p {
    margin: 5px 0;
}

.option .description {
    font-size: 14px;
    color: #666;
}

#color-picker-container {
    margin-top: 10px;
}

.section-title {
    text-align: left;
    margin-top: 20px;
    margin-bottom: 10px;
}

.section {
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

#crop-tool-container, #size-selection-container {
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

#size-selection-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

#size-selection-container > * {
    margin-bottom: 10px;
}

#price-and-type-display {
    font-size: 1.2em;
    font-weight: bold;
    margin: 15px 0;
    text-align: center;
}

#price-display, #print-type-display {
    display: inline-block;
    margin: 0 10px;
}

#add-to-cart-button {
    display: none;
    margin: 15px auto;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#loading-message {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    font-size: 18px;
}

@media (max-width: 768px) {
    .option {
        width: calc(50% - 20px);
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    #crop-controls {
        flex-direction: column;
    }

    #crop-controls > * {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .option {
        width: 100%;
    }
}

@media screen and (max-width: 700px) {
    .popup {
        width: 70%;
    }
}

/* ... (existing styles) ... */

.overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    transition: opacity 500ms;
    visibility: hidden;
    opacity: 0;
    z-index: 1000;
}

.overlay:target {
    visibility: visible;
    opacity: 1;
}

.popup {
    margin: 70px auto;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    width: 70%;
    position: relative;
    transition: all 5s ease-in-out;
}

.popup h2 {
    margin-top: 0;
    color: #333;
    font-family: "Poppins", sans-serif;
}

.popup .close {
    position: absolute;
    top: 20px;
    right: 30px;
    transition: all 200ms;
    font-size: 30px;
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

.popup .close:hover {
    color: #06D85F;
}

.popup .content {
    max-height: 70vh;
    overflow: auto;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.image-item {
    position: relative;
    cursor: pointer;
}

.image-item img {
    width: 100%;
    height: auto;
    display: block;
}

.image-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: transparent;
    color: white;
    border: none;
    font-size: 24px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    padding: 0;
    width: 24px;
    height: 24px;
}

.image-item .delete-btn:hover {
    color: #ff4444;
}

/* New styles for button spinner */
.button-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin: 0 10px 0 0;
    display: inline-block;
    vertical-align: middle;
}

#add-to-cart-button:disabled,
#finish-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#add-to-cart-button .spinner,
#finish-button .spinner {
    margin: 0 10px 0 0;
}

/* New styles for crop button spinner */
.crop-button-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: crop-spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes crop-spin {
    to { transform: rotate(360deg); }
}

#crop-button {
    display: flex;
    align-items: center;
    justify-content: center;
}

#crop-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}