/* ========================================
   SHARED PAGE COMPONENTS
   Reusable components across all pages
   ======================================== */

/* ========================================
   EXTENDED COLOR VARIABLES
   Consistent color scheme across all pages
   ======================================== */
:root {
  /* Stripe-specific colors */
  --color-stripe-blue: #0570de;
  --color-stripe-blue-dark: #0452a8;
  --color-stripe-blue-light: #1a85ff;

  /* Checkout-specific colors */
  --checkout-bg: #f6f9fc;
  --checkout-summary-bg: linear-gradient(to bottom, #1a1f36, #0a2540);
  --checkout-summary-dark: #0a2540;
  --checkout-summary-light: #1a1f36;

  /* Extended semantic colors */
  --color-success-light: #4ade80;
  --color-warning-light: #fbbf24;
  --color-error-light: #f87171;
  --color-info-light: #60a5fa;
}

/* ========================================
   INFO TOOLTIP
   ======================================== */
.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background-color: var(--color-gray-200);
  color: var(--color-gray-600);
  font-size: 12px;
  cursor: help;
  margin-left: var(--space-1);
}

.info-tooltip:hover {
  background-color: var(--color-gray-300);
  color: var(--color-gray-700);
}

/* ========================================
   PRODUCT PAGE (Public)
   Shared product display styles
   ======================================== */
.product-page {
  padding: var(--space-8) 0;
}

.product-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .product-page-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
  }
}

.product-gallery {
  position: relative;
}

.product-main-image {
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background-color: var(--color-gray-100);
}

.product-main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumbnails {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.product-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition-all);
  flex-shrink: 0;
}

.product-thumbnail:hover {
  border-color: var(--color-gray-300);
}

.product-thumbnail.active {
  border-color: var(--color-primary);
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-details {
  display: flex;
  flex-direction: column;
}

.product-category {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
}

.product-page-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

.product-page-price {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-6);
}

.product-page-description {
  color: var(--color-gray-600);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.product-options {
  margin-bottom: var(--space-6);
}

.product-option-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-gray-700);
  margin-bottom: var(--space-3);
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.product-tag {
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-gray-100);
  color: var(--color-gray-700);
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
}

/* ========================================
   LEGACY CHECKOUT CARD (Simple version)
   ======================================== */
.checkout-card {
  background-color: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.checkout-product {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.checkout-product-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background-color: var(--color-gray-200);
}

.checkout-product-info h3 {
  font-size: var(--text-base);
  margin-bottom: var(--space-1);
}

.checkout-product-price {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.checkout-body {
  padding: var(--space-6);
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
  margin-bottom: var(--space-6);
  border-top: 2px solid var(--color-gray-200);
  border-bottom: 2px solid var(--color-gray-200);
}

.checkout-total-label {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.checkout-total-amount {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   FADE-IN ANIMATION
   Scroll-triggered reveal (applied by main.js)
   ======================================== */
.fade-in-element {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in-element.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   UTILITY CLASSES
   Common inline style replacements
   ======================================== */

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Flex utilities */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Grid layouts */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.grid-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Spacing utilities */
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: 8px; }
.pt-6 { padding-top: 24px; }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* Border utilities */
.border-top { border-top: 1px solid var(--color-gray-200); }

/* Section divider */
.section-divider {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-gray-200);
}

.section-divider h3 {
  margin-bottom: 16px;
}

.section-divider .section-description {
  margin-bottom: 16px;
  font-size: var(--text-sm);
  color: var(--color-gray-600);
}

/* ========================================
   RECENT ORDERS (Dashboard)
   ======================================== */
.recent-orders {
  margin-bottom: var(--space-8);
}

.recent-orders-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.recent-orders-header h2 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin: 0;
}

.recent-orders-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-xl);
  background: var(--color-white);
}

/* Orders Table Styles (shared between dashboard and orders page) */
.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-gray-200);
  background-color: var(--color-gray-50);
}

.orders-table td {
  padding: 12px 16px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-gray-100);
}

.orders-table tr:last-child td {
  border-bottom: none;
}

.orders-table tr:hover td {
  background-color: var(--color-gray-50);
}

/* Table cell modifiers */
.orders-table td strong {
  font-weight: var(--font-semibold);
}

/* No data message */
.table-empty-message {
  text-align: center;
  padding: 2rem;
  color: var(--color-gray-500);
}

.table-error-message {
  text-align: center;
  padding: 2rem;
  color: var(--color-error);
}

/* Info list */
.info-list {
  list-style: disc;
  padding-left: 1.25rem;
  line-height: 1.8;
}

/* Disc list (common marketing pages) */
.disc-list {
  list-style: disc;
  margin-left: 1.5rem;
  color: var(--color-gray-700);
  line-height: 1.8;
}

/* Image placeholder box */
.img-placeholder {
  background: var(--color-gray-100);
  border-radius: var(--radius-xl);
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-500);
}
.img-placeholder--sm {
  height: 300px;
}

/* Center a block element (replaces margin: 0 auto inline) */
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Badge spacing (use-case heroes) */
.badge-spaced {
  margin-bottom: var(--space-4);
}

/* Testimonial centered variant */
.testimonial--centered {
  padding: var(--space-16);
  text-align: center;
}
.testimonial-quote--lg {
  font-size: var(--text-xl);
}
.testimonial-author--centered {
  justify-content: center;
  margin-top: var(--space-8);
}
.testimonial-author-name--lg {
  font-size: var(--text-lg);
}

/* Dark section stats (white text on dark bg) */
.stat-value--light {
  color: white;
}
.stat-label--light {
  color: var(--color-gray-200);
}

/* Inverted CTA button (white on dark bg) */
.btn--inverted {
  background: white;
  color: var(--color-primary);
}

/* Light outline button (on dark bg) */
.btn-outline--light {
  color: white;
  border-color: white;
}

/* Centered feature card icon */
.feature-card-icon--centered {
  margin: 0 auto 1rem;
}

/* Terms acknowledgment footer */
.terms-acknowledgment {
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-gray-200);
  font-size: var(--font-size-sm);
  color: var(--color-gray-600);
}

/* ========================================
   HEADER USER NAV
   Right-side header actions on app pages
   ======================================== */
.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.header-user span {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
}

/* ========================================
   EXTENDED UTILITY CLASSES
   ======================================== */

/* Layout */
.py-24 { padding-top: 96px; padding-bottom: 96px; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; min-width: 0; }
.w-full { width: 100%; }
.gap-2 { gap: 8px; }

/* Spacing */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; }

/* Typography */
.text-xs { font-size: var(--text-xs); }
.text-gray-500 { color: var(--color-gray-500); }
.text-gray-600 { color: var(--color-gray-600); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Backgrounds & surfaces */
.bg-gray-50 { background-color: var(--color-gray-50); }

/* Shapes */
.p-2 { padding: 8px; }
.rounded-lg { border-radius: var(--radius-lg); }

/* ========================================
   LOADING STATE
   Shared spinner + loading indicator
   ======================================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  color: var(--color-gray-500);
  gap: var(--space-4);
}

.loading-state .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========================================
   EMPTY STATE
   No-data placeholder for lists/tables
   ======================================== */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  background-color: var(--color-gray-50);
  border-radius: var(--radius-xl);
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  color: var(--color-gray-500);
  margin-bottom: var(--space-6);
}

/* ========================================
   STATUS BADGES
   Reusable status indicator pills
   ======================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: currentColor;
}

.status-active,
.status-completed,
.status-succeeded {
  background-color: var(--color-success-bg);
  color: var(--color-success-dark);
}

.status-draft,
.status-refunded {
  background-color: var(--color-gray-100);
  color: var(--color-gray-600);
}

.status-inactive {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-dark);
}

.status-pending {
  background-color: var(--color-info-bg);
  color: var(--color-info-dark);
}

.status-cancelled,
.status-failed {
  background-color: var(--color-error-bg);
  color: var(--color-error-dark);
}

.status-processing {
  background-color: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

/* ========================================
   DARK PAGE HERO
   Common hero styling for marketing pages
   ======================================== */
.contact-hero,
.category-hero,
.inspiration-hero,
.pricing-hero,
.resources-hero {
  padding: 140px 0 80px;
  text-align: center;
}

.contact-hero h1,
.category-hero h1,
.inspiration-hero h1,
.pricing-hero h1,
.resources-hero h1 {
  font-size: 52px;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.contact-hero p,
.category-hero p,
.inspiration-hero p,
.pricing-hero p,
.resources-hero p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  max-width: 680px;
  margin: 0 auto 24px;
}

/* ========================================
   HERO ACTIONS
   Button row in hero sections
   ======================================== */
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========================================
   DARK SECTION ALT
   Alternating section backgrounds
   ======================================== */
.section-alt,
.inspiration-section-alt,
.pricing-section-alt,
.resources-section-alt {
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ========================================
   DARK CARD
   Common card for dark-themed pages
   ======================================== */
.dark-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 28px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.dark-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 140, 0, 0.5);
}

.dark-card h4 {
  color: white;
  font-size: 18px;
  margin-bottom: 10px;
}

.dark-card p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  line-height: 1.6;
}

/* ========================================
   DARK FORM INPUT
   Form inputs on dark backgrounds
   ======================================== */
.dark-form-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dark-form-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.dark-form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.15);
}

/* ========================================
   DIVIDER TEXT
   Horizontal divider with centered text
   ======================================== */
.divider-text,
.checkout-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--color-gray-500);
  font-size: var(--text-sm);
}

.divider-text::before,
.divider-text::after,
.checkout-divider::before,
.checkout-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--color-gray-200);
}
