/* ============================================
   Gajanand Kripa — Loyalty Points Design System
   Jaipur block-print inspired palette
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Core palette */
  --indigo-deep: #0d1b3e;
  --indigo-dark: #152149;
  --indigo-mid: #1a2d5a;
  --indigo-light: #243b6e;
  --indigo-accent: #2e4f8f;

  --madder-deep: #8b1a1a;
  --madder: #b71c1c;
  --madder-light: #d32f2f;
  --madder-glow: #ef5350;

  --cream: #faf3e0;
  --cream-warm: #f5eed6;
  --cream-muted: #e8dcc8;

  --gold: #c9a96e;
  --gold-light: #dbbf88;
  --gold-dark: #a88a4e;

  /* Semantic */
  --bg-primary: var(--indigo-deep);
  --bg-card: var(--indigo-dark);
  --bg-card-hover: var(--indigo-mid);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);

  --text-primary: var(--cream);
  --text-secondary: var(--cream-muted);
  --text-accent: var(--gold-light);
  --text-muted: rgba(250, 243, 224, 0.5);

  --border-subtle: rgba(201, 169, 110, 0.15);
  --border-accent: rgba(201, 169, 110, 0.3);
  --border-strong: var(--gold);

  --success: #4caf50;
  --success-bg: rgba(76, 175, 80, 0.12);
  --error: #ef5350;
  --error-bg: rgba(239, 83, 80, 0.12);
  --warning: #ff9800;
  --warning-bg: rgba(255, 152, 0, 0.12);
  --info: var(--indigo-accent);

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow-gold: 0 0 20px rgba(201, 169, 110, 0.15);
  --shadow-glow-madder: 0 0 20px rgba(183, 28, 28, 0.2);

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

/* ---------- Reset / Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Block-print inspired background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  background-image:
    radial-gradient(circle at 25% 25%, var(--gold) 1px, transparent 1px),
    radial-gradient(circle at 75% 75%, var(--madder) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout ---------- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  min-height: 100vh;
}

.admin-container {
  max-width: 960px;
}

/* ---------- Header ---------- */
.app-header {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-lg);
  position: relative;
}

.app-header::after {
  content: '';
  display: block;
  width: 120px;
  height: 2px;
  margin: var(--space-md) auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-subtitle {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: var(--space-xs);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--madder), var(--gold), var(--madder));
  opacity: 0.6;
}

.card:hover {
  border-color: var(--border-accent);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-accent);
  margin-bottom: var(--space-md);
  letter-spacing: 0.02em;
}

/* Points card special styling */
.points-card {
  text-align: center;
  background: linear-gradient(135deg, var(--indigo-dark), var(--indigo-mid));
  border-color: var(--border-accent);
}

.points-value {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
  margin: var(--space-sm) 0;
  text-shadow: 0 2px 12px rgba(201, 169, 110, 0.3);
}

.points-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.customer-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: var(--space-xs);
}

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

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

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

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Phone input with +91 prefix */
.phone-input-group {
  display: flex;
  align-items: stretch;
}

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  background: rgba(201, 169, 110, 0.1);
  border: 1px solid var(--border-subtle);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-accent);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.phone-input-group .form-input {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* OTP input */
.otp-input-group {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.otp-digit {
  width: 3rem;
  height: 3.5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-body);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--gold-light);
  transition: all var(--transition-fast);
  outline: none;
}

.otp-digit:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
  background: var(--bg-input-focus);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

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

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn:not(:disabled):active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--madder), var(--madder-deep));
  color: var(--cream);
  box-shadow: var(--shadow-glow-madder);
}

.btn-primary:not(:disabled):hover {
  background: linear-gradient(135deg, var(--madder-light), var(--madder));
  box-shadow: 0 0 30px rgba(183, 28, 28, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--gold-light);
  border: 1px solid var(--border-accent);
}

.btn-secondary:not(:disabled):hover {
  background: rgba(201, 169, 110, 0.08);
  border-color: var(--gold);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--indigo-deep);
  box-shadow: var(--shadow-glow-gold);
}

.btn-gold:not(:disabled):hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid rgba(239, 83, 80, 0.3);
}

.btn-danger:not(:disabled):hover {
  background: var(--error-bg);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

/* Button loading spinner */
.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(255, 152, 0, 0.2);
}

.badge-gift-given {
  background: rgba(33, 150, 243, 0.12);
  color: #64b5f6;
  border: 1px solid rgba(33, 150, 243, 0.2);
}

.badge-otp-sent {
  background: rgba(156, 39, 176, 0.12);
  color: #ce93d8;
  border: 1px solid rgba(156, 39, 176, 0.2);
}

.badge-completed {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.2);
}

.badge-cancelled {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 83, 80, 0.2);
}

.badge-expired {
  background: rgba(158, 158, 158, 0.12);
  color: #9e9e9e;
  border: 1px solid rgba(158, 158, 158, 0.2);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Transaction List ---------- */
.tx-list {
  list-style: none;
}

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.tx-item:last-child {
  border-bottom: none;
}

.tx-info {
  flex: 1;
}

.tx-type {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tx-type-earn {
  color: var(--success);
}

.tx-type-redeem {
  color: var(--madder-light);
}

.tx-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tx-points {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.tx-points-positive {
  color: var(--success);
}

.tx-points-negative {
  color: var(--madder-light);
}

.tx-amount {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

/* ---------- Redemption States ---------- */
.redeem-section {
  margin-top: var(--space-md);
}

.redeem-status {
  text-align: center;
  padding: var(--space-md);
}

.redeem-status-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.redeem-status-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Countdown timer */
.countdown {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
  text-align: center;
  margin: var(--space-sm) 0;
  font-variant-numeric: tabular-nums;
}

.countdown-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Messages ---------- */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: var(--space-md);
  border: 1px solid;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(239, 83, 80, 0.2);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(76, 175, 80, 0.2);
}

.alert-info {
  background: rgba(33, 150, 243, 0.08);
  color: #90caf9;
  border-color: rgba(33, 150, 243, 0.2);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(255, 152, 0, 0.2);
}

/* ---------- Loading / Skeleton ---------- */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  gap: var(--space-md);
}

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

.loading-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 25%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  opacity: 0.3;
}

.empty-state-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Admin Table ---------- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-accent);
}

.admin-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(201, 169, 110, 0.03);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-lg);
}

.tab {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-elevated);
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
  margin: var(--space-lg) 0;
}

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

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.hidden { display: none !important; }

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .app-container {
    padding: var(--space-sm);
  }

  .brand-name {
    font-size: 1.6rem;
  }

  .points-value {
    font-size: 2.8rem;
  }

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

@media (min-width: 768px) {
  .admin-container {
    padding: var(--space-xl);
  }
}

/* ---------- Stat Cards Grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.7;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.stat-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ---------- Excel Upload Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--gold);
  background: rgba(201, 169, 110, 0.06);
  box-shadow: var(--shadow-glow-gold);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: block;
  opacity: 0.85;
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 0.35rem;
}

.dropzone-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ---------- Progress Bar ---------- */
.progress-container {
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  height: 14px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  border-radius: 100px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(201, 169, 110, 0.4);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ---------- Large Modal (Customer Details) ---------- */
.modal-lg {
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.5rem;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--cream);
}

.modal-body {
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* ---------- Summary Pill Badges ---------- */
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--cream-muted);
}

.pill-badge-success {
  background: var(--success-bg);
  border-color: rgba(76, 175, 80, 0.3);
  color: #81c784;
}

.pill-badge-warning {
  background: var(--warning-bg);
  border-color: rgba(255, 152, 0, 0.3);
  color: #ffb74d;
}

.pill-badge-danger {
  background: var(--error-bg);
  border-color: rgba(239, 83, 80, 0.3);
  color: #e57373;
}

.pill-badge-gold {
  background: rgba(201, 169, 110, 0.12);
  border-color: rgba(201, 169, 110, 0.35);
  color: var(--gold-light);
}

/* Table scroll wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

/* ---------- Enhanced Search Bar & Badge ---------- */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}

.search-clear-btn:hover {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.1);
}

.search-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  background: rgba(201, 169, 110, 0.12);
  border: 1px solid rgba(201, 169, 110, 0.3);
  color: var(--gold-light);
  margin-bottom: 0.75rem;
}

.search-badge-clear {
  background: none;
  border: none;
  color: var(--gold-light);
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.2rem;
  text-decoration: underline;
  font-size: 0.75rem;
}

/* ---------- Sortable Table Headers ---------- */
.table-sortable th[data-sort] {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.table-sortable th[data-sort]:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold-light);
}

.sort-icon {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

th[data-sort].sort-active {
  color: var(--gold-light);
  border-bottom: 2px solid var(--gold);
}

th[data-sort].sort-active .sort-icon {
  opacity: 1;
  color: var(--gold-light);
}

/* ---------- Robust Pagination Bar ---------- */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(13, 27, 62, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

.pagination-info {
  font-size: 0.825rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pagination-info strong {
  color: var(--cream);
  font-weight: 600;
}

.pagination-controls-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--cream-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(201, 169, 110, 0.15);
  border-color: rgba(201, 169, 110, 0.4);
  color: var(--gold-light);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.05);
}

.pagination-btn.active {
  background: var(--gold);
  border-color: var(--gold-light);
  color: #0d1b3e;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(201, 169, 110, 0.35);
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pagination-size-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-size-select {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 6px;
  background: var(--navy-dark);
  border: 1px solid var(--border-subtle);
  color: var(--cream);
  cursor: pointer;
}

.pagination-jump-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-jump-input {
  width: 3.5rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  text-align: center;
  border-radius: 6px;
  background: var(--navy-dark);
  border: 1px solid var(--border-subtle);
  color: var(--cream);
}

