:root {
  --primary: #1E88E5;
  --primary-dark: #1565C0;
  --background: #f4f6fb;
  --surface: #ffffff;
  --text: #203047;
  --muted: #6b7a90;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

/* Ensure hidden sections are not displayed */
[hidden] {
  display: none !important;
}

/* Hero Header Styles */
.hero-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 3rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 200px;
}

.hero-content h1 {
  margin: 0;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 0.5rem 0 0 0;
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 400;
}

.hero-nav {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* Legacy header styles for other pages */
header {
  background: var(--surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

main {
  padding: 2rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Main Header */
.main-header {
  margin-bottom: 2rem;
  padding: 1rem 0;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.header-text h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #1E88E5;
}

.header-subtitle {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Hero Card Styles */
.hero-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 20px 40px -20px rgba(31, 71, 125, 0.3);
  margin-bottom: 2rem;
}

.hero-text {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-text h1 {
  font-size: 3rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--muted);
  margin: 0 0 2rem 0;
  font-weight: 500;
}

.hero-text h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  color: var(--text);
  line-height: 1.2;
}

.hero-description {
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--background);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px -15px rgba(31, 71, 125, 0.4);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text);
}

.feature-card p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
}

.feature-button {
  display: inline-block;
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.feature-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px rgba(30, 136, 229, 0.4);
}

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 25px -18px rgba(31, 71, 125, 0.4);
  margin-bottom: 1.5rem;
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

button.secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(30, 136, 229, 0.4);
}

button.secondary.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
}

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
  box-sizing: border-box;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 1rem;
}

.form-row.two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.table tbody tr:hover {
  background: rgba(30, 136, 229, 0.08);
}

.table tbody tr.selected {
  background: rgba(30, 136, 229, 0.18);
}

.badge {
  background: rgba(30, 136, 229, 0.12);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tabs button {
  background: rgba(30, 136, 229, 0.12);
  color: var(--primary);
}

.tabs button.active {
  background: var(--primary);
  color: #fff;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px -18px rgba(31, 71, 125, 0.45);
}

.metric-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-card .value {
  font-size: 1.8rem;
  font-weight: 700;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.message-info {
  background: rgba(30, 136, 229, 0.12);
  color: var(--primary);
}

.message-error {
  background: rgba(229, 57, 53, 0.12);
  color: #b71c1c;
}

.message-success {
  background: rgba(56, 142, 60, 0.12);
  color: #2e7d32;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.chip {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(32, 48, 71, 0.08);
  color: var(--muted);
  font-size: 0.8rem;
}

.chip.prominent {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(30, 136, 229, 0.6);
}

.customer-header {
  flex-wrap: wrap;
  gap: 1.5rem;
}

.customer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.welcome-message {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
  margin-right: 1rem;
}

.store-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: contain;
  background: rgba(30, 136, 229, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
}

.branding-preview {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.branding-preview p {
  margin: 0;
}

.admin-branding {
  align-items: flex-start;
}

.admin-branding .store-logo {
  width: 80px;
  height: 80px;
  border-radius: 18px;
}

.customer-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.stamp-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stamp-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
}

.stamp-row::-webkit-scrollbar {
  height: 8px;
}

.stamp-row::-webkit-scrollbar-thumb {
  background: rgba(32, 48, 71, 0.15);
  border-radius: 999px;
}

.stamp-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  width: 110px;
}

.stamp-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px dashed rgba(30, 136, 229, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: rgba(30, 136, 229, 0.5);
  background: #fff;
  position: relative;
  box-shadow: inset 0 0 0 3px rgba(30, 136, 229, 0.08);
}

.stamp-slot.filled .stamp-circle {
  background: rgba(30, 136, 229, 0.12);
  border-color: transparent;
  color: var(--primary);
  box-shadow: inset 0 0 0 3px rgba(30, 136, 229, 0.2);
}

.stamp-slot.redeemed .stamp-circle,
.stamp-slot.redeemed .stamp-emoji,
.stamp-slot.redeemed .stamp-date {
  filter: grayscale(1);
  opacity: 0.6;
}

.stamp-slot .stamp-emoji {
  line-height: 1;
}

.stamp-slot .stamp-emoji.heart {
  color: rgba(30, 136, 229, 0.35);
}

.stamp-slot.reward {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.stamp-slot.reward .stamp-circle {
  border-style: solid;
  border-color: rgba(30, 136, 229, 0.25);
  color: rgba(30, 136, 229, 0.4);
}

.stamp-slot.reward .stamp-emoji.gift {
  font-size: 2rem;
}

.stamp-slot.reward.ready {
  opacity: 1;
}

.stamp-slot.reward.ready .stamp-circle {
  background: rgba(30, 136, 229, 0.12);
  border-color: transparent;
  color: var(--primary);
  box-shadow: inset 0 0 0 3px rgba(30, 136, 229, 0.2);
}

.stamp-slot.reward.ready .stamp-date {
  color: var(--primary);
  font-weight: 600;
}

.stamp-slot.reward.locked {
  opacity: 0.5;
}

.stamp-slot.filled .stamp-emoji {
  color: var(--primary);
}

.stamp-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stamp-date {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2rem;
  white-space: nowrap;
}

.stamp-tier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stamp-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stamp-summary p {
  margin: 0;
}

.nested-card {
  background: rgba(32, 48, 71, 0.04);
  box-shadow: none;
}

.visit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.visit-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 24px -20px rgba(31, 71, 125, 0.6);
}

.visit-list li .visit-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.visit-list li.reward {
  border-left: 4px solid rgba(56, 142, 60, 0.6);
  background: rgba(56, 142, 60, 0.08);
}

.visit-list li.reward .visit-meta {
  color: #2e7d32;
}

/* Scan Button Styles */
.scan-section {
  text-align: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.scan-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.scan-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 136, 229, 0.4);
}

.scan-icon {
  font-size: 1.3rem;
}

.scan-help {
  margin: 1rem 0 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* QR Scanner Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--surface);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.scanner-container {
  position: relative;
  width: 100%;
  height: 400px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-frame {
  width: 250px;
  height: 250px;
  border: 3px solid var(--primary);
  border-radius: 12px;
  position: relative;
  background: transparent;
}

.scanner-frame::before,
.scanner-frame::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid var(--primary);
}

.scanner-frame::before {
  top: -3px;
  left: -3px;
  border-right: none;
  border-bottom: none;
}

.scanner-frame::after {
  bottom: -3px;
  right: -3px;
  border-left: none;
  border-top: none;
}

.scanner-instructions {
  color: white;
  margin-top: 2rem;
  text-align: center;
  font-size: 1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
}

/* Tab Navigation Styles */
.tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  margin-bottom: 0;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab-button:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

.tab-button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(30, 136, 229, 0.05);
}

.tab-content {
  margin-top: 1.5rem;
}

/* Deactivated store styles */
.deactivated {
  color: var(--muted) !important;
  text-decoration: line-through;
  opacity: 0.6;
}

.deactivate {
  background: #f44336;
  color: white;
  border-color: #f44336;
}

.deactivate:hover {
  background: #d32f2f;
  border-color: #d32f2f;
}

.activate {
  background: #4caf50;
  color: white;
  border-color: #4caf50;
}

.activate:hover {
  background: #388e3c;
  border-color: #388e3c;
}

/* Danger button styles */
.danger {
  background: #f44336;
  color: white;
  border-color: #f44336;
}

.danger:hover {
  background: #d32f2f;
  border-color: #d32f2f;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-header {
    margin-bottom: 1.5rem;
  }
  
  .header-content {
    gap: 0.75rem;
  }
  
  .header-logo {
    width: 40px;
    height: 40px;
  }
  
  .header-text h1 {
    font-size: 1.5rem;
  }
  
  .header-subtitle {
    font-size: 0.8rem;
  }
  
  .welcome-message {
    font-size: 0.8rem;
    margin-right: 0.5rem;
  }
  
  .hero-card {
    padding: 2rem 1.5rem;
  }
  
  .hero-text h1 {
    font-size: 2.5rem;
  }
  
  .hero-text h2 {
    font-size: 2rem;
  }
  
  .hero-description {
    font-size: 1.1rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
  }

  .store-logo {
    width: 60px;
    height: 60px;
    border-radius: 14px;
  }
}

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

.qr-preview {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.qr-preview img {
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem;
  box-shadow: 0 10px 24px -18px rgba(31, 71, 125, 0.4);
}

@media (max-width: 720px) {
  header,
  main {
    padding: 1.5rem 1rem;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
