/*
 * Modern cart view with responsive, mobile-first layout and a desktop aside column.
 */

form.commerce-cart-form {
  --cart-bg: #ffffff;
  --cart-border: rgba(102, 126, 234, 0.15);
  --cart-shadow: 0 24px 60px rgba(102, 126, 234, 0.25);
  --cart-accent: #667eea;
  --cart-accent-dark: #5a67d8;
  --cart-soft: #f7f9fc;
  --cart-text: #2d3748;
  --cart-muted: #718096;
  --cart-purple-light: #764ba2;
  --cart-purple-dark: #6b46c1;

  padding: clamp(1.1rem, 1.5vw + 1rem, 2.6rem);
  background: var(--cart-bg);

  border: 1px solid var(--cart-border);
  box-shadow: var(--cart-shadow);
  color: var(--cart-text);
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

form.commerce-cart-form::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
  pointer-events: none;
  z-index: 0;
}

form.commerce-cart-form > * {
  position: relative;
  z-index: 1;
}

form.commerce-cart-form > .description,
form.commerce-cart-form > .view-header,
form.commerce-cart-form > .view-footer {
  margin-bottom: 1.25rem;
}

form.commerce-cart-form .view-content {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: clamp(320px, 62vh, 520px);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.05);
}

form.commerce-cart-form .view-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

form.commerce-cart-form .view-content::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 999px;
}

form.commerce-cart-form .view-content::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

table.cart-form-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  color: inherit;
}

table.cart-form-table thead th {
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cart-muted);
  padding: 0.85rem 1.1rem;
  text-align: center;
  background: transparent;
  border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

table.cart-form-table thead th:first-child,
table.cart-form-table tbody td:first-child {
  text-align: center;
}

table.cart-form-table tbody tr {
  background: #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

table.cart-form-table tbody tr:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 38px rgba(102, 126, 234, 0.2);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 100%);
}

table.cart-form-table tbody td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
  vertical-align: middle;
  font-size: 0.95rem;
}

table.cart-form-table tbody td:last-child {
  border-bottom: none;
}

table.cart-form-table tbody td[data-label]::before {
  display: none;
}

.cart-form-table .views-field-images {
  text-align: center;
}

.cart-form-table .views-field-images img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
}

.cart-form-table .views-field-title a {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--cart-text);
  text-decoration: none;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.cart-form-table .views-field-title a:hover {
  color: var(--cart-accent);
}

.cart-form-table .views-field-edit-quantity {
  text-align: center;
}

.cart-form-table .custom-number-input {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border-radius: 999px;
  border: 1px solid rgba(102, 126, 234, 0.25);
  overflow: hidden;
  min-width: 140px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.cart-form-table .custom-number-input button {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cart-accent);
  transition: background 0.2s ease, color 0.2s ease;
}

.cart-form-table .custom-number-input button:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--cart-accent-dark);
}

.cart-form-table .custom-number-input input {
  width: 64px;
  text-align: center;
  border: none;
  font-weight: 600;
  font-size: 0.96rem;
  background: transparent;
  color: inherit;
}

.cart-form-table .views-field-remove-button,
.cart-form-table .views-field-price__number,
.cart-form-table .views-field-total-price__number {
  text-align: center;
}

/* Delete button - override all other styles with high specificity */
/* Using background-image directly since ::before doesn't work on input elements */
.cart-form-table .views-field-remove-button .form-submit,
.cart-form-table .views-field-remove-button input.delete-order-item,
table.cart-form-table .views-field-remove-button .form-submit,
.table.cols-6 .views-field-remove-button input.delete-order-item,
form.commerce-cart-form .views-field-remove-button .form-submit {
  padding: 0 !important;
  border-radius: 12px !important;
  border: none !important;
  background-color: rgba(239, 68, 68, 0.1) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23ef4444'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z'/%3E%3C/svg%3E") !important;
  background-size: 20px 20px !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  color: transparent !important;
  font-size: 0 !important;
  width: 40px !important;
  height: 40px !important;
  min-width: unset !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer !important;
}

.cart-form-table .views-field-remove-button .form-submit:hover,
.cart-form-table .views-field-remove-button input.delete-order-item:hover,
table.cart-form-table .views-field-remove-button .form-submit:hover,
.table.cols-6 .views-field-remove-button input.delete-order-item:hover,
form.commerce-cart-form .views-field-remove-button .form-submit:hover {
  transform: translateY(-2px) scale(1.05);
  background-color: #ef4444 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z'/%3E%3C/svg%3E") !important;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35) !important;
}

.cart-form-table .views-field-remove-button .form-submit:active,
.cart-form-table .views-field-remove-button input.delete-order-item:active {
  transform: translateY(0) scale(0.98);
}

.cart-form-table .views-field-price__number,
.cart-form-table .views-field-total-price__number {
  font-weight: 600;
  font-size: 1rem;
}

.cart-form-table .views-field-total-price__number {
  color: var(--cart-accent-dark);
}

form.commerce-cart-form > div[data-drupal-selector="order-total-summary"] {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
  border-radius: 22px;
  padding: 1.6rem;
  box-shadow: 0 20px 38px rgba(102, 126, 234, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  color: white;
  position: relative;
  overflow: hidden;
}

/* Add subtle shine effect */
form.commerce-cart-form > div[data-drupal-selector="order-total-summary"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0%, 100% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
}

form.commerce-cart-form > div[data-drupal-selector="order-total-summary"] .total-price {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  position: relative;
  z-index: 1;
}

form.commerce-cart-form .order-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
}

form.commerce-cart-form .order-total-line:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

form.commerce-cart-form .order-total-line-label {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.9);
}

form.commerce-cart-form .order-total-line-value {
  font-size: 1.18rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

form.commerce-cart-form .order-total-line__total .order-total-line-value {
  font-size: 1.48rem;
  color: white;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Coupon redemption form styling */
#edit-coupon-redemption,
.commerce_coupon_redemption_form {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.08) 100%);
  border-radius: 22px;
  padding: 1.6rem;
  box-shadow: 0 18px 32px rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.2);
  text-align: center;
}

#edit-coupon-redemption .form-item,
.commerce_coupon_redemption_form .form-item {
  margin-bottom: 0;
  position: relative;
  display: flex;
  justify-content: center;
}

/* Hide label visually but keep it accessible */
#edit-coupon-redemption label,
.commerce_coupon_redemption_form label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#edit-coupon-redemption .form-text,
#edit-coupon-redemption .form-control,
.commerce_coupon_redemption_form .form-text,
.commerce_coupon_redemption_form .form-control {
  border-radius: 14px;
  border: 1px solid rgba(102, 126, 234, 0.3);
  padding: 0.85rem 1.2rem;
  font-weight: 500;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.9);
  width: 90%;
  max-width: 100%;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Placeholder styling to show grayed text */
#edit-coupon-redemption .form-text::placeholder,
#edit-coupon-redemption .form-control::placeholder,
.commerce_coupon_redemption_form .form-text::placeholder,
.commerce_coupon_redemption_form .form-control::placeholder {
  color: #a0aec0;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  font-weight: 500;
}

#edit-coupon-redemption .form-text:focus,
#edit-coupon-redemption .form-control:focus,
.commerce_coupon_redemption_form .form-text:focus,
.commerce_coupon_redemption_form .form-control:focus {
  border-color: var(--cart-accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
  outline: none;
}

#edit-coupon-redemption .form-submit,
.commerce_coupon_redemption_form .form-submit {
  margin: 1.2rem auto 0;
  padding: 0.9rem 2.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 16px 28px rgba(102, 126, 234, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: block;
  width: 85%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

#edit-coupon-redemption .form-submit::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

#edit-coupon-redemption .form-submit:hover::before,
.commerce_coupon_redemption_form .form-submit:hover::before {
  left: 100%;
}

#edit-coupon-redemption .form-submit:hover,
.commerce_coupon_redemption_form .form-submit:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-2px);
  box-shadow: 0 20px 32px rgba(102, 126, 234, 0.45);
}

form.commerce-cart-form .form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0;
}

form.commerce-cart-form .form-actions .button,
form.commerce-cart-form .form-actions .form-submit {
  padding: 0.9rem 2.4rem;
  border-radius: 18px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

form.commerce-cart-form .form-actions #edit-submit {
  display: none; /* Hide update cart button - using AJAX auto-update instead */
}

form.commerce-cart-form .form-actions #edit-checkout {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  box-shadow: 0 20px 36px rgba(102, 126, 234, 0.35);
  position: relative;
  overflow: hidden;
}

form.commerce-cart-form .form-actions #edit-checkout::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

form.commerce-cart-form .form-actions #edit-checkout:hover::before {
  left: 100%;
}

form.commerce-cart-form .form-actions #edit-checkout:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-2px);
  box-shadow: 0 24px 40px rgba(102, 126, 234, 0.45);
}

@media (max-width: 900px) {
  form.commerce-cart-form {
    margin: clamp(1.2rem, 2vw, 2.25rem) auto;
    padding: 1.2rem;
  }

  form.commerce-cart-form .view-content {
    max-height: clamp(300px, 65vh, 500px);
  }

  table.cart-form-table {
    min-width: 640px;
  }
}

@media (min-width: 901px) {
  form.commerce-cart-form {
    display: grid;
    grid-template-columns: 1fr 380px;
    column-gap: 2.5rem;
    align-items: start;
    grid-auto-flow: dense;
  }

  /* Table takes full height of left column */
  form.commerce-cart-form > table.cart-form-table {
    grid-column: 1;
    grid-row: 1 / span 10;
    position: relative;
  }

  /* Beautiful gradient divider on left side of table */
  form.commerce-cart-form > table.cart-form-table::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -1.25rem;
    width: 3px;
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(102, 126, 234, 0.1) 5%,
      rgba(102, 126, 234, 0.6) 20%,
      rgba(118, 75, 162, 0.8) 50%,
      rgba(102, 126, 234, 0.6) 80%,
      rgba(102, 126, 234, 0.1) 95%,
      transparent 100%
    );
    border-radius: 2px;
    box-shadow: 
      0 0 15px rgba(102, 126, 234, 0.3),
      0 0 30px rgba(118, 75, 162, 0.2);
    z-index: 10;
    pointer-events: none;
  }

  /* Beautiful gradient divider between columns - attached to table's right edge */
  form.commerce-cart-form > table.cart-form-table::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: -1.25rem;
    width: 3px;
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(102, 126, 234, 0.1) 5%,
      rgba(102, 126, 234, 0.6) 20%,
      rgba(118, 75, 162, 0.8) 50%,
      rgba(102, 126, 234, 0.6) 80%,
      rgba(102, 126, 234, 0.1) 95%,
      transparent 100%
    );
    border-radius: 2px;
    box-shadow: 
      0 0 15px rgba(102, 126, 234, 0.3),
      0 0 30px rgba(118, 75, 162, 0.2);
    z-index: 10;
    pointer-events: none;
  }

  /* Sidebar items stack in right column, starting from row 1 */
  form.commerce-cart-form > div[data-drupal-selector="order-total-summary"] {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  form.commerce-cart-form > div[data-drupal-selector="edit-coupon-redemption"],
  form.commerce-cart-form > #edit-coupon-redemption {
    grid-column: 2;
    grid-row: 2;
    margin-top: 1.5rem;
  }

  form.commerce-cart-form > div[data-drupal-selector="edit-actions"],
  form.commerce-cart-form > #edit-actions {
    grid-column: 2;
    grid-row: 3;
    margin-top: 1.5rem;
  }

  /* Hidden fields don't affect layout */
  form.commerce-cart-form > input[type="hidden"] {
    grid-column: 1 / -1;
    height: 0;
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 720px) {
  /* Make parent wrapper full width on mobile */
  .view-commerce-cart-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Make form full width on mobile */
  form.commerce-cart-form {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1rem !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }
  
  /* Override global .view-content width constraint */
  form.commerce-cart-form .view-content,
  .view-commerce-cart-form .view-content {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  form.commerce-cart-form > div[data-drupal-selector="order-total-summary"],
  form.commerce-cart-form > #edit-coupon-redemption,
  form.commerce-cart-form > #edit-actions {
    width: 100%;
  }
  
  /* Mobile card layout - convert table to stacked cards */
  table.cart-form-table {
    min-width: unset;
    width: 100%;
    display: block;
  }
  
  table.cart-form-table thead {
    display: none; /* Hide table headers on mobile */
  }
  
  table.cart-form-table tbody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  table.cart-form-table tbody tr {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.5rem 1rem;
    padding: 1rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
  }
  
  table.cart-form-table tbody tr:hover {
    transform: none;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.18);
  }
  
  table.cart-form-table tbody td {
    padding: 0;
    border: none;
    display: block;
  }
  
  /* Image - spans 2 rows on the left */
  table.cart-form-table tbody td.views-field-images {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cart-form-table .views-field-images img {
    width: 70px;
    height: 70px;
    border-radius: 12px;
  }
  
  /* Title - top right */
  table.cart-form-table tbody td.views-field-title {
    grid-column: 2;
    grid-row: 1;
    text-align: right !important;
    direction: rtl !important;
    padding-left: 30px; /* Space for delete button */
  }
  
  .cart-form-table .views-field-title a {
    font-size: 0.9rem;
    line-height: 1.3;
    display: block;
  }
  
  /* Price info row - below title */
  table.cart-form-table tbody td.views-field-price__number,
  table.cart-form-table tbody td.views-field-total-price__number {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
    font-size: 0.85rem;
  }
  
  /* Hide unit price on mobile, show only total */
  table.cart-form-table tbody td.views-field-price__number {
    display: none;
  }
  
  table.cart-form-table tbody td.views-field-total-price__number {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cart-accent-dark);
  }
  
  table.cart-form-table tbody td.views-field-total-price__number::before {
    content: attr(data-label) ": ";
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cart-muted);
    margin-left: 0.3rem;
  }
  
  /* Quantity - bottom spanning full width */
  table.cart-form-table tbody td.views-field-edit-quantity {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    justify-content: center;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px dashed rgba(102, 126, 234, 0.15);
  }
  
  .cart-form-table .custom-number-input {
    min-width: 130px;
  }
  
  .cart-form-table .custom-number-input button {
    width: 36px;
    height: 36px;
  }
  
  .cart-form-table .custom-number-input input {
    width: 50px;
    font-size: 0.9rem;
  }
  
  /* Delete button - positioned absolute top right */
  table.cart-form-table tbody td.views-field-remove-button {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    grid-column: unset;
    grid-row: unset;
  }
  
  .cart-form-table .views-field-remove-button .form-submit,
  .cart-form-table .views-field-remove-button input.delete-order-item,
  .table.cols-6 .views-field-remove-button input.delete-order-item,
  form.commerce-cart-form .views-field-remove-button .form-submit {
    padding: 0 !important;
    font-size: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: unset !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23ef4444'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z'/%3E%3C/svg%3E") !important;
    background-size: 16px 16px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    color: transparent !important;
    border-radius: 10px !important;
    border: none !important;
  }
  
  .cart-form-table .views-field-remove-button .form-submit:hover,
  .cart-form-table .views-field-remove-button input.delete-order-item:hover,
  .table.cols-6 .views-field-remove-button input.delete-order-item:hover,
  form.commerce-cart-form .views-field-remove-button .form-submit:hover {
    background-color: #ef4444 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z'/%3E%3C/svg%3E") !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35) !important;
  }
  
  /* Order summary adjustments */
  form.commerce-cart-form > div[data-drupal-selector="order-total-summary"] {
    border-radius: 16px;
    padding: 1.2rem;
  }
  
  form.commerce-cart-form .order-total-line-label {
    font-size: 0.8rem;
  }
  
  form.commerce-cart-form .order-total-line-value {
    font-size: 1.1rem;
  }
  
  form.commerce-cart-form .order-total-line__total .order-total-line-value {
    font-size: 1.3rem;
  }
  
  /* Actions buttons */
  form.commerce-cart-form .form-actions {
    gap: 0.6rem;
  }
  
  form.commerce-cart-form .form-actions .button,
  form.commerce-cart-form .form-actions .form-submit {
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 14px;
  }
}

@media (max-width: 520px) {
  .view-commerce-cart-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  form.commerce-cart-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.75rem !important;
    gap: 1.25rem;
  }

  form.commerce-cart-form .view-content {
    max-height: none;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  
  table.cart-form-table tbody tr {
    grid-template-columns: 65px 1fr;
    padding: 0.85rem;
    border-radius: 14px;
  }
  
  .cart-form-table .views-field-images img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
  }
  
  .cart-form-table .views-field-title a {
    font-size: 0.85rem;
  }
  
  table.cart-form-table tbody td.views-field-total-price__number {
    font-size: 0.95rem;
  }
  
  .cart-form-table .custom-number-input {
    min-width: 115px;
  }
  
  .cart-form-table .custom-number-input button {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  .cart-form-table .custom-number-input input {
    width: 45px;
    font-size: 0.85rem;
  }
  
  /* Order summary */
  form.commerce-cart-form > div[data-drupal-selector="order-total-summary"] {
    padding: 1rem;
    border-radius: 14px;
  }
  
  form.commerce-cart-form .order-total-line {
    padding-bottom: 0.5rem;
  }
  
  form.commerce-cart-form .order-total-line-label {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
  }
  
  form.commerce-cart-form .order-total-line-value {
    font-size: 1rem;
  }
  
  form.commerce-cart-form .order-total-line__total .order-total-line-value {
    font-size: 1.2rem;
  }
  
  /* Actions */
  form.commerce-cart-form .form-actions .button,
  form.commerce-cart-form .form-actions .form-submit {
    padding: 0.75rem 1.2rem;
    font-size: 0.85rem;
    border-radius: 12px;
  }
}

@media (max-width: 380px) {
  .view-commerce-cart-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  
  form.commerce-cart-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.5rem !important;
  }
  
  table.cart-form-table tbody tr {
    grid-template-columns: 55px 1fr;
    gap: 0.4rem 0.75rem;
    padding: 0.75rem;
  }
  
  .cart-form-table .views-field-images img {
    width: 50px;
    height: 50px;
  }
  
  .cart-form-table .views-field-title a {
    font-size: 0.8rem;
  }
  
  table.cart-form-table tbody td.views-field-total-price__number {
    font-size: 0.9rem;
  }
  
  .cart-form-table .custom-number-input {
    min-width: 105px;
  }
  
  .cart-form-table .custom-number-input button {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
  
  .cart-form-table .custom-number-input input {
    width: 40px;
    font-size: 0.8rem;
  }
  
  /* Delete button smaller */
  .cart-form-table .views-field-remove-button .form-submit,
  .cart-form-table .views-field-remove-button input.delete-order-item,
  .table.cols-6 .views-field-remove-button input.delete-order-item {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    background-size: 14px 14px !important;
  }
}

/* Hide shipping adjustments from cart page */
.order-total-line__adjustment--shipping,
.order-total-line__adjustment[class*="shipping"] {
  display: none !important;
}

/* Hide coupon redemption form from cart page */
#edit-coupon-redemption,
.commerce_coupon_redemption_form,
form.commerce-cart-form > div[data-drupal-selector="edit-coupon-redemption"] {
  display: none !important;
}

/* Hide original checkout button - replaced by quick checkout modal trigger */
form.commerce-cart-form #edit-checkout,
form.commerce-cart-form input[data-drupal-selector="edit-checkout"] {
  display: none !important;
}

/* Loading states for AJAX updates */
.cart-form-table tr.cart-updating {
  opacity: 0.6;
  position: relative;
}

.cart-form-table tr.cart-removing {
  opacity: 0.3;
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

form.commerce-cart-form.cart-ajax-loading {
  pointer-events: none;
}

/* Loading overlay for order summary */
.cart-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(102, 126, 234, 0.1);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 22px;
}

/* Spinning loader */
.cart-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: cart-spin 0.8s linear infinite;
}

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

