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

[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  color: #1a1a1a;
  background: #fafafa;
}

header {
  text-align: center;
  padding: 2rem 0 1rem;
}

header h1 {
  color: #003366;
  font-size: 1.5rem;
}

header p {
  color: #666;
  margin-top: 0.5rem;
}

main {
  margin-top: 1.5rem;
}

.filter-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-group {
  flex: 1;
}

.filter-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: #444;
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.875rem;
}

#nearby-btn {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #003366;
  border-radius: 4px;
  background: white;
  color: #003366;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.2rem;
}

#nearby-btn:hover {
  background: #f0f4f8;
}

#nearby-btn.active {
  background: #003366;
  color: white;
}

.selection-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .filter-row { flex-direction: column; }
  .selection-panels { grid-template-columns: 1fr; }
}

.panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
}

.panel h2 {
  font-size: 1rem;
  color: #003366;
  margin-bottom: 0.25rem;
}

.panel .hint {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.75rem;
}

.panel select {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8125rem;
}

.panel select option {
  padding: 0.25rem;
}

.selected-badge {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: #003366;
  color: white;
  border-radius: 4px;
  font-size: 0.8125rem;
  display: inline-block;
}

.selected-badges {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.5rem;
  background: #e8f0fe;
  color: #003366;
  border-radius: 4px;
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge button {
  background: none;
  border: none;
  color: #003366;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.125rem;
}

#result {
  margin-top: 2rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
}

#result h2 {
  font-size: 1.125rem;
  color: #003366;
  margin-bottom: 1rem;
}

.url-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.url-box input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: monospace;
  background: #f5f5f5;
}

.url-box button {
  padding: 0.5rem 1rem;
  background: #003366;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
}

.url-box button:hover {
  background: #004488;
}

.subscribe-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  text-align: center;
}

.btn-google {
  background: #003366;
  color: white;
}

.btn-google:hover {
  background: #004488;
}

.btn-apple {
  background: #333;
  color: white;
}

.btn-apple:hover {
  background: #444;
}

.mobile-toast {
  background: #e8f4e8;
  border: 1px solid #4caf50;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.mobile-toast a {
  color: #003366;
  font-weight: 600;
}

details {
  margin-top: 0.5rem;
}

details summary {
  cursor: pointer;
  color: #003366;
  font-size: 0.875rem;
}

details ol {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
  font-size: 0.8125rem;
  color: #555;
  line-height: 1.6;
}

/* Calendar event preview */
.cal-preview {
  margin-bottom: 1.5rem;
}

.cal-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cal-preview-label {
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-preview-loading {
  font-size: 0.75rem;
  color: #003366;
  animation: pulse 1s ease-in-out infinite;
}

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

.cal-event {
  display: flex;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cal-event-color {
  width: 6px;
  flex-shrink: 0;
  background: #039be5;
}

.cal-event-body {
  padding: 1rem 1.25rem;
  flex: 1;
  min-width: 0;
}

.cal-event-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.375rem;
}

.cal-event-date {
  font-size: 0.8125rem;
  color: #5f6368;
  margin-bottom: 0.25rem;
}

.cal-event-location {
  font-size: 0.8125rem;
  color: #5f6368;
  margin-bottom: 0.75rem;
}

.cal-event-desc {
  font-size: 0.8125rem;
  color: #3c4043;
  line-height: 1.5;
}

.cal-event-text {
  margin-bottom: 0.5rem;
}

.cal-event-text a {
  color: #1a73e8;
  text-decoration: none;
}

.cal-event-text a:hover {
  text-decoration: underline;
}

.cal-event-backups-header {
  font-weight: 600;
  color: #5f6368;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e8eaed;
}

.cal-event-backup-line {
  font-size: 0.8125rem;
  color: #3c4043;
  padding: 0.125rem 0;
}

/* Navigation */
.nav-links {
  margin-top: 0.5rem;
}

.nav-links a {
  color: #003366;
  font-size: 0.875rem;
  text-decoration: none;
  margin: 0 0.5rem;
}

.nav-links a:hover {
  text-decoration: underline;
}

/* Flavor autocomplete dropdown */
.flavor-input-wrap {
  position: relative;
}

.flavor-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.flavor-option {
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.flavor-option:hover {
  background: #f0f4f8;
}

/* Map page */
#map-container {
  margin: 1rem 0;
}

#map {
  height: 400px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.location-row {
  display: flex;
  gap: 0.5rem;
}

.location-row input {
  flex: 1;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  color: #003366;
}

.icon-btn:hover {
  background: #f0f4f8;
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-search {
  width: 100%;
  padding: 0.5rem 1.5rem;
  background: #003366;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}

.btn-search:hover {
  background: #004488;
}

.btn-search:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.filter-group-btn {
  flex: 0 0 auto;
}

/* Brand filter chips */
.brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.brand-chip {
  padding: 0.375rem 0.875rem;
  border: 1.5px solid #ccc;
  border-radius: 999px;
  background: white;
  color: #444;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.brand-chip:hover {
  border-color: #999;
}

.brand-chip.active {
  color: white;
  border-color: transparent;
}

/* Suggestions panel */
#suggestions-panel {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.suggestion-link {
  background: none;
  border: none;
  color: #003366;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.875rem;
  padding: 0;
  margin: 0 0.25rem;
}

.suggestion-link:hover {
  color: #004488;
}

/* Results list */
#results-list {
  margin-top: 1rem;
}

.results-group {
  margin-bottom: 1.5rem;
}

.results-group-title {
  font-size: 0.9375rem;
  color: #444;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #eee;
}

.match-title {
  color: #2e7d32;
}

.store-card {
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.store-card-match {
  border-left: 4px solid #2e7d32;
}

/* Brand color left borders */
.brand-culvers { border-left: 4px solid #003366; }
.brand-kopps { border-left: 4px solid #000000; }
.brand-gilles { border-left: 4px solid #EBCC35; }
.brand-hefners { border-left: 4px solid #93BE46; }
.brand-kraverz { border-left: 4px solid #CE742D; }
.brand-oscars { border-left: 4px solid #BC272C; }

.store-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.store-card-name {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 0.9375rem;
}

.store-card-rank {
  font-size: 0.75rem;
  color: #999;
}

.store-card-address {
  font-size: 0.8125rem;
  color: #666;
  margin-top: 0.125rem;
}

.store-card-flavor {
  font-size: 0.875rem;
  color: #003366;
  font-weight: 500;
  margin-top: 0.25rem;
}

.store-card-description {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.store-card-link {
  font-size: 0.75rem;
  color: #003366;
  margin-top: 0.25rem;
  text-decoration: none;
}

.store-card-link:hover {
  text-decoration: underline;
}

.popup-match {
  background: #2e7d32;
  color: white;
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 700;
  vertical-align: middle;
}

.error-msg {
  color: #c00;
  padding: 1rem;
  text-align: center;
}

.no-results {
  color: #666;
  padding: 1rem;
  text-align: center;
}

@media (max-width: 600px) {
  #map { height: 300px; }
  .filter-group-btn { flex: 1; }
}

footer {
  margin-top: 3rem;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  border-top: 1px solid #eee;
}

footer a {
  color: #003366;
}
