body {
    font-family: Arial, sans-serif;
    background-color: #fffffb;
    color: #3e363f;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 900px;
    margin: 50px auto;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #3b87b8;
}

form label {
    display: block;
    margin-top: 10px;
    color: #3e363f;
}

form input,
form select,
form textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

button {
    display: block;
    width: 100%;
    padding: 10px;
    background: #ff6900;
    color: #fff;
    border: none;
    border-radius: 4px;
    margin-top: 20px;
    cursor: pointer;
}

button:hover {
    background: #f49700;
}

.modal-open .background-content {
    pointer-events: none; /* Disable interaction with background content */
}


#orderSummary {
    margin-top: 20px;
    padding: 10px;
    background: #e9ecef;
    border-radius: 4px;
    color: #3e363f;
}

#errorContainer p {
    margin: 5px 0;
    color: #dd403a;
}


.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  /* No need for opacity or transform scaling on the entire grid anymore */
}

/* Start the item "flipped" and invisible. */
.grid-item {
  background: #f9f9f9;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
  opacity: 1; /* Changed from 0 to 1 to make items visible by default */
  transform: none; /* Remove the initial transform that was hiding items */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Modify the show class to be optional enhancement */
.grid-item.show {
  animation: none; /* Don't apply animation by default */
}

/* Keyframes for the flip */
@keyframes flipIn {
  0% {
    opacity: 0;
    transform: perspective(600px) rotateY(180deg); /* Starting from 90deg */
  }
  60% {
    transform: perspective(600px) rotateY(-10deg); /* Over-rotate slightly for emphasis */
  }
  80% {
    transform: perspective(600px) rotateY(10deg);  /* Flip back the other way a bit */
  }
  100% {
    opacity: 1;
    transform: perspective(600px) rotateY(0deg);   /* Face forward */
  }
}

.grid-item img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 10px;
}

.grid-item h3 {
  margin: 0 0 10px;
  font-size: 1em;
}


#cart-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #fff;
    padding: 15px;
    font-size: 2em;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease; /* Smooth transition */
}

/* Hover effect */
#cart-icon:hover {
    background-color: #f49700; /* Change background color */
    transform: scale(1.2); /* Scale the icon */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); /* Add a shadow */
}


#cart-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: red;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

#cart-count.animate {
    transform: scale(1.5);
    background-color: #f49700; /* Temporary color flash */
}

#cart-count.animate {
    animation: cart-bounce 0.5s ease;
}

@keyframes cart-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    z-index: 999; /* Ensure it's above other content */
    display: none; /* Hidden by default */
}

.modal {
    position: fixed; /* Fixed position locks the modal in place */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    display: none; /* Hidden by default */
    justify-content: center; /* Center the modal horizontally */
    align-items: center; /* Center the modal vertically */
    overflow-y: auto; /* Allow scrolling within the modal */
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000; /* Ensure it's above the overlay */
}

@keyframes flash {
    0% { background-color: red; }
    50% { background-color: white; }
    100% { background-color: red; }
}

.flash-effect {
    animation: flash 0.5s infinite;
}

/* Modal image styles */
#photoContainer {
    position: relative;
    text-align: center;
}

#garmentPhoto {
    width: 100%;
    max-height: 400px; /* Adjust this value as needed */
    object-fit: cover;
    object-position: top; /* Ensure the top half of the image is visible */
}

.photo-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 50%;
    z-index: 1001; /* Ensure the buttons are above the image */
    width: auto; /* Ensure buttons are not stretched */
    height: auto; /* Ensure buttons are not stretched */
}

#previousPhotoButton {
    left: 10px;
}

#nextPhotoButton {
    right: 10px;
}

.photo-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Cart Styles */
#cart {
  display: none;
  /*  margin-top: 20px;
    background-color: #f9f9f9; /* Light background for the cart
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);*/
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cart-item:not(:last-child) {
    margin-bottom: 15px;
    border-bottom: none; /* Remove bottom border for all items except the last one */
}

.cart-item img {
    max-width: 50px; /* Thumbnail size */
    margin-right: 20px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #333;
}

.cart-item-details p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

.cart-item-quantity,
.cart-item-price,
.cart-item-remove {
    font-size: 0.9em;
    color: #333;
}

.cart-item-quantity input {
    width: 50px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 10px;
}

.cart-item-remove button {
    width: auto !important;
    display: inline-block !important;
    background-color: #ff4c4c;
    color: white;
    border: none;
    padding: 5px 10px; /* Smaller padding for a more compact button */
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    width: auto; /* Ensure the button doesn't stretch to full width */
    display: inline-block; /* Ensure the button is inline */
    margin-left: 10px; /* Add some space if needed */
}

.cart-item-remove button:hover {
    background-color: #ff1a1a;
}

#orderSummary {
    margin-top: 20px;
    padding: 20px;
    background-color: #e9ecef;
    border-radius: 8px;
    color: #3e363f;
    font-size: 1em;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#orderSummary h3 {
    margin-top: 0;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff; /* Color of the spinner */
    animation: spin 1s ease-in-out infinite; /* Spinning animation */
}

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

#submitCartButton {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #3b87b8; /* Main color for the button */
    color: white;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    margin-top: 20px;
    cursor: pointer;
}

#submitCartButton:hover {
    background-color: #336d9e; /* Darken the button on hover */
}

#submitCartModal {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%; /* Adjust the width as needed */
    height: 100%;
    background-color: #fff; /* Set a background color for the modal */
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
    z-index: 1001; /* Ensure it's above other content */
    display: none; /* Hide modal by default */
    padding: 20px;
    overflow-y: auto; /* Enable scrolling within the modal */
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

#closeGarment {
    position: absolute;
    top: 10px; /* Adjust this value to fine-tune positioning */
    right: 15px; /* Adjust this value to fine-tune positioning */
    display: inline-block;
    width: auto;
    padding: 10px; /* Increase padding to make the button area larger */
    background: none;
    color: #c7c7c7;
    border: none;
    border-radius: 0;
    font-size: 32px; /* Increase font size to make the button more prominent */
    cursor: pointer;
    z-index: 1001;
}

#closeGarment:hover {
    color: black; /* Change color on hover for visibility */
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Loading spinner styles */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 20px;
    color: #666;
}

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}
