/**
 * Savvy Rest Gift Card Enhancements - Amount Selector
 * Card grid and interactive amount selection
 * Version: 2.1.0
 * Updated: November 19, 2025 - Added aggressive hiding for plugin custom amount form
 */

/* ==========================================
   AMOUNT SELECTOR CONTAINER
   ========================================== */

.savvyrest-gc-amount-selector {
  margin: 0 !important;
  padding: var(--gc-spacing-xl);
  background: var(--gc-bg-white);
  border-radius: var(--gc-radius-lg);
  border: 2px solid var(--gc-border);
}

.savvyrest-gc-amount-selector h3 {
  margin: 0 0 var(--gc-spacing-xl) 0;
  font-size: var(--gc-font-size-4xl);
  font-weight: var(--gc-font-weight-bold);
  color: var(--gc-text);
  text-align: center;
}

/* ==========================================
   AMOUNT CARD GRID
   ========================================== */

/* Support both gc-* and savvyrest-gc-* class names with high specificity */
.product-type-pw-gift-card .gc-amount-grid,
.product-type-pw-gift-card .savvyrest-gc-amount-grid,
.single-pw_gift_card .gc-amount-grid,
.single-pw_gift_card .savvyrest-gc-amount-grid,
.postid-141995 .gc-amount-grid,
.postid-141995 .savvyrest-gc-amount-grid,
.gc-amount-grid,
.savvyrest-gc-amount-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px !important;
  max-width: 100% !important;
  margin-bottom: var(--gc-spacing-xl);
  grid-auto-flow: row;
}

/* ==========================================
   INDIVIDUAL AMOUNT CARDS
   ========================================== */

/* Support both class naming conventions */
.gc-amount-card,
.savvyrest-gc-amount-card {
  position: relative;
  padding: var(--gc-spacing-xl) var(--gc-spacing);
  background: var(--gc-bg-pure-white);
  border: 3px solid var(--gc-border);
  border-radius: var(--gc-radius);
  cursor: pointer;
  transition: all var(--gc-transition);
  text-align: center;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--gc-spacing-sm);
}

/* Card content wrapper (template structure) */
.gc-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gc-spacing-sm);
  width: 100%;
}

/* ==========================================
   CARD INTERACTIVE STATES
   ========================================== */

.gc-amount-card:hover,
.savvyrest-gc-amount-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--gc-shadow-md);
  border-color: var(--gc-primary);
}

.gc-amount-card.active,
.savvyrest-gc-amount-card.active {
  background: linear-gradient(135deg, var(--gc-primary) 0%, var(--gc-primary-dark) 100%);
  border-color: var(--gc-primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 12px 32px var(--gc-shadow-primary);
}

.gc-amount-card.active .gc-amount-value,
.gc-amount-card.active .gc-amount-label,
.gc-amount-card.active .savvyrest-gc-amount-value,
.gc-amount-card.active .savvyrest-gc-amount-desc,
.savvyrest-gc-amount-card.active .gc-amount-value,
.savvyrest-gc-amount-card.active .gc-amount-label,
.savvyrest-gc-amount-card.active .savvyrest-gc-amount-value,
.savvyrest-gc-amount-card.active .savvyrest-gc-amount-desc {
  color: white;
}

.gc-amount-card:focus,
.savvyrest-gc-amount-card:focus {
  outline: 3px solid var(--gc-primary);
  outline-offset: 2px;
}

/* ==========================================
   CARD CONTENT
   ========================================== */

/* Support both naming conventions */
.gc-amount-value,
.savvyrest-gc-amount-value {
  font-size: var(--gc-font-size-5xl);
  font-weight: var(--gc-font-weight-extrabold);
  color: var(--gc-text);
  line-height: 1;
  margin: 4px 0;
}

.gc-amount-label,
.gc-amount-desc,
.savvyrest-gc-amount-desc {
  font-size: var(--gc-font-size-sm);
  color: var(--gc-text-secondary);
  font-weight: var(--gc-font-weight-semibold);
  line-height: var(--gc-line-height-snug);
}

/* Hide icons (no longer used) */
.gc-amount-icon,
.savvyrest-gc-amount-icon {
  display: none;
}

/* ==========================================
   ENHANCED ADD TO CART BUTTON
   ========================================== */

.single-product .single_add_to_cart_button {
  background: linear-gradient(135deg, var(--gc-primary) 0%, var(--gc-primary-dark) 100%);
  color: white;
  border: none;
  padding: var(--gc-spacing-lg) 40px;
  font-size: var(--gc-font-size-lg);
  font-weight: var(--gc-font-weight-bold);
  border-radius: var(--gc-radius);
  min-width: 280px;
  transition: all var(--gc-transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--gc-shadow-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.single-product .single_add_to_cart_button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gc-shadow-primary-hover);
}

.single-product .single_add_to_cart_button:active {
  transform: translateY(0);
}

/* Hide literal span, show emoji via CSS */
.single_add_to_cart_button .gc-icon {
  font-size: 0;
}

.single_add_to_cart_button::before {
  content: "🎁 ";
  font-size: var(--gc-font-size-2xl);
  margin-right: var(--gc-spacing-sm);
  vertical-align: middle;
}

.single-product .single_add_to_cart_button:after {
  content: "⏰ Digital delivery in minutes";
  display: block;
  font-size: var(--gc-font-size-sm);
  font-weight: var(--gc-font-weight-medium);
  margin-top: var(--gc-spacing-sm);
  opacity: 0.9;
}

/* ==========================================
   BUTTON STATES (LOADING & SUCCESS)
   ========================================== */

.single-product .single_add_to_cart_button.loading {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

.single-product .single_add_to_cart_button.loading::before {
  content: "⏳ ";
  animation: spin 1s linear infinite;
}

.single-product .single_add_to_cart_button.added {
  background: linear-gradient(135deg, var(--gc-trust-green) 0%, #4a6b4d 100%);
  transform: scale(1.05);
}

.single-product .single_add_to_cart_button.added::before {
  content: "✓ ";
}

.single-product .single_add_to_cart_button.added::after {
  display: none;
}

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

/* ==========================================
   SUCCESS NOTIFICATION
   ========================================== */

.savvyrest-gc-success-notification {
  position: fixed;
  top: 100px;
  right: -400px;
  background: linear-gradient(135deg, var(--gc-trust-green) 0%, #4a6b4d 100%);
  color: white;
  padding: var(--gc-spacing-xl) var(--gc-spacing-2xl);
  border-radius: var(--gc-radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  min-width: 350px;
  transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.savvyrest-gc-success-notification.show {
  right: 24px;
}

.savvyrest-gc-success-notification.hide {
  right: -400px;
}

.gc-notification-header {
  display: flex;
  align-items: center;
  gap: var(--gc-spacing);
  margin-bottom: var(--gc-spacing);
}

.gc-notification-icon {
  font-size: var(--gc-font-size-5xl);
  line-height: 1;
}

.gc-notification-title {
  font-size: var(--gc-font-size-2xl);
  font-weight: var(--gc-font-weight-bold);
  margin: 0;
  line-height: 1.2;
}

.gc-notification-message {
  font-size: var(--gc-font-size-md);
  margin: var(--gc-spacing-sm) 0 var(--gc-spacing-lg) 0;
  opacity: 0.95;
  line-height: 1.5;
}

.gc-notification-actions {
  display: flex;
  gap: var(--gc-spacing);
  margin-top: var(--gc-spacing-lg);
}

.gc-notification-btn {
  padding: var(--gc-spacing-sm) var(--gc-spacing-lg);
  border-radius: var(--gc-radius-sm);
  font-size: var(--gc-font-size-sm);
  font-weight: var(--gc-font-weight-semibold);
  text-decoration: none;
  transition: all var(--gc-transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--gc-spacing-sm);
  cursor: pointer;
  border: none;
}

.gc-notification-btn.primary {
  background: white;
  color: var(--gc-trust-green);
}

.gc-notification-btn.primary:hover {
  background: var(--gc-bg-cream);
  transform: translateY(-1px);
}

.gc-notification-btn.secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.gc-notification-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gc-notification-close {
  position: absolute;
  top: var(--gc-spacing);
  right: var(--gc-spacing);
  background: none;
  border: none;
  color: white;
  font-size: var(--gc-font-size-2xl);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--gc-transition-fast);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gc-notification-close:hover {
  opacity: 1;
}

/* ==========================================
   MOBILE STICKY CTA BAR
   ========================================== */

.savvyrest-gc-mobile-sticky {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: var(--gc-spacing) var(--gc-spacing-lg);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: var(--gc-z-mobile-sticky);
  transform: translateY(100%);
  transition: transform var(--gc-transition);
}

.savvyrest-gc-mobile-sticky.visible {
  transform: translateY(0);
}

.savvyrest-gc-mobile-sticky-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gc-spacing);
  max-width: var(--gc-max-width-form);
  margin: 0 auto;
}

.savvyrest-gc-mobile-sticky-info {
  flex: 1;
}

.savvyrest-gc-mobile-sticky-title {
  font-size: var(--gc-font-size-base);
  font-weight: var(--gc-font-weight-bold);
  color: var(--gc-text);
  margin: 0 0 4px 0;
}

.savvyrest-gc-mobile-sticky-price {
  font-size: var(--gc-font-size-xl);
  font-weight: var(--gc-font-weight-extrabold);
  color: var(--gc-primary);
  margin: 0;
}

.savvyrest-gc-mobile-sticky-btn {
  background: linear-gradient(135deg, var(--gc-primary) 0%, var(--gc-primary-dark) 100%);
  color: white;
  border: none;
  padding: 14px 28px;
  font-size: var(--gc-font-size-lg);
  font-weight: var(--gc-font-weight-bold);
  border-radius: var(--gc-radius-sm);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px var(--gc-shadow-primary);
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==========================================
   CUSTOM AMOUNT CARD SPECIFIC STYLES
   ========================================== */

.savvyrest-gc-amount-card.custom-amount-card {
  position: relative;
  padding: var(--gc-spacing-lg) var(--gc-spacing-md);
}

.savvyrest-gc-custom-input-wrapper {
  position: relative;
  margin: var(--gc-spacing-sm) 0;
  width: 100%;
}

.savvyrest-gc-custom-input-wrapper .currency-symbol {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 600;
  color: var(--gc-text-primary, #2c1810);
  pointer-events: none;
}

.savvyrest-custom-amount-input {
  width: 100%;
  padding: 12px 12px 12px 28px;
  border: 2px solid var(--gc-border, #e5d5c5);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  background: var(--gc-background, #ffffff);
  transition: all var(--gc-transition, 0.3s ease);
  font-family: inherit;
}

.savvyrest-custom-amount-input:focus {
  outline: none;
  border-color: var(--gc-primary, #8B7355);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.savvyrest-custom-amount-input::placeholder {
  color: var(--gc-text-tertiary, #999);
  font-weight: 400;
}

.savvyrest-gc-amount-range {
  font-size: 12px;
  color: var(--gc-text-secondary, #6b5d52);
  margin-top: 4px;
}

/* Error state */
.custom-amount-card.error .savvyrest-custom-amount-input {
  border-color: #dc2626;
}

/* Active state with input */
.custom-amount-card.active {
  background: linear-gradient(135deg, var(--gc-trust-green, #5A7C5E) 0%, #4a6b4d 100%);
}

.custom-amount-card.active .savvyrest-gc-amount-value,
.custom-amount-card.active .savvyrest-gc-amount-label,
.custom-amount-card.active .savvyrest-gc-amount-range,
.custom-amount-card.active .currency-symbol {
  color: white;
}

.custom-amount-card.active .savvyrest-custom-amount-input {
  background: white;
  border-color: white;
}

/* Hide PW Gift Cards original custom amount form until needed */
#pwgc-custom-amount-form.pwgc-hidden {
  display: none !important;
}

/* CRITICAL: Always hide the plugin's custom amount form (we use our own UI) */
/* Multiple properties to ensure it stays hidden and can't steal focus */
.product-type-pw-gift-card #pwgc-custom-amount-form,
.postid-141995 #pwgc-custom-amount-form,
#pwgc-custom-amount-form {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -9999px !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

/* Also disable the input field inside to prevent any interaction */
.product-type-pw-gift-card #pwgc-custom-amount,
.postid-141995 #pwgc-custom-amount,
#pwgc-custom-amount-form #pwgc-custom-amount {
  pointer-events: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}


/* ==========================================
   CUSTOM AMOUNT SECTION (BELOW CARDS)
   ========================================== */

.savvyrest-gc-custom-amount-section {
  margin-top: var(--gc-spacing-xl);
  padding: var(--gc-spacing-xl);
  background: linear-gradient(135deg, #f8f5f1 0%, #faf7f3 100%);
  border-radius: var(--gc-radius);
  border: 2px solid var(--gc-primary, #8B7355);
  text-align: center;
}

.savvyrest-gc-custom-amount-section label {
  display: block;
  font-size: var(--gc-font-size-lg);
  font-weight: var(--gc-font-weight-bold);
  color: var(--gc-text, #2c1810);
  margin-bottom: var(--gc-spacing);
}

.savvyrest-gc-custom-amount-section .savvyrest-gc-custom-input-wrapper {
  position: relative;
  max-width: 300px;
  margin: 0 auto var(--gc-spacing-sm);
}

.savvyrest-gc-custom-amount-section .currency-symbol {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 600;
  color: var(--gc-text-primary, #2c1810);
  pointer-events: none;
}

.savvyrest-gc-custom-amount-section .savvyrest-custom-amount-input {
  width: 100%;
  padding: 14px 14px 14px 32px;
  border: 2px solid var(--gc-border, #e5d5c5);
  border-radius: 8px;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  background: white;
  transition: all var(--gc-transition, 0.3s ease);
  font-family: inherit;
}

.savvyrest-gc-custom-amount-section .savvyrest-custom-amount-input:focus {
  outline: none;
  border-color: var(--gc-primary, #8B7355);
  box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.15);
}

.savvyrest-gc-custom-amount-section .savvyrest-custom-amount-input::placeholder {
  color: var(--gc-text-tertiary, #999);
  font-weight: 400;
}

.savvyrest-gc-custom-amount-section .savvyrest-gc-amount-range {
  font-size: 13px;
  color: var(--gc-text-secondary, #6b5d52);
  margin: 0;
  font-weight: 500;
}

/* Error state for section */
.savvyrest-gc-custom-amount-section.error {
  border-color: #dc2626;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.savvyrest-gc-custom-amount-section.error .savvyrest-custom-amount-input {
  border-color: #dc2626;
}

/* Remove input from inside custom card if it exists */
.custom-amount-card .savvyrest-gc-custom-input-wrapper,
.custom-amount-card .savvyrest-gc-amount-range {
  display: none !important;
}

