:root {
  --cart-gap: 20px;
  --cart-radius: 8px;
}

.sp-gallery-protected-gallery {
  display: flex;
  flex-wrap: wrap; /* Enable wrapping so h3 sits on its own row */
  justify-content: center;
  column-gap: 20px;
}

.sp-gallery-protected-gallery-login,
.sp-gallery-protected-gallery-password {
  /* //background-color: #eee; */
  border-radius: 10px;
  padding: 50px;
  align-content: center;
  width: 100%; /* Ensure child div takes full width (optional) */
  max-width: 60%; /* Optional: Set a max width for the child */
}

.sp-gallery-protected-gallery-password p,
.sp-gallery-protected-gallery-login p {
  margin-bottom: 15px;
  font-size: 16px;
  color: #333;
}

.sp-gallery-protected-gallery-password input[type='password'],
.sp-gallery-protected-gallery-login input[type='text'],
.sp-gallery-protected-gallery-login input[type='password'] {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
  font-size: 16px;
}

.sp-gallery-protected-gallery-password input[type='submit'],
.sp-gallery-protected-gallery-login input[type='submit'] {
  background-color: var(--sp-gallery-color-primary, var(--wp--preset--color--primary, #0073aa)); /* Fallback to blue if theme color is unavailable */
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
  margin-top: 10px;
}

.sp-gallery-protected-gallery-password input[type='submit']:hover,
.sp-gallery-protected-gallery-login input[type='submit']:hover {
  background-color: var(--sp-gallery-color-accent, var(--wp--preset--color--primary-hover, #005e8b)); /* Fallback hover color */
}

.sp-gallery-protected-gallery-login label {
  font-weight: bold;
  color: #333;
}

.sp-gallery-protected-gallery-login a {
  text-decoration: none;
}

.sp-gallery-protected-gallery-login a:hover {
  text-decoration: underline;
}

.sp-gallery-protected-gallery-login .login-remember label {
  font-size: 14px;
  color: #555;
}

.sp-gallery-protected-gallery h3 {
  width: 100%;
  text-align: center;
  margin-bottom: 30px;
}
.sp-gallery-image-icon:hover polyline {
  stroke: #ee2e4f;
}

.sp-gallery-proofing-icon:hover path {
  stroke: #fff;
}

/* Base modal styling */

.sp-gallery-loading-spinner {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 999;
  display: flex;

  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.sp-gallery-loading-spinner::before {
  display: block;
  content: '';
  width: 100px;
  height: 100px;
  border: 10px solid rgba(220, 220, 220, 1);
  border-top-color: var(--sp-gallery-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#sp-gallery-cart-popup.sp-gallery-modal {
  --modal-padding: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.6);
  padding: var(--modal-padding);
  box-sizing: border-box;
}

.sp-gallery-modal-content {
  background-color: #fff;
  position: relative;
  width: calc(100% - calc(var(--modal-padding) * 2)); /* Full width minus 50px margin on both sides */
  height: 100%;
  max-height: calc(100% - calc(var(--modal-padding) * 2)); /* Full height minus 50px top/bottom */
  margin: auto;
  padding: var(--cart-gap);
  box-sizing: border-box;
  border-radius: var(--cart-radius);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

#sp-gallery-cart-popup-content {
  display: flex;
  height: 100%;
}

/* Close button */
.sp-gallery-close {
  color: #aaa;
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 30px;
  line-height: 30px;
  font-weight: bold;
  cursor: pointer;
  margin: 0;
  padding: 0;
  height: 30px;
  width: 30px;
  text-align: center;
}

.sp-gallery-close:hover {
  color: #000;
}

.sp-gallery-grouped-products {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sp-gallery-cart-layout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cart-gap);
  max-width: 100%;
  height: 100%;
  flex: 1;
}

.sp-gallery-cart-left {
  flex: 1;
  display: flex;
  max-height: 100%;
  height: auto;
  justify-self: stretch;
}

.sp-gallery-cart-left img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--cart-radius);
  max-height: 100%;
  object-fit: contain;
}
.sp-gallery-cart-right {
  flex: 2;
  max-width: 100%;
  background: #fff;
  border-radius: var(--cart-radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  padding: var(--cart-gap);
  height: 100%;
  overflow-y: auto;
  display: flex;
  box-sizing: border-box;
}

.sp-gallery-cart-right-inner {
  width: 100%;
  overflow-y: auto;
}

.sp-gallery-grouped-form {
  display: flex;
  flex-direction: column;
  gap: var(--cart-gap);
}

.sp-gallery-grouped-products {
  display: flex;
  flex-direction: column;
  gap: 0px;
  background-color: #f4f4f4;
  padding: var(--cart-gap);
  border-radius: var(--cart-radius);
}

.sp-gallery-product-row {
  display: grid;
  grid-template-columns: 1fr auto;
  justify-content: space-between;
  align-items: center;
  gap: calc(var(--cart-gap) / 2);
  padding: var(--cart-gap) 0;
  border-bottom: 1px solid #bbbbbb;

  grid-template-columns: 1fr auto;
}

.sp-gallery-product-row-inner {
  display: flex;
  flex-direction: row;
  gap: 20px;
  justify-content: space-between;
}

.sp-gallery-product-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.sp-gallery-product-row-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2px;
  flex-direction: column;
}

.sp-gallery-short-description {
  font-size: 16px;
}

.sp-gallery-product-row-attributes {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: calc(var(--cart-gap) / 2);
  flex-wrap: wrap;
  align-items: end;
}

.sp-gallery-product-row-price {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: calc(var(--cart-gap) / 2);
  flex-direction: row;
  grid-column: 2;
  align-self: end;
}
.sp-gallery-product-group-header {
  border-bottom: solid 1px;
  padding: 0 0 10px;
}

.sp-gallery-product-group-title {
  font-weight: 700;
  font-size: 24px;
}

.sp-gallery-product-group-description {
  font-size: 18px;
}

.sp-gallery-title {
  flex: 1;
  font-weight: 500;
  color: #333;
}

.sp-gallery-price {
  color: #444;
  font-weight: 500;
  white-space: nowrap;
  min-width: 5rem;
  text-align: right;
}

.sp-gallery-product-row-attributes select {
  padding: 6px 12px 6px 8px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  transition: border 0.2s;
  cursor: pointer;
}

.sp-gallery-product-row-attributes label {
  padding: 6px 8px;
  font-size: 16px;
  border-radius: 6px;
  transition: border 0.2s;
}

.sp-gallery-qty input[type='number']:focus {
  border-color: #0073aa;
  outline: none;
}

.sp-gallery-add-to-cart-button {
  background-color: var(--sp-gallery-color-primary);
  color: #fff;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.sp-gallery-add-to-cart-button:hover {
  background-color: var(--sp-gallery-color-accent);
}

.sp-gallery-qty {
  color: #000;
  background: #fff;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 6px;
}

.sp-gallery-qty input[type='number'] {
  width: 30px;
  padding: 6px 8px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  transition: border 0.2s;
}
.sp-gallery-qty .sp-gallery-product-qty,
.sp-gallery-qty .sp-gallery-qty-count {
  background: transparent;
  color: inherit;
  font-weight: bold;
  font-size: inherit;
  border: none;
  display: inline-block;
  min-width: 0;
  line-height: 1;
}
.sp-gallery-qty .sp-gallery-product-qty:focus,
.sp-gallery-qty .sp-gallery-qty-count:focus {
  outline: none;
}
.sp-gallery-qty .sp-gallery-product-qty {
  width: 50px;
  min-width: 0;
  display: inline-block;
  text-align: center;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
}
.sp-gallery-qty .sp-gallery-product-qty::-webkit-outer-spin-button,
.sp-gallery-qty .sp-gallery-product-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.sp-gallery-qty .sp-gallery-qty-count {
  padding: 0;
  cursor: pointer;
  width: 2rem;
  font-size: 1.25em;
  text-indent: -100px;
  overflow: hidden;
  position: relative;
}
.sp-gallery-qty .sp-gallery-qty-count:before,
.sp-gallery-qty .sp-gallery-qty-count:after {
  content: '';
  height: 2px;
  width: 10px;
  position: absolute;
  display: block;
  background: #000;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}
.sp-gallery-qty .sp-gallery-qty-count--minus {
  border-right: 1px solid #e2e2e2;
}
.sp-gallery-qty .sp-gallery-qty-count--add {
  border-left: 1px solid #e2e2e2;
}
.sp-gallery-qty .sp-gallery-qty-count--add:after {
  transform: rotate(90deg);
}
.sp-gallery-qty .sp-gallery-qty-count:disabled,
.sp-gallery-product-qty:disabled {
  color: #ccc;
  cursor: not-allowed;
  border-color: transparent;
}
.sp-gallery-qty .sp-gallery-qty-count:disabled:before,
.sp-gallery-qty .sp-gallery-qty-count:disabled:after {
  background: #ccc;
}

@media (max-width: 1440px) {
  .sp-gallery-product-row-content {
    grid-column: 1;
  }

  .sp-gallery-product-row-price {
    flex-direction: column;
    align-items: end;
  }
  .sp-gallery-product-row-attributes {
    grid-column: 1;
  }
}

@media (max-width: 1024px) {
  .sp-gallery-protected-gallery-login,
  .sp-gallery-protected-gallery-password {
    max-width: 75%;
    padding: 50px;
  }

  .sp-gallery-product-row {
    gap: 20px;
  }

  .sp-gallery-product-row-inner {
    width: 100%;
  }

  .sp-gallery-product-row-attributes {
    grid-column: 1;
    justify-content: flex-end;
  }
  .sp-gallery-product-row-price {
    flex-direction: column;
    align-items: end;
  }
  #sp-gallery-cart-popup.sp-gallery-modal {
    --modal-padding: 25px;
    --cart-gap: 20px;
  }

  .sp-gallery-cart-layout {
    flex-direction: column;
  }

  .sp-gallery-cart-left,
  .sp-gallery-cart-right {
    width: 100%;
  }

  .sp-gallery-cart-left {
    max-height: 25%;
    justify-content: space-around;
  }
}

@media (max-width: 768px) {
  .sp-gallery-protected-gallery {
    grid-template-columns: 1fr;
  }

  .sp-gallery-protected-gallery-login,
  .sp-gallery-protected-gallery-password {
    max-width: 100%;
    padding: 20px;
  }

  #sp-gallery-cart-popup.sp-gallery-modal {
    --modal-padding: 15px;
    --cart-gap: 20px;
  }

  .sp-gallery-product-row {
    display: flex;
    flex-wrap: wrap;
  }
  .sp-gallery-product-row-attributes {
    flex-direction: column;
  }

  .sp-gallery-product-row-price {
    justify-self: flex-end;
    flex: 1;
  }
  .sp-gallery-cart-right {
    width: 100%;
    padding: 0;
    background-color: initial;
    box-shadow: none;
  }

  .sp-gallery-cart-left {
    flex: 0;
  }
}

@media (max-width: 480px) {
  #sp-gallery-cart-popup.sp-gallery-modal {
    --modal-padding: 10px;
    --cart-gap: 10px;
  }

  .sp-gallery-product-row-attributes {
    flex-direction: column;
    justify-content: stretch;
    width: 100%;
  }
}
