:root {
  --primary-blue: #0067B1;
  --primary-green: #008A5E;
  --primary-red: #EE2534;
  --primary-amber: #F47B20;
  --primary-purple: #54075B;

  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .brand-title {
  font-family: 'Fredoka', cursive, sans-serif;
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 60px 24px;
}

/* NAVBAR */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

/* USER PROFILE BAR (COOKIE PERSISTENT) */
.user-profile-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 16px;
  transition: all 0.2s ease;
}

.profile-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-badge {
  width: 40px;
  height: 40px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: var(--primary-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.profile-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.profile-email-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-blue);
}

.profile-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.profile-prompt-title {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.profile-prompt-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.profile-right {
  display: flex;
  align-items: center;
}

.profile-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-input-wrapper input {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  outline: none;
  width: 260px;
  max-width: 100%;
}

.profile-input-wrapper input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 103, 177, 0.12);
}

.profile-empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  margin: 10px 0;
}

.empty-icon {
  font-size: 38px;
  margin-bottom: 12px;
}

.profile-empty-state h3 {
  font-size: 18px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.profile-empty-state p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  font-size: 34px;
  background: #eff6ff;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.badge-location {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  background: #fef2f2;
  color: var(--primary-red);
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid #fee2e2;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* SCHEDULE PILL */
.schedule-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 8px 14px;
  border-radius: 30px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--primary-green);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(0, 138, 94, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 138, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 138, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 138, 94, 0); }
}

.schedule-text {
  display: flex;
  flex-direction: column;
}

.schedule-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: #166534;
}

.schedule-time {
  font-size: 12px;
  font-weight: 700;
  color: #14532d;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-blue);
  color: white;
}

.btn-primary:hover {
  background: #005694;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-order {
  background: var(--primary-red);
  color: white;
}

.btn-order:hover {
  background: #d61826;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.icon {
  width: 18px;
  height: 18px;
}

.spinning {
  animation: spin 1s linear infinite;
}

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

/* TABS */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 2px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -4px;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

.tab-badge {
  background: #dbeafe;
  color: var(--primary-blue);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
}

.tab-badge.badge-neutral {
  background: #f1f5f9;
  color: #64748b;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-in;
}

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

/* HIGHLIGHTS & INTERACTIVE FILTER STAT BUTTONS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  user-select: none;
  outline: none;
  font-family: inherit;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-card:active {
  transform: translateY(0);
}

.stat-card.active {
  border-color: var(--primary-blue);
  background: #f0f7ff;
  box-shadow: 0 0 0 3px rgba(0, 103, 177, 0.15), var(--shadow-sm);
}

.stat-card[data-filter="vegan"].active {
  border-color: var(--primary-green);
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(0, 138, 94, 0.15), var(--shadow-sm);
}

.stat-card[data-filter="sorbet"].active {
  border-color: #db2777;
  background: #fdf2f8;
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.15), var(--shadow-sm);
}

.stat-card[data-filter="nut-free"].active {
  border-color: #d97706;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15), var(--shadow-sm);
}

.stat-card[data-filter="gluten-free"].active {
  border-color: #7c3aed;
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15), var(--shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-blue { background: #e0f2fe; color: var(--primary-blue); }
.icon-green { background: #dcfce7; color: var(--primary-green); }
.icon-pink { background: #fce7f3; color: #db2777; }
.icon-amber { background: #fef3c7; color: #d97706; }
.icon-purple { background: #ede9fe; color: #7c3aed; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-val {
  display: block;
  font-size: 22px;
  font-weight: 800;
  font-family: 'Fredoka', sans-serif;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* SEARCH BAR */
.search-container {
  margin-bottom: 24px;
}

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

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.search-box input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 103, 177, 0.15);
}

.clear-search {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

/* FLAVOR GRID */
.flavor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.flavor-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
}

.flavor-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.flavor-img-wrapper {
  height: 180px;
  width: 100%;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.flavor-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.flavor-card:hover .flavor-img {
  transform: scale(1.04);
}

.flavor-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.flavor-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  text-transform: uppercase;
}

.tag-vegan { background: #dcfce7; color: #166534; }
.tag-sorbet { background: #fee2e2; color: #991b1b; }
.tag-alcohol { background: #fef3c7; color: #92400e; }

.flavor-description {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 14px;
  flex: 1;
}

.flavor-allergens-box {
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid #f1f5f9;
  margin-bottom: 16px;
}

.flavor-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.btn-watch {
  width: 100%;
  background: #eff6ff;
  color: var(--primary-blue);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s;
}

.btn-watch:hover {
  background: #dbeafe;
}

.btn-watch.active-watching {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

/* INLINE WATCH TRAY INSIDE CARD (NO POPUP) */
.card-inline-watch-tray {
  display: none;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  animation: slideDown 0.2s ease-out;
}

.card-inline-watch-tray.open {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.inline-watch-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inline-watch-form {
  display: flex;
  gap: 6px;
}

.inline-watch-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 12.5px;
  outline: none;
}

.inline-watch-input:focus {
  border-color: var(--primary-blue);
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  -webkit-text-fill-color: var(--text-main) !important;
  transition: background-color 5000s ease-in-out 0s;
}

.btn-confirm-watch {
  background: var(--primary-green);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-confirm-watch:hover {
  background: #00704d;
}

/* SUBSCRIBERS / WATCHLIST TAB */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* INLINE FORM CARD ON TAB 2 (NO POPUP) */
.inline-form-card {
  background: var(--card-bg);
  border: 2px solid #bfdbfe;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  overflow: hidden;
  animation: slideDown 0.25s ease;
}

.inline-card-header {
  background: #eff6ff;
  padding: 14px 20px;
  border-bottom: 1px solid #dbeafe;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inline-card-header h3 {
  font-size: 17px;
  color: var(--primary-blue);
  margin: 0;
}

.btn-icon-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
}

.inline-form-body {
  padding: 20px;
}

.form-row {
  display: flex;
  gap: 14px;
}

.flex-1 {
  flex: 1;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 14px;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 103, 177, 0.12);
}

.inline-add {
  display: flex;
  gap: 8px;
}

.quick-pick-container {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px;
  background: #f8fafc;
}

.quick-pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.quick-pick-item:hover {
  background: #e2e8f0;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-removable {
  background: #dbeafe;
  color: var(--primary-blue);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-remove-tag {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary-blue);
}

.inline-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.subscribers-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.subscriber-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 14px;
}

.sub-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sub-avatar {
  width: 44px;
  height: 44px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--primary-blue);
}

.sub-name {
  font-weight: 700;
  font-size: 16px;
}

.sub-email {
  font-size: 13px;
  color: var(--text-muted);
}

.sub-watched {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 500px;
}

.watched-pill {
  background: #eff6ff;
  color: var(--primary-blue);
  border: 1px solid #dbeafe;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.sub-actions {
  display: flex;
  gap: 8px;
}

/* HISTORY TAB & INLINE EMAIL PREVIEW (NO POPUP) */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.history-header-row {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.history-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-title {
  font-weight: 700;
  font-size: 15px;
}

.history-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.inline-email-preview-drawer {
  display: none;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  padding: 16px 20px;
}

.inline-email-preview-drawer.open {
  display: block;
}

.inline-iframe-wrapper {
  width: 100%;
  height: 440px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: white;
}

.inline-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.25s ease;
}

.toast-success { background: #0f766e; }
.toast-error { background: #b91c1c; }

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

.loading-spinner {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  margin: 0 auto 12px auto;
  animation: spin 0.8s linear infinite;
}

.app-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.app-footer a {
  color: var(--primary-blue);
  text-decoration: none;
}

.footer-meta {
  font-size: 12px;
  margin-top: 4px;
}
