* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Global Input Reset */
input,
select,
textarea,
button {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1a1f36;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: #f5f7fa;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-x: hidden;
}

.checkout-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 1200px;
  gap: 24px;
  margin: 0 auto;
  align-items: start;
  transition: transform 0.3s ease;
  transform-origin: center top;
}

/* Left Side: Order Summary */
.order-summary {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  min-width: 0;
}

.summary-content {
  padding: 48px 40px 20px 40px;
}

.summary-title {
  font-size: 22px;
  font-weight: 600;
  color: #1a1f36;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

.order-items {
  margin-bottom: 24px;
}

.order-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #e3e8ee;
}

.order-item:first-child {
  padding-top: 0;
}

.order-item:last-child {
  border-bottom: none;
  padding-bottom: 20px;
}

.item-image {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #f6f9fc 0%, #e3e8ee 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e3e8ee;
}

.item-image svg {
  width: 24px;
  height: 24px;
}

.item-details {
  flex: 1;
}

.item-name {
  font-size: 15px;
  font-weight: 400;
  color: #1a1f36;
  margin-bottom: 6px;
}

.item-qty {
  font-size: 14px;
  color: #6b7c93;
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-price {
  font-size: 15px;
  font-weight: 500;
  color: #1a1f36;
  flex-shrink: 0;
  margin-left: auto;
}

.order-totals {
  padding-top: 4px;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 15px;
  color: #1a1f36;
  padding: 16px 0;
  border-top: 1px solid #e3e8ee;
}

.total-row span:last-child {
  font-weight: 500;
  color: #1a1f36;
}

.shipping-row {
  flex-direction: row;
  justify-content: space-between;
}

.shipping-row span:last-child {
  font-weight: 400;
  color: #6b7c93;
}

.shipping-details {
  font-size: 13px;
  color: #8898aa;
  margin-top: 4px;
}

.total-due {
  padding: 20px 0 8px 0;
  border-top: 1px solid #e3e8ee;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
  color: #1a1f36;
}

.total-due span {
  font-weight: 600;
}

/* Right Side: Payment Form */
.payment-form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  padding: 48px 40px;
  min-width: 0;
}

.form-content {
  width: 100%;
}

/* Stripe Logo */
.stripe-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  padding: 20px 0;
}

.stripe-logo {
  width: 140px;
  max-width: 100%;
  height: auto;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.stripe-logo:hover {
  opacity: 1;
  transform: scale(1.02);
}

/* Divider */
.divider {
  width: 100%;
  height: 1px;
  background: #e6ebf1;
  margin: 24px 0;
}

/* Form Sections */
.form-section {
  margin-bottom: 32px;
}

.form-section:last-of-type {
  margin-bottom: 24px;
}

.form-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a1f36;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.form-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: #1a1f36;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.form-group {
  margin-bottom: 16px;
  padding: 0;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #6b7c93;
  margin-bottom: 6px;
  line-height: 1.4;
  padding: 0;
}

.input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  min-height: 44px;
  height: 44px;
}

.input-wrapper:focus-within {
  z-index: 10;
}

/* Universal Input Style */
.form-input,
input[type="text"],
input[type="email"],
.custom-select {
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: #32325d;
  background: #ffffff;
  border: 1px solid #e6ebf1;
  border-radius: 6px;
  outline: none;
  transition: all 0.15s ease;
  appearance: none;
  line-height: 42px;
  box-sizing: border-box;
  vertical-align: middle;
  display: block;
  margin: 0;
}

.form-input::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder {
  color: #a8b4c5;
  line-height: 42px;
}

.form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 1px #667eea, 0 0 0 4px rgba(102, 126, 234, 0.15);
  position: relative;
  z-index: 10;
}

/* Input Groups */
.input-group {
  position: relative;
  padding: 0;
  margin: 0;
}

.input-group-top {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}

.input-group-middle {
  border-radius: 0;
  margin-top: -1px;
  z-index: 1;
  position: relative;
  margin-bottom: 0;
}

.input-group-middle .input-wrapper {
  min-height: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
}

.input-group .form-input:focus {
  z-index: 10;
}

/* Address Split (City, State, ZIP) */
.address-split {
  display: flex;
  gap: 0;
  margin-top: -1px;
  margin-bottom: 0;
  min-height: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
}

.address-split .form-input {
  border-radius: 0;
  border-right: none;
  margin: 0;
  height: 44px;
  min-height: 44px;
  line-height: 42px;
}

.address-split .form-input:first-child {
  border-bottom-left-radius: 6px;
  flex: 2;
}

.address-split .form-input:nth-child(2) {
  flex: 2;
}

.address-split .form-input:last-child {
  border-bottom-right-radius: 6px;
  border-right: 1px solid #e6ebf1;
  flex: 1;
}

.address-split .form-input:focus {
  z-index: 10;
  position: relative;
}

/* Input Split (Expiry/CVC) */
.input-split {
  display: flex;
  margin-top: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: visible;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              margin-top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-split.visible {
  height: 44px;
  margin-top: -1px;
  opacity: 1;
  pointer-events: all;
}

.input-split-left {
  flex: 1;
}

.input-split-left .form-input {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-split-right {
  flex: 1;
}

.input-split-right .form-input {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 0;
  padding-right: 40px;
}

.input-split .form-input:focus {
  z-index: 10;
  position: relative;
}

/* Icons */
.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icons {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.card-icon {
  height: 28px;
  width: auto;
  max-width: 50px;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: block;
}

.card-icon.visible {
  opacity: 1;
}


/* Custom Select Dropdown */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper.input-group-middle {
  position: relative;
}

/* Custom Select Specific Styles */
.custom-select {
  cursor: pointer;
  user-select: none;
  padding-right: 36px;
  display: flex;
  align-items: center;
  height: 44px;
  min-height: 44px;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  height: 44px;
  min-height: 44px;
  width: 100%;
  line-height: 42px;
}

.custom-select-trigger span {
  flex: 1;
  text-align: left;
  line-height: 42px;
  display: block;
}

.custom-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #667eea;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  z-index: 9999;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.custom-select.open .custom-options {
  max-height: 220px;
  opacity: 1;
  visibility: visible;
}

.custom-select.open {
  border-color: #667eea;
  box-shadow: 0 0 0 1px #667eea, 0 0 0 4px rgba(102, 126, 234, 0.15);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  position: relative;
  z-index: 9999;
}

.input-wrapper.input-group-middle.dropdown-open {
  z-index: 10000;
}

.options-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}

.custom-option {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 15px;
  color: #32325d;
}

.custom-option:hover {
  background: #f6f9fc;
}

.custom-option.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
}

.custom-option.selected:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%) !important;
}

/* Custom Scrollbar for Select and Page */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f6f9fc;
  border-radius: 10px;
  margin: 4px 0;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #cbd5e0 0%, #a0aec0 100%);
  border-radius: 10px;
  border: 2px solid #f6f9fc;
  transition: all 0.2s ease;
  min-height: 40px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a0aec0 0%, #718096 100%);
  border-color: #f0f4f8;
}

::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #718096 0%, #4a5568 100%);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #a0aec0 #f6f9fc;
}

/* Checkbox */
.checkbox-wrapper {
  margin: 16px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.checkbox-input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-custom {
  position: relative;
  height: 16px;
  width: 16px;
  background-color: #ffffff;
  border: 1.5px solid #e6ebf1;
  border-radius: 3px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.checkbox-input:checked ~ .checkbox-custom {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
}

.checkbox-custom:after {
  content: '';
  position: absolute;
  display: none;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
  transform-origin: center center;
}

.checkbox-input:checked ~ .checkbox-custom:after {
  display: block;
}

.checkbox-text {
  margin-left: 10px;
  font-size: 13px;
  color: #32325d;
  line-height: 1.4;
}

/* Submit Button */
.submit-button {
  width: 100%;
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.submit-button:hover::before {
  left: 100%;
}

.submit-button:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
  transform: translateY(-2px);
}

.submit-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.submit-button:disabled {
  background: #aab7c4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-text {
  position: relative;
  z-index: 1;
}

/* Loading State */
.submit-button.loading {
  pointer-events: none;
}

.submit-button.loading .button-text {
  opacity: 0;
}

.submit-button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Invalid State */
.form-input.invalid {
  border-color: #df1b41 !important;
  box-shadow: 0 0 0 1px #df1b41, 0 0 0 4px rgba(99, 91, 255, 0.06) !important;
  animation: shake 0.4s ease;
  position: relative !important;
  z-index: 100 !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Snackbar */
#snackbar {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  min-width: 250px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  z-index: 10000;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#snackbar.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
  body {
    padding: 20px 16px;
    align-items: flex-start;
  }

  .checkout-container {
    grid-template-columns: 1fr;
    max-width: 680px;
    gap: 20px;
    transform: none !important;
  }

  .summary-content {
    padding: 32px 24px 16px 24px;
  }

  .payment-form {
    padding: 32px 24px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 16px 12px;
  }

  .checkout-container {
    max-width: 100%;
    gap: 16px;
  }

  .summary-content {
    padding: 24px 20px 12px 20px;
  }

  .payment-form {
    padding: 24px 20px;
  }

  .summary-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .form-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .form-subtitle {
    font-size: 15px;
  }

  .stripe-logo {
    width: 110px;
  }

  .submit-button {
    height: 44px;
    font-size: 15px;
  }

  .address-split {
    flex-direction: column;
    gap: 0;
    height: auto;
  }

  .address-split .form-input {
    border-right: 1px solid #e6ebf1;
    border-radius: 0;
    margin-top: -1px;
    flex: none;
    width: 100%;
  }

  .address-split .form-input:first-child {
    border-radius: 0;
    margin-top: -1px;
    flex: none;
    width: 100%;
  }

  .address-split .form-input:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    margin-top: -1px;
    flex: none;
    width: 100%;
  }

  .order-item {
    padding: 12px 0;
  }

  .item-image {
    width: 40px;
    height: 40px;
  }

  .item-name {
    font-size: 14px;
  }

  .item-price {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px 8px;
  }

  .checkout-container {
    gap: 12px;
  }

  .summary-content {
    padding: 20px 16px 12px 16px;
  }

  .payment-form {
    padding: 20px 16px;
  }

  .summary-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .form-title {
    font-size: 17px;
    margin-bottom: 14px;
  }

  .form-subtitle {
    font-size: 14px;
  }

  .stripe-logo {
    width: 100px;
  }

  .stripe-logo-container {
    margin-bottom: 20px;
    padding: 16px 0;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-section {
    margin-bottom: 24px;
  }

  .icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
  }
}

/* Smooth scrolling for mobile */
@media (max-width: 1024px) {
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
}
