/* ===== Modernized Checkout Page Styles with Animations & Better Responsiveness =====
   Enhanced version with smooth animations, improved mobile responsiveness, and premium visual design
*/

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

:root{
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --muted: #6b7280;
    --text: #111827;
    --accent: #2e7d32;          /* pine green */
    --accent-2: #43a047;
    --accent-light: rgba(46, 125, 50, 0.08);
    --danger: #dc2626;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --gap: 20px;
    --max-width: 1200px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  * { box-sizing: border-box; }
  html,body { height: 100%; }
  body {
    margin: 0;
    font-family: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    line-height: 1.6;
  }
  
  /* ---------------------------
     Checkout container layout
     --------------------------- */
  .checkout-container {
  max-width: var(--max-width);
  margin: 32px auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: start;
  animation: slideInDown 0.5s ease-out;
}
  
  /* On small screens stack */
  @media (max-width: 1024px) {
  .checkout-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    margin: 24px auto;
  }
}
  
  @media (max-width: 768px) {
  .checkout-container {
    padding: 16px;
    margin: 16px auto;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .checkout-container {
    padding: 12px;
    margin: 12px auto;
  }
}
  
  /* ---------------------------
     Card (section) base style
     --------------------------- */
  .card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  animation: slideUp 0.6s ease-out;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}
  
  /* header inside card */
  .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  animation-delay: 0.1s;
}
  .card-head .title {
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
  .card .link-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-size: 14px;
}

.card .link-btn:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

.card .link-btn:active {
  transform: translateY(0);
}
  
  /* ---------- Address card ---------- */
  .address-card .address-content {
  display: block;
  padding: 12px 0;
  color: var(--muted);
}
  .name-phone {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  transition: var(--transition);
}
  .full-address {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.6;
}
  
  /* ---------- Products card / table ---------- */
  .products-card {
  padding: 16px;
}

.products-card .card-head {
  margin-bottom: 12px;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  table-layout: auto;
}

.products-table thead th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  padding: 14px 12px;
  border-bottom: 2px solid rgba(46, 125, 50, 0.1);
  background: var(--accent-light);
}

.products-table tbody td {
  padding: 16px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: middle;
  transition: var(--transition);
}

.products-table tbody tr {
  transition: var(--transition);
}

.products-table tbody tr:hover {
  background: var(--accent-light);
}

.products-table tbody tr:last-child td {
  border-bottom: none;
}

.products-table .right {
  text-align: right;
  font-weight: 700;
  color: var(--accent);
}

.products-table td:first-child {
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 768px) {
  .products-table thead {
    display: none;
  }

  .products-table,
  .products-table tbody,
  .products-table tr,
  .products-table td {
    display: block;
    width: 100%;
  }

  .products-table tr {
    margin-bottom: 12px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .products-table td {
    padding: 8px 0;
    border: none;
  }

  .products-table td:nth-child(1) {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    display: block;
  }

  .products-table td:not(:first-child) {
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
  }

  .products-table td.right {
    font-weight: 800;
    color: var(--accent);
  }

  .products-table td:before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    display: none;
  }
}
  
  /* ---------- Shipping card ---------- */
  .shipping-card .ship-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.shipping-card .ship-line:hover {
  background: rgba(46, 125, 50, 0.12);
}
  .ship-meta {
  color: var(--muted);
  font-size: 14px;
}
  .ship-price {
  color: var(--accent);
  font-weight: 800;
  font-size: 16px;
}
  
  /* shipping dropdown placeholder */
  #shipChooser {
  margin-top: 12px;
}
  
  /* ---------- Payment card ---------- */
  .pay-card .pay-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.pay-card .pay-line:hover {
  background: rgba(46, 125, 50, 0.12);
}
  .pay-meta {
  color: var(--muted);
  font-size: 14px;
}
  
  /* ---------- Totals / Sidebar ---------- */
  .total-card {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  align-self: start;
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fffe 100%);
  border: 1px solid rgba(46, 125, 50, 0.1);
  animation-delay: 0.2s;
}

@media (max-width: 1024px) {
  .total-card {
    position: static;
    background: var(--card-bg);
  }
}

.totals {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  color: var(--muted);
  font-size: 15px;
  transition: var(--transition);
}

.totals > div:hover {
  color: var(--text);
}

.totals .grand {
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
  border-top: 2px solid rgba(46, 125, 50, 0.1);
  padding-top: 12px;
  margin-top: 8px;
}

.totals .grand strong {
  color: var(--accent);
  margin-left: 8px;
}
  
  /* ---------- Place Order Button (enhanced) ---------- */
  .place-order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border: none;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(46, 125, 50, 0.2);
  transition: var(--transition);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.place-order-btn:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transition: left 0.3s ease;
}

.place-order-btn:hover:before {
  left: 100%;
}

.place-order-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.place-order-btn:active {
  transform: translateY(-1px);
}

.place-order-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  background: #9aa4a0;
}
  
  /* Small helper text under totals (if needed) */
  #checkoutError {
  color: var(--danger);
  font-size: 14px;
  margin-top: 12px;
  display: none;
  padding: 10px 12px;
  background: rgba(220, 38, 38, 0.1);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--danger);
}
  
  /* ---------------------------
     Modals — central styling
     --------------------------- */
  .modal {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  position: relative;
  z-index: 1201;
  width: 760px;
  max-width: calc(100% - 40px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 0;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 640px) {
  .modal-card {
    width: 95vw;
    max-height: 90vh;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-header .modal-title {
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--bg);
}

.btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn.ghost:hover {
  background: var(--bg);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 16px rgba(46, 125, 50, 0.15);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(46, 125, 50, 0.25);
}

.btn.cancel {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn.cancel:hover {
  background: var(--bg);
}

.btn.confirm {
  background: var(--accent);
  color: #fff;
}

.icon-btn,
.close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 10px;
  color: var(--muted);
  border-radius: var(--radius-md);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.icon-btn:hover,
.close-btn:hover {
  background: var(--bg);
  color: var(--text);
}
  
  /* ---------------------------
     Address form (newAddressModal)
     --------------------------- */
  .enhanced-address-modal {
  width: 900px;
  max-width: calc(100% - 40px);
  padding: 0;
  border-radius: var(--radius-lg);
}

.form-section {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px solid rgba(46, 125, 50, 0.1);
  animation: slideUp 0.5s ease-out;
}

.form-section h4 {
  margin: 0 0 14px 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.addr-row {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.addr-row label {
  flex: 1 1 220px;
  display: block;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.addr-row label.wide {
  flex: 1 1 100%;
}

.addr-row input,
.addr-row select,
.addr-row textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.addr-row input:focus,
.addr-row select:focus,
.addr-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: #fff;
}

.addr-row textarea {
  min-height: 90px;
  resize: vertical;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
}

#addrMap {
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}
  
  /* ---------------------------
     Payment & shipping option lists
     --------------------------- */
  .ship-list .ship-option,
.pay-list .payment-option,
.addr-list .address-item {
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.ship-list .ship-option:hover,
.pay-list .payment-option:hover,
.addr-list .address-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.ship-list .ship-option.selected,
.pay-list .payment-option.selected,
.addr-list .address-item.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(46, 125, 50, 0.1);
}
  .payment-icon,
.add-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: var(--radius-md);
  background: var(--bg);
  flex-shrink: 0;
}
  
  /* Payment option inner */
  .payment-info .payment-name {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
  .payment-info .payment-desc {
  font-size: 14px;
  color: var(--muted);
}
  
  /* add new address CTA in modal */
  .add-new-addr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(46, 125, 50, 0.3);
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-light);
  transition: var(--transition);
}

.add-new-addr:hover {
  border-color: var(--accent);
  background: rgba(46, 125, 50, 0.12);
}
  
  .place-order-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
 
  .hidden { display:none !important; }
  .right { text-align:right; }
  .center { text-align:center; }
  .small { font-size:13px; color:var(--muted); }
  
  /* disabled / out of stock states */
  .out-of-stock {
  opacity: 0.6;
  pointer-events: none;
}
  .stock-warning {
  color: var(--danger);
  font-size: 13px;
}
  
  /* minor responsive tweaks */
  @media (max-width: 480px) {
  .addr-row {
    gap: 8px;
  }

  .place-order-btn {
    padding: 14px 16px;
    font-size: 15px;
  }

  .modal-card {
    padding: 12px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 14px;
  }
}
