:root {
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --secondary: #1f2937;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== HEADER ===== */
header {
  text-align: center;
  padding: 40px 20px;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* ===== LAST UPDATED ===== */
.last-updated {
  text-align: center;
  padding: 8px 16px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 16px;
  display: inline-block;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* ===== METRICS BUTTON & PANEL ===== */
#metrics-toggle {
  margin-bottom: 16px;
  width: auto;
  padding: 10px 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.metrics-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.metrics-panel.hidden {
  display: none;
}

.metrics-panel h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.metric-source {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
}

.metric-source.active {
  border-left: 4px solid var(--success);
}

.metric-source.struggling {
  border-left: 4px solid #f59e0b;
}

.metric-source.new {
  border-left: 4px solid var(--text-light);
}

.metric-name {
  font-weight: 500;
}

.metric-tech {
  font-size: 0.75rem;
  color: var(--text-light);
}

.metric-stats {
  text-align: right;
}

.metric-success {
  font-weight: 600;
  color: var(--success);
}

.metric-items {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ===== STATS BAR (DESKTOP) ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.stat {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== FILTERS ===== */
.filters {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-light);
}

select, .btn-secondary {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--card-bg);
  cursor: pointer;
}

.btn-secondary {
  background: var(--secondary);
  color: white;
  border: none;
  font-weight: 500;
}

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

.location-status {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.location-status.hidden {
  display: none;
}

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

.tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--primary-dark);
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.venue-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.venue-type {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.venue-type.brewery {
  background: #fef3c7;
  color: #92400e;
}

.venue-type.bar {
  background: #e0e7ff;
  color: #3730a3;
}

.venue-address {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.venue-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-light);
}

.distance {
  color: var(--success);
  font-weight: 500;
}

.reason {
  background: #fef3c7;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #92400e;
  margin-bottom: 16px;
}

/* ===== BEER LIST ===== */
.beer-list {
  margin-top: 16px;
}

.beer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
}

.beer-info {
  flex: 1;
}

.beer-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.beer-details {
  font-size: 0.875rem;
  color: var(--text-light);
}

.beer-time {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 500;
  margin-top: 4px;
}

.beer-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--primary);
  color: white;
}

.posts-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.posts-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-light);
}

.post-content {
  font-size: 0.9rem;
  color: var(--text);
  padding: 12px;
  background: #f3f4f6;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.post-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.post-text {
  margin-bottom: 4px;
}

/* ===== BEER CARD (NEW RELEASES TAB) ===== */
.beer-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

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

.beer-style {
  display: inline-block;
  padding: 4px 12px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.abv {
  color: var(--text-light);
  font-size: 0.9rem;
}

.brewery-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 500;
}

.brewery-link:hover {
  text-decoration: underline;
}

.new-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--success);
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 8px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ============================================
   MOBILE RESPONSIVE (Portrait < 768px)
   ============================================ */
@media (max-width: 767px) {
  html {
    font-size: 14px;
  }
  
  .container {
    padding: 12px;
    max-width: 100%;
  }
  
  /* Header */
  header {
    padding: 20px 12px;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
  
  /* Stats Bar - 2x2 Grid on mobile */
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }
  
  .stat {
    padding: 12px 8px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
  
  /* Filters - Stack vertically */
  .filters {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }
  
  .filter-group {
    min-width: 100%;
  }
  
  /* Bottom Nav for Mobile (instead of top tabs) */
  .tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    border-bottom: none;
    margin: 0;
    padding: 8px 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    justify-content: space-around;
  }
  
  .tab {
    flex: 1;
    padding: 8px 4px;
    font-size: 0.75rem;
    border-bottom: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  
  .tab::before {
    font-size: 1.25rem;
  }
  
  /* Hide text labels on small mobile, show only icons */
  .tab .tab-label {
    display: none;
  }
  
  .tab .tab-icon {
    font-size: 1.5rem;
  }
  
  .tab.active {
    border-bottom: none;
    color: var(--primary-dark);
    background: rgba(245, 158, 11, 0.1);
  }
  
  /* Add padding to content for bottom nav */
  .tab-content {
    padding-bottom: 80px;
  }
  
  /* Cards - More compact */
  .card {
    padding: 16px;
    margin-bottom: 12px;
  }
  
  .card-header {
    flex-direction: column;
    gap: 8px;
  }
  
  .venue-name {
    font-size: 1.1rem;
  }
  
  .venue-meta {
    flex-direction: column;
    gap: 4px;
  }
  
  /* Beer items - Stack on mobile */
  .beer-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .beer-badge {
    align-self: flex-end;
  }
  
  /* Metrics panel */
  .metrics-panel {
    padding: 16px;
  }
  
  .metric-source {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .metric-stats {
    text-align: left;
    width: 100%;
  }
  
  /* Footer - Add space for bottom nav */
  footer {
    padding-bottom: 100px;
  }
}

/* ============================================
   TABLET (768px - 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    max-width: 100%;
    padding: 16px;
  }
  
  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .filters {
    flex-wrap: wrap;
  }
  
  .filter-group {
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
  }
}

/* ============================================
   LANDSCAPE MOBILE (< 900px height)
   ============================================ */
@media (max-height: 600px) and (orientation: landscape) {
  header {
    padding: 12px;
  }
  
  header h1 {
    font-size: 1.25rem;
  }
  
  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  
  .stat {
    padding: 8px;
  }
  
  .stat-value {
    font-size: 1.25rem;
  }
  
  .tabs {
    padding: 4px 0;
  }
  
  .tab {
    padding: 6px 4px;
    font-size: 0.7rem;
  }
}

/* ============================================
   LARGE SCREENS (> 1200px)
   ============================================ */
@media (min-width: 1200px) {
  .container {
    max-width: 1100px;
  }
  
  header h1 {
    font-size: 3rem;
  }
  
  .card {
    padding: 28px;
  }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --card-bg: #1f2937;
    --text: #f9fafb;
    --text-light: #9ca3af;
    --border: #374151;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .tabs,
  .filters,
  #metrics-toggle,
  .location-status {
    display: none !important;
  }
  
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

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

/* Touch-friendly tap targets */
@media (pointer: coarse) {
  .tab,
  .btn-secondary,
  select {
    min-height: 44px;
  }
  
  .beer-item,
  .card {
    cursor: pointer;
  }
}
