
/* =====================================================
   THE DYNASTY — ADD TO CART POPUP
   Updated product details + compact lower controls
   ===================================================== */

body.add-to-cart-modal-open {
  overflow: hidden;
}

/* ---------------- OVERLAY ---------------- */

.add-to-cart-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;

  display: grid;
  place-items: center;

  padding: 20px;
  background: rgba(22, 18, 17, 0.42);
}

.add-to-cart-modal[hidden] {
  display: none !important;
}

/* ---------------- MAIN POPUP ---------------- */

.add-to-cart-modal__dialog {
  position: relative;

  width: min(100%, 390px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);

  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;

  padding: 20px 24px;

  border: 1px solid #e7e1dc;
  border-radius: 8px;

  background: #fff;
  color: #1d1b1b;

  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;

  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.20);
}

/* ---------------- CLOSE BUTTON ---------------- */

.add-to-cart-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  height: 38px;
  padding: 0;

  border: 0;
  border-radius: 4px;

  background: transparent;
  color: #332f2d;

  cursor: pointer;
  font-family: inherit;
  font-size: 24px;
  line-height: 1;
}

.add-to-cart-modal__close:hover {
  color: #832422;
  background: #f9f6f3;
}

/* =====================================================
   PRODUCT IMAGE AND DETAILS
   Image: 80px → 83px
   Product title: 16px → 19px
   ===================================================== */

.add-to-cart-modal__product {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  min-width: 0;

  padding-right: 34px;
  margin-bottom: 12px;
}

.add-to-cart-modal__image {
  display: block;

  width: 83px;
  height: 83px;
  flex: 0 0 83px;

  box-sizing: border-box;

  border: 1px solid #eee8e3;
  background: #faf8f6;

  object-fit: cover;
  object-position: center;
}

.add-to-cart-modal__product > div {
  flex: 1 1 auto;
  min-width: 0;
}

.add-to-cart-modal__title {
  margin: 2px 0 8px;

  color: #1d1b1b;

  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;

  overflow-wrap: anywhere;
}

/* ---------------- PRICE DETAILS ---------------- */

.add-to-cart-modal__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 8px;

  font-size: 15px;
  line-height: 1.5;
}

.add-to-cart-modal__sale {
  color: #832422;
  font-weight: 700;
}

.add-to-cart-modal__mrp {
  color: #777;
  font-size: 13px;
  text-decoration: line-through;
}

/* Always hide discount percentage. */
.add-to-cart-modal__discount {
  display: none !important;
}

/* =====================================================
   SIZE SELECTOR
   Width: 220px → 216px
   Height: 40px → 36px
   Font size unchanged
   ===================================================== */

.add-to-cart-modal__field {
  display: flex;
  flex-direction: column;
  align-items: center;

  min-width: 0;
  margin: 10px 0;
}

.add-to-cart-modal__label {
  display: block;

  width: 100%;
  margin-bottom: 6px;

  color: #4b4541;

  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;

  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.add-to-cart-modal__field[data-atc-size-field] {
  margin: 10px 0;
}

.add-to-cart-modal__field[data-atc-size-field][hidden] {
  display: none !important;
}

.add-to-cart-modal__select {
  width: 100%;
  min-height: 42px;

  box-sizing: border-box;
  padding: 0 12px;

  border: 1px solid #cbc3bd;
  border-radius: 4px;

  background: #fff;
  color: #25211f;

  font-family: inherit;
  font-size: 14px;
}

.add-to-cart-modal__field[data-atc-size-field]
.add-to-cart-modal__select {
  width: min(100%, 116px);
  height: 36px;
  min-height: 36px;

  padding: 0 28px 0 12px;

  border-color: #ded9d2;
  border-radius: 4px;

  background-color: #fffdf9;
  font-size: 14px;
}

/* =====================================================
   QUANTITY CONTROL
   Width: 142px → 138px
   Height: 46px → 42px
   Font size unchanged
   ===================================================== */

.add-to-cart-modal__field:not([data-atc-size-field]) {
  margin: 10px 0;
}

.add-to-cart-modal__quantity {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;

  height: 42px;
  min-height: 42px;

  overflow: hidden;

  border: 1px solid #cbc3bd;
  border-radius: 4px;

  background: #fff;
}

.add-to-cart-modal__quantity button {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  min-width: 42px;
  height: 40px;
  padding: 0;

  border: 0;

  background: #fff;
  color: #2b2826;

  cursor: pointer;
  font-family: inherit;
  font-size: 20px;
}

.add-to-cart-modal__quantity button:hover:not(:disabled) {
  background: #f8f5f2;
  color: #832422;
}

.add-to-cart-modal__quantity button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.add-to-cart-modal__quantity input {
  width: 50px;
  min-width: 0;
  height: 40px;

  box-sizing: border-box;
  padding: 0 3px;

  border: 0;
  border-right: 1px solid #cbc3bd;
  border-left: 1px solid #cbc3bd;
  border-radius: 0;

  background: #fff;
  color: #25211f;

  font-family: inherit;
  font-size: 14px;
  text-align: center;
}

.add-to-cart-modal__quantity input::-webkit-inner-spin-button,
.add-to-cart-modal__quantity input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.add-to-cart-modal__quantity input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* =====================================================
   ERROR MESSAGE
   ===================================================== */

.add-to-cart-modal__error {
  width: 100%;
  min-height: 0;

  margin: 6px 0 0;

  color: #a32020;
  font-size: 13px;
  line-height: 1.5;

  text-align: center;
  overflow-wrap: anywhere;
}

.add-to-cart-modal__error:empty {
  display: none;
}

/* =====================================================
   ADD TO CART BUTTON
   Width: 100% of dialog content
   Height: 48px → 44px
   Font size unchanged
   ===================================================== */

.add-to-cart-modal__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;

  margin-top: 10px;
}

.add-to-cart-modal__submit {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 44px;
  min-height: 44px;

  box-sizing: border-box;
  padding: 0 12px;

  border: 1px solid #832422;
  border-radius: 4px;

  background: #832422;
  color: #fff;

  cursor: pointer;

  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;

  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.add-to-cart-modal__submit:hover:not(:disabled) {
  background: #681b1a;
  border-color: #681b1a;
}

.add-to-cart-modal__submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

.add-to-cart-modal__details {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 32px;
  padding: 4px 8px;

  color: #302b29;

  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.add-to-cart-modal__details:hover {
  color: #832422;
  text-decoration: underline;
}

/* ---------------- KEYBOARD FOCUS ---------------- */

.add-to-cart-modal__close:focus-visible,
.add-to-cart-modal__select:focus-visible,
.add-to-cart-modal__quantity button:focus-visible,
.add-to-cart-modal__quantity input:focus-visible,
.add-to-cart-modal__submit:focus-visible,
.add-to-cart-modal__details:focus-visible {
  outline: 2px solid #832422;
  outline-offset: 2px;
}

/* =====================================================
   MOBILE LAYOUT
   Product image: 57px → 60px
   Product title: current mobile size + 3px
   Lower controls: compact dimensions
   ===================================================== */

@media (max-width: 768px) {
  .add-to-cart-modal {
    padding: 12px;
  }

  .add-to-cart-modal__dialog {
    width: min(calc(88vw - 3px), 337px);

    max-height: calc(85vh - 3px);
    max-height: calc(85dvh - 3px);

    overflow-x: hidden;
    overflow-y: auto;

    padding: 11px;
  }

  .add-to-cart-modal__close {
    top: 4px;
    right: 4px;

    width: 36px;
    height: 36px;

    font-size: 22px;
  }

  /* Product image and details: slightly larger. */
  .add-to-cart-modal__product {
    gap: 7px;
    padding-right: 32px;
    margin-bottom: 5px;
  }

  .add-to-cart-modal__image {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }

  .add-to-cart-modal__title {
    margin: 0 0 2px;

    font-size: calc(.9rem + 5px);
    line-height: 1.35;
  }

  .add-to-cart-modal__price {
    gap: 3px;
    font-size: calc(.85rem + 2px);
  }

  .add-to-cart-modal__mrp {
    font-size: calc(.84rem + 2px);
  }

  /* Reduce vertical gaps around lower controls. */
  .add-to-cart-modal__field,
  .add-to-cart-modal__field[data-atc-size-field],
  .add-to-cart-modal__field:not([data-atc-size-field]) {
    margin: 3px 0;
  }

  .add-to-cart-modal__label {
    margin-bottom: 1px;
    font-size: calc(.7rem + 2px);
  }

  /* Size dropdown: reduce width and height by 4px. */
  .add-to-cart-modal__field[data-atc-size-field]
  .add-to-cart-modal__select {
    width: min(100%, 193px);

    height: 31px;
    min-height: 31px;

    padding: 0 25px 0 7px;
    font-size: calc(.82rem + 2px);
  }

  /* Quantity box: reduce height by 4px. */
  .add-to-cart-modal__quantity {
    height: 31px;
    min-height: 31px;
  }

  .add-to-cart-modal__quantity button {
    width: 31px;
    min-width: 31px;
    height: 29px;

    font-size: 20px;
  }

  .add-to-cart-modal__quantity input {
    width: 41px;
    height: 29px;

    font-size: calc(.85rem + 2px);
  }

  /* Add to Cart: reduce height by 4px. */
  .add-to-cart-modal__actions {
    gap: 0;
    margin-top: 5px;
  }

  .add-to-cart-modal__submit {
    height: 35px;
    min-height: 35px;

    padding: 0 10px;
    font-size: calc(.8rem + 2px);
  }

  .add-to-cart-modal__details {
    min-height: 25px;
    padding: 2px 6px;

    font-size: calc(.78rem + 2px);
  }

  .add-to-cart-modal__error {
    font-size: calc(.86rem + 2px);
  }
}

/* ---------------- VERY NARROW PHONES ---------------- */

@media (max-width: 360px) {
  .add-to-cart-modal {
    padding: 8px;
  }

  .add-to-cart-modal__dialog {
    width: 100%;
    padding: 10px;
  }

  .add-to-cart-modal__product {
    gap: 6px;
    padding-right: 30px;
  }

  .add-to-cart-modal__image {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .add-to-cart-modal__title {
    font-size: calc(.9rem + 5px);
  }

  .add-to-cart-modal__field[data-atc-size-field]
  .add-to-cart-modal__select {
    width: min(100%, 193px);
  }
}
/* Quantity selection box — smaller layout, unchanged fonts */
.add-to-cart-modal__quantity {
  height: 30px;
  min-height: 30px;
}

.add-to-cart-modal__quantity button {
  width: 27px;
  min-width: 27px;
  height: 25px;
  font-size: 20px; /* unchanged */
}

.add-to-cart-modal__quantity input {
  width: 35px;
  height: 25px;
  font-size: calc(.85rem + 2px); /* unchanged */
}

/* Add to Cart button — smaller layout, unchanged fonts */
.add-to-cart-modal__submit {
  width: calc(100% - 8px);
  height: 31px;
  min-height: 31px;
  justify-self: center;
  padding: 0 8px;
  font-size: calc(.8rem + 2px); /* unchanged */
}

/* Keep the layout compact */
.add-to-cart-modal__actions {
  margin-top: 4px;
}

/* ==========================================
   THE DYNASTY — MOBILE ADD TO CART POPUP
   Consistent vertical layout and spacing
   ========================================== */

@media (max-width: 768px) {

  /* Overlay */
  .add-to-cart-modal {
    padding: 14px;
    place-items: center;
  }

  /* Main popup */
  .add-to-cart-modal__dialog {
    width: 100%;
    max-width: 340px;

    max-height: calc(90dvh - 20px);

    padding: 16px 13px;

    overflow-x: hidden;
    overflow-y: auto;

    border-radius: 8px;
    box-sizing: border-box;
  }

  /* Product image and information */
  .add-to-cart-modal__product {
    display: flex;
    align-items: flex-start;

    gap: 9px;
    padding-right: 29px;
    margin-bottom: 16px;
  }

  .add-to-cart-modal__image {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
  }

  .add-to-cart-modal__product > div {
    flex: 1 1 auto;
    min-width: 0;
  }

  .add-to-cart-modal__title {
    margin: 0 0 5px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .add-to-cart-modal__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 6px;
    line-height: 1.5;
  }

  /* Consistent spacing for the size section */
  .add-to-cart-modal__field[data-atc-size-field] {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0 16px;
  }

  .add-to-cart-modal__field[data-atc-size-field]
  .add-to-cart-modal__label {
    margin-bottom: 7px;
    text-align: center;
  }

  .add-to-cart-modal__field[data-atc-size-field]
  .add-to-cart-modal__select {
    width: min(100%, 116px);
    height: 36px;
    min-height: 36px;
    box-sizing: border-box;
  }

  /* Consistent spacing for quantity */
  .add-to-cart-modal__field:not([data-atc-size-field]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0 16px;
  }

  .add-to-cart-modal__field:not([data-atc-size-field])
  .add-to-cart-modal__label {
    margin-bottom: 7px;
    text-align: center;
  }

  .add-to-cart-modal__quantity {
    height: 31px;
    min-height: 31px;
  }

  .add-to-cart-modal__quantity button {
    width: 31px;
    min-width: 31px;
    height: 29px;
  }

  .add-to-cart-modal__quantity input {
    width: 41px;
    height: 29px;
  }

  /* Error message spacing */
  .add-to-cart-modal__error {
    margin: 0 0 10px;
    line-height: 1.5;
  }

  /* Add to Cart button */
  .add-to-cart-modal__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 0;
  }

  .add-to-cart-modal__submit {
    width: calc(100% - 8px);
    height: 31px;
    min-height: 31px;
    justify-self: center;
    box-sizing: border-box;
  }

  /* Product details link */
  .add-to-cart-modal__details {
    min-height: 32px;
    padding: 3px 6px;
    justify-content: center;
    text-align: center;
  }

  /* Close button */
  .add-to-cart-modal__close {
    top: 4px;
    right: 4px;
  }
}

/* Very narrow phones */
@media (max-width: 360px) {
  .add-to-cart-modal {
    padding: 10px;
  }

  .add-to-cart-modal__dialog {
    padding: 14px 11px;
  }

  .add-to-cart-modal__product {
    gap: 7px;
    padding-right: 28px;
  }

  .add-to-cart-modal__image {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }
}

/* Mobile Add to Cart Popup — Final spacing adjustment */
@media (max-width: 768px) {

  /* Product image: increase by 2px */
  .add-to-cart-modal__image {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
  }

  /* Product title: increase font size by 2px */
  .add-to-cart-modal__title {
    font-size: calc(.9rem + 7px);
    line-height: 1.35;
    margin-bottom: 3px;
  }

  /* Reduce gap below product information by 2px */
  .add-to-cart-modal__product {
    margin-bottom: 14px;
  }

  /* Size section: reduce bottom spacing by 2px */
  .add-to-cart-modal__field[data-atc-size-field] {
    margin-bottom: 14px;
  }

  /* Quantity section: reduce bottom spacing by 2px */
  .add-to-cart-modal__field:not([data-atc-size-field]) {
    margin-bottom: 14px;
  }

  /* Reduce space above the Add to Cart button */
  .add-to-cart-modal__actions {
    gap: 6px;
  }

  /* Keep button dimensions and font size unchanged */
  .add-to-cart-modal__submit {
    height: 31px;
    min-height: 31px;
    font-size: calc(.8rem + 2px);
  }

  /* Reduce spacing between the size label and dropdown */
  .add-to-cart-modal__field[data-atc-size-field]
  .add-to-cart-modal__label {
    margin-bottom: 5px;
  }

  /* Reduce spacing between quantity label and box */
  .add-to-cart-modal__field:not([data-atc-size-field])
  .add-to-cart-modal__label {
    margin-bottom: 5px;
  }
}

/* Fix product image size in the mobile Add to Cart popup */
@media (max-width: 768px) {
  .add-to-cart-modal .add-to-cart-modal__product img.add-to-cart-modal__image,
  .add-to-cart-modal img[data-atc-image] {
    width: 70px !important;
    height: 70px !important;
    min-width: 70px !important;
    min-height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
    flex: 0 0 70px !important;
    object-fit: cover;
    box-sizing: border-box;
  }
}

/* Reduce excessive vertical gaps in mobile Add to Cart popup */
@media (max-width: 768px) {

  /* Product image, title and price */
  .add-to-cart-modal__product {
    margin-bottom: 8px !important;
  }

  /* Size selector section */
  .add-to-cart-modal__field[data-atc-size-field] {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
  }

  .add-to-cart-modal__field[data-atc-size-field]
  .add-to-cart-modal__label {
    margin-bottom: 4px !important;
  }

  /* Quantity section */
  .add-to-cart-modal__field:not([data-atc-size-field]) {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
  }

  .add-to-cart-modal__field:not([data-atc-size-field])
  .add-to-cart-modal__label {
    margin-bottom: 4px !important;
  }

  /* Error area and button spacing */
  .add-to-cart-modal__error {
    margin-top: 2px !important;
    margin-bottom: 4px !important;
  }

  .add-to-cart-modal__actions {
    margin-top: 0 !important;
    gap: 2px !important;
  }

  /* Details link */
  .add-to-cart-modal__details {
    margin-top: 0 !important;
    padding-top: 2px !important;
  }
}

/* Increase bottom padding in Add to Cart popup */
.add-to-cart-modal__field {
    padding-bottom: 4px !important;
}
