/* Modern Checkout Page Styles */
/* Optimized horizontal layout matching reference design */

/* Reset and Base */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ensure mobile can scroll properly */
@media (max-width: 968px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: auto;
  }
}

/* Header */
.checkout-header {
  background: white;
  border-bottom: 1px solid #e9ecef;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.checkout-header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1rem 2rem;
}

.back-to-store {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6c757d;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s ease;
  justify-self: start;
}

.back-to-store:hover {
  color: var(--yellow) !important;
  text-decoration: none !important;
}

.back-to-store svg {
  width: 16px;
  height: 16px;
}

.checkout-logo-center {
  justify-self: center;
}

.checkout-logo-center img {
  height: 120px;
  width: auto;
}

.checkout-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0.5rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6c757d;
  font-weight: 500;
}

.step.active,
.step.current {
  color: #FDB81B;
  font-weight: 600;
}

.step:not(.completed):not(.active):not(.current) {
  color: #6c757d;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FDB81B;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Grey circle for future steps */
.step:last-child .step-number {
  background: #6c757d;
  color: #fff;
}

.step-separator {
  width: 40px;
  height: 2px;
  background: #FDB81B;
  border: none;
  margin: 0;
  border-radius: 1px;
}

/* Grey line before payment step */
.step-separator:last-of-type {
  background: #6c757d;
}

/* Hide the text content since we're using background */
.step-separator {
  font-size: 0;
  overflow: hidden;
  text-indent: -9999px;
}

/* Main Content - Optimized for No Scrolling */
.checkout-main {
  padding: 1.5rem 0;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.checkout-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  align-items: start;
  height: calc(100vh - 120px);
}

/* Form Section - Optimized Layout */
.checkout-form-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  height: 100%;
  overflow-y: auto;
  
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #dee2e6 transparent;
}

.checkout-form-section::-webkit-scrollbar {
  width: 6px;
}

.checkout-form-section::-webkit-scrollbar-track {
  background: transparent;
}

.checkout-form-section::-webkit-scrollbar-thumb {
  background-color: #dee2e6;
  border-radius: 3px;
}

#checkout-form {
  display: grid;
  gap: 1.25rem;
}

.form-section {
  margin-bottom: 0;
}

.form-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #212529;
  margin: 0 0 1rem 0;
  border-bottom: 1px solid #f1f3f4;
  padding-bottom: 0.5rem;
}

/* Compact Form Groups */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.form-group label small {
  font-weight: 400;
  color: #6c757d;
  font-size: 0.75rem;
  display: block;
  margin-top: 0.2rem;
}

.field-description {
  font-weight: 400;
  color: #6c757d;
  font-size: 0.75rem;
  display: block;
  margin-bottom: 0.4rem;
  margin-top: -0.2rem;
}

.form-group input,
.form-group select {
  width: 100%;
  max-width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: white;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #FDB81B;
  box-shadow: 0 0 0 2px rgba(253, 184, 27, 0.1);
}

.form-group input::placeholder {
  color: #8c959f;
  font-size: 0.85rem;
}

/* Horizontal Layout for Address Fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row.triple {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Hidden payment method field */
input[type="hidden"] {
  display: none;
}

/* Payment Icons for Mobile */
.payment-icons-mobile {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f3f4;
}

.payment-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.payment-icons img {
  height: 20px;
  border-radius: 3px;
}

.payment-methods-image {
  height: 40px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.net-banking {
  background: #f8f9fa;
  color: #495057;
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid #dee2e6;
}

.secure-payment-mobile {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #28a745;
  font-weight: 500;
}

/* Order Summary - Pinned to Top */
.checkout-summary-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  height: fit-content;
  max-height: 100%;
  align-self: start;
}

.checkout-summary-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #212529;
  margin: 0 0 1rem 0;
  border-bottom: 1px solid #f1f3f4;
  padding-bottom: 0.5rem;
}

.checkout-items {
  margin-bottom: 1rem;
}

.checkout-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f8f9fa;
}

.checkout-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.checkout-item-image img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

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

.checkout-item-name {
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  line-height: 1.3;
}

.checkout-item-price {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.checkout-item-current {
  font-weight: 600;
  color: #212529;
  font-size: 0.9rem;
}

.checkout-item-original {
  font-size: 0.8rem;
  color: #6c757d;
  text-decoration: line-through;
}

.checkout-item-quantity {
  font-size: 0.75rem;
  color: #6c757d;
}

.checkout-totals {
  border-top: 1px solid #f1f3f4;
  padding-top: 0.75rem;
  margin-bottom: 1.5rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.total-row:last-child {
  margin-bottom: 0;
}

.total-main {
  font-weight: 600;
  font-size: 1rem;
  color: #212529;
  padding-top: 0.5rem;
  border-top: 1px solid #f1f3f4;
}

.shipping-free {
  color: #28a745;
  font-weight: 500;
  font-size: 0.85rem;
}

/* Continue Button - Brand Yellow */
.checkout-complete-btn {
  width: 100%;
  background: #FDB81B;
  color: #000;
  border: none;
  padding: 0.9rem 1.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(253, 184, 27, 0.2);
}

.checkout-complete-btn:hover {
  background: #f4af02;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(253, 184, 27, 0.3);
}

.checkout-complete-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Fixed Trust Badges - Split Position */
.trust-badges-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e9ecef;
  padding: 0.75rem 2rem;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.payment-icons-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.payment-icons-left img {
  height: 18px;
  border-radius: 3px;
}

.payment-icons-left .net-banking {
  font-size: 0.65rem;
  padding: 0.3rem 0.5rem;
}

.secure-payment-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #28a745;
  font-weight: 500;
}

.secure-payment-right svg {
  width: 18px;
  height: 18px;
}

/* Hide mobile payment icons on desktop */
  .payment-icons-mobile {
    display: none;
  }
  
  .payment-methods-image {
    height: 36px;
  }

/* Mobile Sticky Footer */
.mobile-checkout-footer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e9ecef;
  padding: 1.25rem 1rem;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  min-height: 80px;
}

.mobile-footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.mobile-price-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.mobile-total-label {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 500;
}

.mobile-total-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: #212529;
}

.mobile-complete-btn {
  background: #FDB81B;
  color: #000;
  border: none;
  padding: 0.9rem 2rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(253, 184, 27, 0.2);
  flex-shrink: 0;
}

.mobile-complete-btn:hover {
  background: #f4af02;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(253, 184, 27, 0.3);
}

.mobile-complete-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Red asterisks for required fields */
label:contains('*') {
  color: inherit;
}

label::after {
  content: '';
}

/* Target asterisks specifically */
.form-group label {
  position: relative;
}

.form-group label[for$="name"]::after,
.form-group label[for="email"]::after,
.form-group label[for="phone"]::after,
.form-group label[for="address-line1"]::after,
.form-group label[for="city"]::after,
.form-group label[for="state"]::after,
.form-group label[for="postal-code"]::after {
  content: ' *';
  color: #dc3545;
  font-weight: bold;
}

/* Remove asterisks from the HTML text and add via CSS */
.form-group label {
  white-space: nowrap;
}

/* Error States */
.form-group input.error,
.form-group select.error {
  border-color: #dc3545;
}

.field-error {
  color: #dc3545;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.form-error {
  background: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  border: 1px solid #f5c6cb;
}

/* Loading Animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .checkout-container {
    max-width: 1100px;
    gap: 2rem;
  }
  
  .checkout-header-container {
    max-width: 1100px;
    padding: 0 1.5rem;
  }
  
  .trust-badges-fixed {
    padding: 0.75rem 1.5rem;
  }
}

@media (max-width: 968px) {
  .checkout-main {
    max-height: none;
    overflow: visible;
  }
  
  .checkout-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
    height: auto;
    min-height: calc(100vh - 140px);
  }
  
  .checkout-form-section {
    height: auto;
    overflow-y: visible;
    padding-bottom: 140px; /* Increased space for sticky footer */
    min-height: calc(100vh - 160px); /* Ensure content fills screen */
  }
  
  .checkout-summary-section {
    display: none;
  }
  
  /* Show mobile sticky footer */
  .mobile-checkout-footer {
    display: block;
  }
  
  /* Hide desktop CTA button on mobile */
  .checkout-complete-btn {
    display: none;
  }
  
  .checkout-header-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.75rem;
    padding: 0 1rem;
    justify-items: center;
  }
  
  .back-to-store {
    justify-self: start;
    grid-row: 1;
  }
  
  .checkout-logo-center {
    grid-row: 2;
    justify-self: center;
  }
  
  .checkout-steps {
    font-size: 0.75rem;
    gap: 0.4rem;
    grid-column: 1;
    grid-row: 3;
    justify-content: center;
    margin-top: 0.25rem;
  }
  
  .step-number {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }
  
  .step-separator {
    width: 30px;
    height: 2px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-row.triple {
    grid-template-columns: 1fr;
  }
  
  /* Show mobile payment icons */
  .payment-icons-mobile {
    display: block;
  }
  
  /* Hide desktop trust badges */
  .trust-badges-fixed {
    display: none;
  }
}

@media (max-width: 480px) {
  .checkout-header-container {
    padding: 0 0.5rem;
    gap: 0.5rem;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
  }
  
  .back-to-store {
    justify-self: start;
    grid-row: 1;
  }
  
  .checkout-logo-center {
    grid-row: 2;
    justify-self: center;
  }
  
  .checkout-container {
    padding: 0 0.5rem;
  }
  
  .checkout-form-section,
  .checkout-summary-section {
    padding: 0.75rem 0.5rem 1rem 0.5rem; /* Reduced horizontal padding to prevent overflow */
  }
  
  .checkout-form-section {
    padding-bottom: 160px; /* Extra space for mobile footer on small screens */
  }
  
  .form-section h2 {
    font-size: 1rem;
  }
  
  .checkout-logo-center img {
    height: 80px;
  }
  
  .payment-methods-image {
    height: 32px;
  }
  
  .checkout-steps {
    font-size: 0.65rem;
    gap: 0.3rem;
    grid-column: 1;
    grid-row: 3;
    justify-content: center;
    margin-top: 0.25rem;
  }
  
  .step-number {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
  
  .step-separator {
    width: 25px;
    height: 2px;
  }
  
  .back-to-store {
    font-size: 0.8rem;
  }
  
  /* Ensure form inputs don't overflow on small screens */
  .form-group input,
  .form-group select {
    padding: 0.5rem 0.6rem; /* Reduced padding for small screens */
    font-size: 0.85rem;
    min-width: 0; /* Allow inputs to shrink */
  }
  
  .form-group {
    margin-bottom: 0.8rem; /* Reduced margin */
  }
  
  /* Prevent any horizontal overflow on small screens */
  .checkout-main,
  .checkout-container,
  .checkout-form-section,
  .form-section {
    overflow-x: hidden;
    max-width: 100%;
  }
  
  /* Adjust label small text for mobile */
  .form-group label small {
    font-size: 0.7rem;
    line-height: 1.3;
  }
  
  .field-description {
    font-size: 0.7rem;
    line-height: 1.3;
  }
}

/* Ensure no scrolling on desktop */
@media (min-width: 969px) {
  body {
    overflow: hidden;
  }
  
  .checkout-main {
    height: calc(100vh - 140px);
  }
}

/* Checkout-specific coupon styles */
.checkout-coupon-section {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.checkout-coupon-section .coupon-input {
  border: 1px solid #dee2e6;
  background: #fff;
}

.checkout-coupon-section .coupon-input:focus {
  border-color: var(--yellow, #fdb81b);
  box-shadow: 0 0 0 3px rgba(253, 184, 27, 0.1);
}