/**
 * Cart and Checkout Styles
 * Part of Rifthub Plugin
 */

/* Cart Button in Header */
.js-open-cart,
.custom-header .js-open-cart {
  position: fixed;
  right: 0;
  top: 90%;
  transform: translateX(30%) translateY(-50%);
  transition: transform 0.3s ease;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px 0 0 9px;
  background-color: #fff;
  z-index: 999;
  color: #111;
  cursor: pointer;
}

@media only screen and (max-width: 980px) {
  .js-open-cart,
  .custom-header .js-open-cart {
    top: auto;
    bottom: 20px;
    right: 20px;
    transform: none;
    border-radius: 50%;
  }
}

.js-open-cart svg,
.custom-header .js-open-cart svg {
  height: 30px;
  width: 30px;
}

.js-open-cart:hover,
.custom-header .js-open-cart:hover {
  transform: translateX(0) translateY(-50%);
}

@media only screen and (max-width: 980px) {
  .js-open-cart:hover,
  .custom-header .js-open-cart:hover {
    transform: none;
  }
}

.custom-header .custom-button-cart {
  cursor: pointer;
}

/* Cart Overlay and Drawer */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: 0.25s ease;
  z-index: 999;
}

.cart-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.custom-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100%;
  height: 100vh;
  background: #fff;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: 0.25s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: var(--custom-fifth-font-family);
}

.custom-cart-drawer.is-active {
  transform: translateX(0);
}

.custom-cart-drawer__header,
.custom-cart-drawer__footer {
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.custom-cart-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-cart-drawer__header h3 {
  margin: 0;
}

.custom-cart-drawer__footer {
  border-top: 1px solid #eee;
  border-bottom: 0;
  margin-top: auto;
}

.custom-cart-drawer__body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.custom-cart-drawer__close {
  background: none;
  border: 0;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

.custom-cart-drawer__checkout {
  display: block;
  text-align: center;
  margin-top: 12px;
  background: #111;
  color: #fff;
  padding: 12px 16px;
  text-decoration: none;
  border-radius: 8px;
  transition: opacity 0.2s;
}

.custom-cart-drawer__checkout:hover {
  opacity: 0.85;
}

/* Cart Loading */
.cart-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
}

.cart-item-spinner {
  position: relative;
  z-index: 6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #e0dede;
  border-top-color: #111;
  animation: cart-spin 0.8s linear infinite;
}

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

/* Cart Items */
.cart-item {
  display: flex;
  flex-direction: column;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  padding: 1em;
}

.cart-item img {
  max-width: 75px;
  max-height: 75px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-item .cart-details {
  display: flex;
  gap: 12px;
}

.cart-item .cart-details .cart-item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item {
  border-bottom: 1px solid #dbdbdb;
}

.inner-container-button {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
}

.inner-container-button .cart-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.inner-container-button .cart-item .cart-item-details {
  display: flex;
  margin-bottom: 10px;
}

.inner-container-button .cart-item__image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.inner-container-button .cart-item__meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.inner-container-button .cart-item__qty {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.inner-container-button .cart-item__qty button {
  cursor: pointer;
  background: #f4f4f4;
  border: 1px solid #ddd;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.inner-container-button .cart-item__qty button:hover {
  background: #eee;
}

.inner-container-button .cart-item__remove {
  cursor: pointer;
  background: none;
  border: none;
  color: #ff4d4d;
  font-size: 12px;
  text-align: left;
  padding: 0;
  margin-top: 8px;
  text-decoration: underline;
}

body.cart-open {
  overflow: hidden;
}

/* Checkout Page */
.checkout-page {
  background-color: #f3f3f3;
  padding: 40px 0;
  min-height: 100vh;
  font-family: var(--custom-fifth-font-family);
  color: #0f0f0f;
  margin: 0 auto;
  padding: 15px;
}

.checkout-page [v-cloak] {
  display: none !important;
}

.checkout-page .checkout-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.checkout-page .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.checkout-page .section-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #0f0f0f;
}

.checkout-page .edit-link {
  font-size: 13px;
  color: #111;
  text-decoration: underline;
  cursor: pointer;
}

.checkout-page .checkout-section {
  margin-bottom: 40px;
  transition: opacity 0.3s;
}

.checkout-page .checkout-section.section-faded {
  opacity: 0.6;
}

.checkout-page .checkout-section.section-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.checkout-page .summary-preview {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 5px;
  font-size: 14px;
  border: 1px solid #eee;
}

.checkout-page .form-group {
  margin-bottom: 12px;
}

.checkout-page .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkout-page input,
.checkout-page select {
  width: 100%;
  padding: 12px;
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.checkout-page input:focus,
.checkout-page select:focus {
  border-color: #111111;
  outline: none;
}

.checkout-page .placeholder-box {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  color: #666;
  font-size: 14px;
  border: 1px solid #e6e6e6;
}

.checkout-page .shipping-options {
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  overflow: hidden;
}

.checkout-page .shipping-option {
  display: flex;
  justify-content: space-between;
  padding: 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 14px;
  align-items: center;
}

.checkout-page .shipping-option:last-child {
  border-bottom: none;
}

.checkout-page .shipping-option.active {
  background: #f0f7ff;
  border-left: 3px solid #111111;
}

.checkout-page .shipping-option input[type="radio"] {
  width: auto;
  margin-right: 10px;
}

.checkout-page .shipping-option .option-name {
  flex: 1;
}

.checkout-page .shipping-option .option-price {
  font-weight: 600;
}

.checkout-page .payment-box {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  color: #666;
  font-size: 14px;
  border: 1px solid #e6e6e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.checkout-page .payment-box .payment-icon {
  color: #666;
}

.checkout-page .payment-subtitle {
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
}

.checkout-page .btn-complete {
  width: 100%;
  padding: 18px;
  background: #212121;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: background-color 0.2s;
}

.checkout-page .btn-complete:hover:not(:disabled) {
  background: #3c3c3c;
}

.checkout-page .checkout-sidebar {
  background: #f4f2f2;
  border-left: 1px solid #e6e6e6;
  margin-left: -30px;
  padding-left: 30px;
  min-height: 100%;
}

.checkout-page .summary-sticky {
  position: sticky;
  top: 40px;
}

.checkout-page .summary-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 15px;
  align-items: center;
  margin-bottom: 10px;
  border: 1px solid #dbdbdb;
  padding: 12px;
  border-radius: 10px;
}

.checkout-page .summary-item .image-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
}

.checkout-page .summary-item .image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.checkout-page .summary-item .image-wrapper .item-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #666;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.checkout-page .summary-item .item-details {
  display: flex;
  flex-direction: column;
}

.checkout-page .summary-item .item-details .item-name {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

.checkout-page .summary-item .item-details .checkout-item-variant {
  font-size: 12px;
  color: #666;
  margin: 2px 0 0;
}

.checkout-page .summary-item .price-breakdown {
  font-size: 12px;
  color: #666;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.checkout-page .summary-item .price-breakdown span {
  margin-top: 2px;
}

.checkout-page .summary-totals {
  border-top: 1px solid #e6e6e6;
  padding-top: 20px;
  margin-top: 20px;
}

.checkout-page .summary-totals .total-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 10px;
}

.checkout-page .summary-totals .total-row.grand-total {
  font-size: 18px;
  margin-top: 20px;
  border-top: 1px solid #e6e6e6;
  padding-top: 20px;
}

.checkout-page .summary-totals .total-row.grand-total strong {
  font-weight: 700;
}

.checkout-page .summary-totals .total-row.grand-total .total-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkout-page .summary-totals .total-row.grand-total .total-label small {
  color: #666;
  font-size: 12px;
}

.checkout-page .checkout-message {
  margin-top: 20px;
  padding: 15px;
  border-radius: 5px;
  font-size: 14px;
}

.checkout-page .checkout-message.error {
  background: #fff5f5;
  color: #c53030;
}

.checkout-page .checkout-message.success {
  background: #f0fff4;
  color: #2f855a;
}

.checkout-page .payment-methods {
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  overflow: hidden;
}

.checkout-page .payment-methods .payment-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.checkout-page .payment-methods .payment-option-label input[type="radio"] {
  width: 13px;
  margin: 0;
}

.checkout-page .payment-method {
  display: block;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.checkout-page .payment-method:last-child {
  border-bottom: none;
}

.checkout-page .payment-method.active {
  background: #fcfcfc;
}

.checkout-page .payment-method .method-content {
  padding: 20px;
  background: #fafafa;
  border-top: 1px solid #eee;
}

.checkout-page .payment-method .method-content .payment-card-box {
  text-align: center;
  color: #666;
  font-size: 13px;
}

.checkout-page .payment-method .method-content .payment-card-box svg {
  margin-bottom: 10px;
  opacity: 0.5;
}

.checkout-page .payment-method .method-content .payment-card-box p {
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.5;
}

.checkout-page .loading-inline {
  padding: 20px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.checkout-page .error-box {
  background: #fff5f5;
  color: #c53030;
  padding: 15px;
  border-radius: 5px;
  font-size: 14px;
  border: 1px solid #fed7d7;
}

@media (max-width: 900px) {
  .checkout-page .checkout-layout {
    grid-template-columns: 1fr;
    padding: 0 20px;
  }

  .checkout-page .checkout-sidebar {
    order: -1;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
  }
}

/* Checkout Complete Page */
.checkout-complete-page {
  background-color: #f8fafc;
  padding: 120px 20px;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family:
    "Inter",
    -apple-system,
    sans-serif;
}

.checkout-complete-page .complete-card {
  background: #ffffff;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 60px 40px;
  border-radius: 24px;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.checkout-complete-page .success-icon {
  width: 80px;
  height: 80px;
  background-color: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 30px;
}

.checkout-complete-page .success-icon svg {
  width: 40px;
  height: 40px;
}

.checkout-complete-page h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.checkout-complete-page .subtitle {
  font-size: 1.1rem;
  color: #64748b;
  margin-bottom: 32px;
}

.checkout-complete-page .checkout-complete-content {
  background: #f8fafc;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 40px;
  border: 1px solid #e2e8f0;
}

.checkout-complete-page .checkout-complete-content p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #1e293b;
  margin: 0;
}

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

.checkout-complete-page .actions .btn {
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.checkout-complete-page .actions .btn.btn-primary {
  background-color: #2563eb;
  color: white;
}

.checkout-complete-page .actions .btn.btn-primary:hover {
  background-color: rgb(18.5714285714, 76.1428571429, 202.4285714286);
  transform: translateY(-2px);
}

.checkout-complete-page .actions .btn.btn-outline {
  background-color: transparent;
  color: #1e293b;
  border: 2px solid #e2e8f0;
}

.checkout-complete-page .actions .btn.btn-outline:hover {
  border-color: #2563eb;
  color: #2563eb;
}

@media (max-width: 480px) {
  .checkout-complete-page {
    padding: 60px 20px;
  }

  .checkout-complete-page .complete-card {
    padding: 40px 24px;
  }

  .checkout-complete-page h1 {
    font-size: 1.8rem;
  }

  .checkout-complete-page .actions {
    flex-direction: column;
  }

  .checkout-complete-page .actions .btn {
    width: 100%;
  }
}

/* Survey Modal */
.survey-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.survey-modal.show {
  opacity: 1;
  visibility: visible;
}

.survey-modal.show .survey-modal-card {
  transform: translateY(0) scale(1);
}

.survey-modal-card {
  position: relative;
  background: #fff;
  width: calc(100% - 32px);
  max-width: 520px;
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.12),
    0 8px 10px -6px rgba(0, 0, 0, 0.08);
  transform: translateY(16px) scale(0.98);
  transition: all 0.25s ease;
}

.survey-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 0;
  background: transparent;
  font-size: 30px;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
}

.survey-close:hover {
  color: #1e293b;
}

.survey-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.survey-modal-card h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.survey-text {
  font-size: 1rem;
  line-height: 1.7;
  color: #64748b;
  margin-bottom: 32px;
}

.survey-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.survey-btn,
.survey-btn-outline {
  border-radius: 12px;
  padding: 14px 28px;
  font-weight: 600;
  font-size: 1rem;
  transition: 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.survey-btn {
  background: #2563eb;
  color: #fff;
  border: none;
}

.survey-btn:hover {
  transform: translateY(-2px);
  background: #1d4ed8;
}

.survey-btn-outline {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: #1e293b;
}

.survey-btn-outline:hover {
  border-color: #2563eb;
  color: #2563eb;
}

@media (max-width: 480px) {
  .survey-modal-card {
    padding: 32px 24px;
  }

  .survey-modal-card h2 {
    font-size: 1.6rem;
  }

  .survey-actions {
    flex-direction: column;
  }

  .survey-btn,
  .survey-btn-outline {
    width: 100%;
  }
}
