/* ===================================
   Luxury Gift Redemption - Design System
   =================================== */

/* CSS Custom Properties (Design Tokens) */
:root {
  /* Color Palette - Elegant & Luxurious */
  --color-primary: #1a1a2e;          /* Deep navy */
  --color-primary-light: #2d2d44;    /* Lighter navy */
  --color-accent: #c9a961;           /* Elegant gold */
  --color-accent-dark: #b89750;      /* Darker gold */
  --color-background: #f8f6f2;       /* Warm off-white */
  --color-surface: #ffffff;          /* Pure white */
  --color-text: #2c2c2c;            /* Rich charcoal */
  --color-text-muted: #757575;      /* Muted gray */
  --color-success: #2d5f3f;         /* Forest green */
  --color-error: #a83232;           /* Deep red */

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing Scale */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;     /* 16px */
  --space-md: 1.5rem;   /* 24px */
  --space-lg: 2rem;     /* 32px */
  --space-xl: 3rem;     /* 48px */
  --space-2xl: 4rem;    /* 64px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Base Styles
   =================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-background);
  line-height: 1.6;
  min-height: 100vh;
}

/* Import elegant fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ===================================
   Typography
   =================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-primary);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-sm);
  color: var(--color-text-muted);
}

.subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  font-weight: 300;
  margin-top: calc(var(--space-sm) * -1);
  margin-bottom: var(--space-lg);
}

/* ===================================
   Layout
   =================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.container-narrow {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.header {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: var(--color-surface);
  margin-bottom: var(--space-2xl);
}

.header h1 {
  color: var(--color-surface);
  margin-bottom: var(--space-sm);
}

.header .subtitle {
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-style: italic;
}

/* ===================================
   Cards & Surfaces
   =================================== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* ===================================
   Gift Cards
   =================================== */

.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.gift-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  border: 3px solid transparent;
}

.gift-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.gift-card.selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.2);
}

.gift-card-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 3rem;
}

.gift-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-card-content {
  padding: var(--space-md);
}

.gift-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
}

.gift-card-description {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.gift-card-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: var(--color-accent);
  color: var(--color-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
}

/* ===================================
   Forms
   =================================== */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
  font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm);
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all var(--transition-fast);
  background: var(--color-surface);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-error);
}

.form-error {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
  display: none;
}

.form-error.show {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* ===================================
   Buttons
   =================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 48px; /* Touch-friendly */
  gap: var(--space-xs);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: var(--color-surface);
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* ===================================
   Alerts & Messages
   =================================== */

.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  border-left: 4px solid;
}

.alert-success {
  background: #e8f5e9;
  border-color: var(--color-success);
  color: var(--color-success);
}

.alert-error {
  background: #ffebee;
  border-color: var(--color-error);
  color: var(--color-error);
}

.alert-info {
  background: #e3f2fd;
  border-color: #1976d2;
  color: #1565c0;
}

/* ===================================
   Loading States
   =================================== */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(201, 169, 97, 0.3);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(201, 169, 97, 0.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ===================================
   Utility Classes
   =================================== */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-accent {
  color: var(--color-accent);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.divider {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--color-accent) 50%, transparent 100%);
  margin: var(--space-xl) 0;
}

.privacy-notice {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  background: #f5f5f5;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-accent);
  margin: var(--space-lg) 0;
}

/* ===================================
   Admin Interface
   =================================== */

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.admin-tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: var(--space-xl);
  overflow-x: auto;
}

.admin-tab {
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.admin-tab:hover {
  color: var(--color-accent);
}

.admin-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

.data-table th {
  background: var(--color-primary);
  color: var(--color-surface);
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid #e0e0e0;
}

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

.data-table tr:hover {
  background: var(--color-background);
}

.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: #e8f5e9;
  color: var(--color-success);
}

.badge-pending {
  background: #fff3e0;
  color: #e65100;
}

.badge-admin {
  background: #e3f2fd;
  color: #1565c0;
}

/* ===================================
   Success Screen
   =================================== */

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  background: linear-gradient(135deg, var(--color-success) 0%, #1e4d2f 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
  box-shadow: var(--shadow-lg);
}

.success-content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .container {
    padding: var(--space-md);
  }

  .header {
    padding: var(--space-xl) var(--space-md);
  }

  .gift-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .gift-card-image {
    height: 200px;
  }

  .data-table {
    font-size: 0.875rem;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-sm);
  }
}

/* ===================================
   Accessibility
   =================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
