/**
 * Drawer Cart Styles
 * Modern sliding drawer for add-to-cart functionality
 */

/* Drawer Overlay */
.gingerup-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gingerup-drawer-overlay.active {
  opacity: 1;
}

/* Drawer Container */
.gingerup-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  z-index: 9999;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gingerup-drawer.active {
  transform: translateY(0);
}

/* Drawer Header */
.gingerup-drawer-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 20px 30px;
}

.gingerup-drawer-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

.gingerup-drawer-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.gingerup-drawer-close:hover {
  background: #e9ecef;
  color: #333;
}

/* Drawer Content */
.gingerup-drawer-content {
  display: flex;
  gap: 30px;
  padding: 30px;
  min-height: 400px;
}

.gingerup-drawer-left {
  flex: 1;
  max-width: 50%;
}

.gingerup-drawer-right {
  flex: 1;
  max-width: 50%;
  background: #edf4f3;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

/* Product Info */
.gingerup-product-info {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.gingerup-product-image {
  flex-shrink: 0;
  overflow: hidden;
  flex: 2;
}

.gingerup-product-image img {
  width: 270px;
  display: block;
  margin: 0 auto;
  height: auto;
  object-fit: cover;
}

.gingerup-product-details {
  flex: 3;
}

.gingerup-product-details h4 {
  margin: 0 0 10px 0;
  font-size: 32px;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.gingerup-product-price {
  /* margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  color: #2c5530; */
  display: none;
}

.gingerup-product-description p {
  color: #000 !important;
  line-height: 1.5;
  margin-bottom: 20px;
  font-size: 18px;
}

/* Quantity Controls */
.gingerup-quantity-wrapper {
  margin-top: 20px;
}

.gingerup-quantity-wrapper label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.gingerup-quantity-controls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.gingerup-qty-minus,
.gingerup-qty-plus {
  background: #f8f9fa;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  transition: background-color 0.3s ease;
  position: relative;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.gingerup-qty-minus:hover,
.gingerup-qty-plus:hover {
  background: #e9ecef;
}

.gingerup-qty-minus:active,
.gingerup-qty-plus:active {
  background: #dee2e6;
  transform: scale(0.95);
}

.gingerup-quantity-input {
  border: none;
  width: 60px;
  height: 40px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  background: #fff;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

.gingerup-quantity-input:focus {
  outline: none;
}

/* Variations */
.gingerup-variations {
  margin-bottom: 20px;
}

.gingerup-variations h5 {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.gingerup-variation-select {
  margin-bottom: 20px;
}

.gingerup-variation-select:last-child {
  margin-bottom: 0;
}

.gingerup-variation-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.gingerup-variation-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gingerup-variation-swatch {
  cursor: pointer;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.gingerup-variation-swatch:hover {
  border-color: #2c5530;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(44, 85, 48, 0.2);
}

.gingerup-variation-swatch.selected {
  border-color: #2c5530;
  background-color: #2c5530;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(44, 85, 48, 0.3);
}

.gingerup-variation-swatch.selected::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: #2c5530;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Text Swatches */
.gingerup-text-swatch {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  box-sizing: border-box;
}

.gingerup-text-swatch .swatch-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  gap: 2px;
}

.gingerup-text-swatch .first-word {
  font-size: 34px;
  font-weight: 700;
  color: #333;
  display: block;
}

.gingerup-text-swatch .second-word {
  font-size: 12px;
  font-weight: 400;
  color: #666;
  display: block;
}

.gingerup-text-swatch.selected .first-word {
  color: #fff;
}

.gingerup-text-swatch.selected .second-word {
  color: #fff;
  opacity: 0.9;
}

/* Color Swatches */
.gingerup-color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  min-width: 40px;
  min-height: 40px;
}

.gingerup-color-swatch span {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #333;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gingerup-color-swatch:hover span {
  opacity: 1;
}

.gingerup-color-swatch.selected::after {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* Special handling for white/light colors */
.gingerup-color-swatch[style*="white"],
.gingerup-color-swatch[style*="#fff"],
.gingerup-color-swatch[style*="#FFF"],
.gingerup-color-swatch[style*="ivory"],
.gingerup-color-swatch[style*="snow"],
.gingerup-color-swatch[style*="cream"] {
  border-color: #ccc;
}

.gingerup-color-swatch[style*="white"].selected::after,
.gingerup-color-swatch[style*="#fff"].selected::after,
.gingerup-color-swatch[style*="#FFF"].selected::after,
.gingerup-color-swatch[style*="ivory"].selected::after,
.gingerup-color-swatch[style*="snow"].selected::after,
.gingerup-color-swatch[style*="cream"].selected::after {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

/* Purchase Tabs */
.gingerup-purchase-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gingerup-tab-headers {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-radius: 0;
  overflow: hidden;
  border: none;
  background: #edf4f3;
}

.gingerup-tab-header {
  flex: 1;
  background: #fff;
  border: none;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  border-right: none;
}

.gingerup-tab-header:last-child {
  border-right: none;
}

.gingerup-tab-header.active {
  background: #edf4f3;
  color: #2c5530;
}

.gingerup-tab-header:hover:not(.active) {
  background: #f5f5f5;
  color: #333;
}

/* Tab Content */
.gingerup-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #edf4f3;
}

.gingerup-tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  background: #edf4f3;
  padding: 20px;
}

.gingerup-tab-panel.active {
  display: flex;
}

/* Subscription Options */
.gingerup-subscription-options {
  margin-bottom: 20px;
}

.gingerup-subscription-plans p {
  margin: 0 0 15px 0;
  font-weight: 600;
  color: #333;
}

.gingerup-subscription-plan {
  margin-bottom: 15px;
}

.gingerup-subscription-plan:last-child {
  margin-bottom: 0;
}

.gingerup-subscription-plan label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 12px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.gingerup-subscription-plan label:hover {
  background: #e9ecef;
}

.gingerup-subscription-plan input[type="radio"] {
  margin: 0;
  width: 18px;
  height: 18px;
}

.gingerup-subscription-plan span {
  font-weight: 500;
  color: #333;
}

/* Purchase Summary */
.gingerup-purchase-summary {
  margin-top: auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 120px;
  margin-bottom: 0;
}

/* Price Display - Lower Left Corner */
.gingerup-price-display {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
}

.gingerup-price-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
  font-weight: 400;
}

.gingerup-price-amount {
  font-size: 32px;
  font-weight: 700;
  color: #2c5530;
  line-height: 1;
  letter-spacing: -0.4px;
}

/* Hide old price display */
.gingerup-total-price,
.gingerup-subscription-price {
  display: none;
}

.gingerup-total-label,
.gingerup-subscription-label {
  color: #333;
}

.gingerup-total-amount,
.gingerup-subscription-amount {
  color: #2c5530;
}

.gingerup-add-to-cart-btn:disabled {
  background: #f5f5f5 !important;
  color: #999 !important;
  border-color: #ccc !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.6 !important;
}

.gingerup-add-to-cart-btn:disabled .kb-svg-icon-wrap {
  background-color: #ccc !important;
}

.gingerup-add-to-cart-btn:disabled:hover {
  background: #f5f5f5 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading State */
.gingerup-add-to-cart-btn.loading {
  position: relative;
  color: transparent;
}

.gingerup-add-to-cart-btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Price Loading Spinner */
.gingerup-price-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e9ecef;
  border-top: 2px solid #2c5530;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin: 0 auto;
}

.gingerup-price-display .gingerup-price-spinner {
  width: 24px;
  height: 24px;
  border-width: 3px;
  margin: 8px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .gingerup-drawer {
    max-height: 90vh;
  }

  .gingerup-drawer-content {
    flex-direction: column;
    gap: 20px;
    padding: 20px;
  }

  .gingerup-drawer-left,
  .gingerup-drawer-right {
    max-width: 100%;
  }

  .gingerup-drawer-right {
    background: #edf4f3;
    border-radius: 12px;
    padding: 0;
  }

  .gingerup-product-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .gingerup-drawer-header {
    padding: 15px 20px;
  }

  .gingerup-drawer-header h3 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .gingerup-drawer-content {
    padding: 15px;
  }

  .gingerup-tab-header {
    padding: 12px 15px;
    font-size: 14px;
  }

  .gingerup-purchase-summary {
    padding: 15px;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-height: 80px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 0;
  }

  .gingerup-tab-panel {
    padding: 15px;
  }

  .gingerup-price-display {
    align-items: center;
    text-align: center;
  }

  .gingerup-price-amount {
    font-size: 32px;
  }

  .gingerup-add-to-cart-btn {
    min-width: 120px;
    height: 48px;
  }

  .gingerup-add-to-cart-btn .kb-svg-icon-wrap {
    width: 35px;
    height: 35px;
  }

  .gingerup-variations {
    padding: 15px;
  }

  .gingerup-variation-swatches {
    gap: 6px;
  }

  .gingerup-text-swatch {
    width: 70px;
    height: 70px;
    padding: 6px;
  }

  .gingerup-text-swatch .first-word {
    font-size: 14px;
  }

  .gingerup-text-swatch .second-word {
    font-size: 10px;
  }

  .gingerup-color-swatch {
    width: 35px;
    height: 35px;
    min-width: 35px;
    min-height: 35px;
  }

  .gingerup-color-swatch span {
    font-size: 11px;
    bottom: -22px;
  }
}

/* Animation for drawer trigger button */
.gingerup-drawer-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Body scroll prevention */
body.drawer-open {
  overflow: hidden !important;
}

/* Success notification */
.gingerup-success-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999999999;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.gingerup-success-notification.show {
  transform: translateX(0);
}

.gingerup-success-notification.hide {
  transform: translateX(100%);
}
