/* ========================================
   CHECKOUT PAGE STYLES — Light theme
   ======================================== */

/* Local variable additions not in main styles.css */
:root {
  --card:     #FFFFFF;
  --brand-2:  #9B0C24;
}

/* 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;
  color: var(--ink);
}

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

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(27, 135, 84, 0.08);
  border: 1px solid rgba(27, 135, 84, 0.25);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 14px;
  color: var(--success);
}

/* 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(--surface);
  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;
  color: var(--ink);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--brand);
  color: #fff;
  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: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-card:hover {
  border-color: #bbb;
  background: #F5F3F0;
}

.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: var(--brand-soft);
}

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

.product-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--ink);
}

.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(--ink-2);
}

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

.product-card .product-features li::before {
  content: "✓ ";
  color: var(--success);
}

.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: #fff;
}

.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: var(--ink);
  color: #fff;
  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;
  color: var(--ink);
}

.quantity-selector {
  display: flex;
  align-items: center;
  background: var(--bg);
  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: var(--ink-2);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  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(200, 16, 46, 0.08);
}

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

.form-group select { cursor: pointer; }

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

/* Phone Input */
.phone-input {
  display: flex;
  background: var(--bg);
  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(200, 16, 46, 0.08);
}

.phone-input .country-code {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #EEECE8;
  border-right: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 600;
}

.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(--ink-2);
  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(--surface);
  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);
  color: var(--ink);
}

.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;
  color: var(--ink);
}

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

.summary-product-item .product-total {
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}

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

.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--ink-2);
}

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

.free-shipping { color: var(--success); 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;
  color: var(--ink-2);
}

/* 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: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-2);
}

.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.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

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

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

.modal-body h3 {
  font-size: 15px;
  margin: 16px 0 8px;
  color: var(--ink);
}

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

.modal-body p {
  font-size: 14px;
  color: var(--ink-2);
  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;
  background: none;
  border: none;
}

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

/* ========================================
   ORDER SUCCESS / FAILED 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: #16a34a; }
.success-section .subtitle { font-size: 18px; color: var(--muted); margin: 0 0 32px; }

.order-details-card {
  background: var(--surface);
  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);
  color: var(--ink);
}

.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; color: var(--ink); }

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

.next-steps h3 { margin: 0 0 16px; color: var(--ink); }

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

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

.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: #dc2626; }

/* Loading State */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  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: #fff; }

/* 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 */
@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-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 { 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: var(--success); font-weight: 500; }
.status-error   { color: #ef4444; font-weight: 500; }
.status-warning { color: #f59e0b; font-weight: 500; }

.pincode-help {
  margin-top: 12px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
}

.pincode-help p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.pincode-help p + p { margin-top: 8px; }
.pincode-help a { color: var(--brand); font-weight: 500; }

.delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}

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

.serviceable-notice {
  margin-top: 16px;
  padding: 12px;
  background: rgba(27, 135, 84, 0.06);
  border: 1px solid rgba(27, 135, 84, 0.2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.serviceable-notice strong { color: var(--success); }

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

.bottom-buy-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.97);
  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.08);
}

.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: var(--ink); }

.bottom-pay-btn {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--brand);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.25);
}

.bottom-pay-btn:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: scale(1.02);
}

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

@media (min-width: 981px) { .bottom-buy-bar { display: none; } }

@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; }
}

@media (max-width: 980px) {
  .checkout-section { padding-bottom: 100px; }
}
