/* ========================================
   CHECKOUT PAGE STYLES
   ======================================== */

/* Checkout Section */
.checkout-section {
  padding: 40px 0 80px;
}

.checkout-header {
  text-align: center;
  margin-bottom: 40px;
}

.checkout-header h1 {
  font-size: 32px;
  margin: 0 0 8px;
}

.checkout-header .muted {
  color: var(--muted);
  margin: 0 0 16px;
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 14px;
  color: #22c55e;
}

/* Checkout Grid */
.checkout-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 980px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }
  .order-summary-section {
    order: -1;
  }
}

/* Form Sections */
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}

.form-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  margin: 0 0 20px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

/* Product Cards */
.product-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: #0c0f14;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-card:hover {
  border-color: #3a424d;
}

.product-card input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--brand);
  width: 18px;
  height: 18px;
}

.product-card.selected,
.product-card:has(input:checked) {
  border-color: var(--brand);
  background: rgba(255, 43, 43, 0.05);
}

.product-card .product-info {
  flex: 1;
}

.product-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.product-card .product-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.product-card .product-price {
  margin: 8px 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--brand);
}

.product-card .product-features {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
}

.product-card .product-features li {
  padding: 2px 0;
}

.product-card .product-features li::before {
  content: "✓ ";
  color: #22c55e;
}

.product-card .check-mark {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--brand);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
}

.product-card:has(input:checked) .check-mark {
  display: flex;
}

.product-card.featured {
  border-color: var(--brand);
}

.popular-tag {
  position: absolute;
  top: -10px;
  right: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}

/* Quantity Selector */
.quantity-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.quantity-row label {
  font-weight: 500;
}

.quantity-selector {
  display: flex;
  align-items: center;
  background: #0c0f14;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.qty-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.qty-btn:hover {
  background: var(--line);
}

.quantity-selector input {
  width: 50px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

/* Form Fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #cbd3df;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: #0c0f14;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 43, 43, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #5a6270;
}

.form-group select {
  cursor: pointer;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Phone Input */
.phone-input {
  display: flex;
  background: #0c0f14;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.phone-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 43, 43, 0.1);
}

.phone-input .country-code {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  border-right: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.phone-input input {
  border: none;
  border-radius: 0;
  background: transparent;
}

.phone-input input:focus {
  box-shadow: none;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 12px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
}

.checkbox-label a {
  color: var(--brand);
  text-decoration: underline;
}

/* Order Summary */
.order-summary {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}

.order-summary.sticky {
  position: sticky;
  top: 120px;
}

.order-summary h2 {
  font-size: 18px;
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.summary-product {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.summary-product .empty-selection {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

.summary-product-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.summary-product-item .product-name {
  font-weight: 600;
  margin: 0 0 4px;
}

.summary-product-item .product-qty {
  font-size: 13px;
  color: var(--muted);
}

.summary-product-item .product-total {
  font-weight: 700;
  white-space: nowrap;
}

/* Summary Lines */
.summary-details {
  padding: 16px 0;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

.summary-line.total {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 700;
}

.free-shipping {
  color: #22c55e;
  font-weight: 600;
}

/* Pay Button */
.pay-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  margin-top: 20px;
  position: relative;
}

.pay-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.pay-btn .btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Payment Methods */
.payment-methods {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.payment-methods p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.payment-icons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

/* Trust Badges */
.trust-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.trust-badges .badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.trust-badges .badge span:first-child {
  font-size: 20px;
}

/* Help Box */
.help-box {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 13px;
}

.help-box p {
  margin: 0;
  margin-bottom: 4px;
}

.help-box a {
  color: var(--brand);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content h2 {
  padding: 20px 24px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-body h3 {
  font-size: 15px;
  margin: 16px 0 8px;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.6;
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.close-modal:hover {
  color: var(--ink);
}

.modal-content {
  position: relative;
}

/* ========================================
   ORDER SUCCESS PAGE STYLES
   ======================================== */

.success-section {
  padding: 80px 0;
  text-align: center;
}

.success-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 50px;
}

.success-section h1 {
  font-size: 32px;
  margin: 0 0 12px;
  color: #22c55e;
}

.success-section .subtitle {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 32px;
}

.order-details-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  margin: 0 auto 32px;
  text-align: left;
}

.order-details-card h3 {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

.detail-row .label {
  color: var(--muted);
}

.detail-row .value {
  font-weight: 500;
}

.next-steps {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  margin: 0 auto 32px;
}

.next-steps h3 {
  margin: 0 0 16px;
}

.next-steps ul {
  margin: 0;
  padding-left: 24px;
  text-align: left;
}

.next-steps li {
  padding: 8px 0;
  color: var(--muted);
}

.success-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Failed Page */
.failed-section {
  padding: 80px 0;
  text-align: center;
}

.failed-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 50px;
}

.failed-section h1 {
  font-size: 32px;
  margin: 0 0 12px;
  color: #ef4444;
}

/* Loading State */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-overlay p {
  margin-top: 16px;
  color: var(--ink);
}

/* Input validation states */
.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid:not([value=""]) {
  border-color: #ef4444;
}

.form-group input:valid:not(:placeholder-shown) {
  border-color: #22c55e;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .checkout-header h1 {
    font-size: 24px;
  }
  
  .form-section {
    padding: 16px;
  }
  
  .product-card {
    padding: 12px;
  }
  
  .order-summary {
    padding: 16px;
  }
  
  .order-summary.sticky {
    position: static;
  }
  
  .trust-badges {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .trust-badges .badge {
    flex-direction: row;
    justify-content: center;
  }
}

/* ========================================
   PINCODE VALIDATION STYLES
   ======================================== */

/* Pincode input states */
.pincode-checking {
  border-color: #f59e0b !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath d='M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #f59e0b; }
  50% { border-color: #fbbf24; }
}

.pincode-valid {
  border-color: #22c55e !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

.pincode-invalid {
  border-color: #ef4444 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

/* Pincode status messages */
.pincode-status {
  margin-top: 8px;
  font-size: 13px;
}

.status-checking {
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-checking::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid #f59e0b;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.status-success {
  color: #22c55e;
  font-weight: 500;
}

.status-error {
  color: #ef4444;
  font-weight: 500;
}

.status-warning {
  color: #f59e0b;
  font-weight: 500;
}

/* Pincode help box for non-serviceable areas */
.pincode-help {
  margin-top: 12px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
}

.pincode-help p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.pincode-help p + p {
  margin-top: 8px;
}

.pincode-help a {
  color: var(--brand);
  font-weight: 500;
}

/* Delivery partner badge */
.delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}

.delivery-badge img {
  height: 16px;
  width: auto;
}

/* Serviceable areas notice */
.serviceable-notice {
  margin-top: 16px;
  padding: 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}

.serviceable-notice strong {
  color: #22c55e;
}

/* ========================================
   STICKY BOTTOM BUY BAR
   ======================================== */

.bottom-buy-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(15, 17, 20, 0.95) 0%, rgba(15, 17, 20, 1) 100%);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  z-index: 100;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bottom-buy-bar.visible {
  transform: translateY(0);
  opacity: 1;
}

.bottom-bar-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.bottom-bar-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bottom-bar-label {
  font-size: 12px;
  color: var(--muted);
}

.bottom-bar-total {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.bottom-pay-btn {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.bottom-pay-btn:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(255, 43, 43, 0.4);
}

.bottom-pay-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #444;
}

/* Hide on larger screens where sidebar is visible */
@media (min-width: 981px) {
  .bottom-buy-bar {
    display: none;
  }
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .bottom-buy-bar {
    padding: 10px 16px;
  }
  
  .bottom-bar-total {
    font-size: 20px;
  }
  
  .bottom-pay-btn {
    padding: 12px 24px;
    font-size: 15px;
  }
}

/* Add padding to main content so bottom bar doesn't cover content */
@media (max-width: 980px) {
  .checkout-section {
    padding-bottom: 100px;
  }
}
