/* 
 * Food Directory Tracker - CSS Design System & Theme
 * Curated Appetite Palette: Charcoal, deep slate backgrounds, glassmorphism, and warm honey accents.
 */

:root {
  /* Color Tokens */
  --bg-primary: hsl(222, 28%, 7%);
  --bg-secondary: hsl(222, 22%, 11%);
  --bg-tertiary: hsl(222, 18%, 15%);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.06);
  --card-hover-border: rgba(245, 158, 11, 0.35);
  
  --text-main: hsl(210, 20%, 98%);
  --text-muted: hsl(210, 10%, 65%);
  
  /* Accents */
  --accent: hsl(38, 96%, 53%); /* Warm Honey Orange */
  --accent-light: hsl(38, 96%, 63%);
  --accent-rgb: 245, 158, 11;
  
  --to-try: hsl(200, 95%, 48%); /* Cool Tech Blue */
  --to-try-bg: rgba(14, 165, 233, 0.12);
  --to-try-border: rgba(14, 165, 233, 0.25);
  
  --visited: hsl(142, 70%, 45%); /* Emerald Green */
  --visited-bg: rgba(16, 185, 129, 0.12);
  --visited-border: rgba(16, 185, 129, 0.25);

  --font-headers: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* Global Reset & Base Elements */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* App Header Styling */
.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--card-border);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  flex-shrink: 0;
  height: 85px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(222, 28%, 7%);
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.35);
}

.logo-text h1 {
  font-family: var(--font-headers);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.logo-text h1 span {
  color: var(--accent);
  font-weight: 800;
}

.logo-text p {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 1px;
}

/* Search and Filters Layout */
.search-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-grow: 1;
  max-width: 680px;
  justify-content: flex-end;
}

.search-bar {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-bar input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--card-border);
  border-radius: 30px;
  padding: 10px 15px 10px 40px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: all 0.25s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

/* Category Filter Navigation */
.filter-tabs {
  background-color: var(--bg-primary);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--card-border);
  display: flex;
  gap: 4px;
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 18px;
  font-family: var(--font-headers);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn i {
  font-size: 0.75rem;
}

.filter-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.02);
}

.filter-btn.active {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.filter-btn[data-filter="To Try"].active {
  color: var(--to-try);
  background-color: var(--to-try-bg);
  border: 1px solid var(--to-try-border);
}

.filter-btn[data-filter="Visited"].active {
  color: var(--visited);
  background-color: var(--visited-bg);
  border: 1px solid var(--visited-border);
}

/* On-Demand Sync Button Styles */
.sync-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 10px 18px;
  font-family: var(--font-headers);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.sync-btn:hover {
  color: var(--accent);
  border-color: var(--card-hover-border);
  background-color: rgba(245, 158, 11, 0.03);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.1);
}

.sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sync-btn i {
  font-size: 0.85rem;
}

/* Active Spin animation hook */
.spinning {
  animation: spin-kf 1s linear infinite;
  color: var(--accent) !important;
}

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

/* Mobile Navigation Controls */
.mobile-nav {
  display: none;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--card-border);
  z-index: 99;
  flex-shrink: 0;
}

.mobile-nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 14px 0;
  font-family: var(--font-headers);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mobile-nav-btn i {
  font-size: 1rem;
}

.mobile-nav-btn.active {
  color: var(--accent);
  background-color: rgba(245, 158, 11, 0.05);
}

/* Main Dashboard Split Container */
.dashboard-container {
  display: flex;
  flex-grow: 1;
  height: calc(100vh - 85px);
  overflow: hidden;
  position: relative;
}

/* Left Pane: Scrollable Card Grid */
.list-pane {
  width: 45%;
  min-width: 400px;
  max-width: 580px;
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  overflow: hidden;
}

.pane-header {
  padding: 24px 24px 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pane-header h2 {
  font-family: var(--font-headers);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.count-badge {
  background-color: var(--bg-tertiary);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-headers);
}

.restaurant-grid {
  padding: 12px 24px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

/* Right Pane: Sticky Map */
.map-pane {
  width: 55%;
  flex-grow: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
}

/* Premium Card Design Styles */
.restaurant-card {
  background-color: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.restaurant-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-hover-border);
  box-shadow: 0 10px 25px -10px rgba(var(--accent-rgb), 0.15);
  background-color: rgba(255, 255, 255, 0.05);
}

.restaurant-card.active-card {
  border-color: var(--accent);
  background-color: rgba(245, 158, 11, 0.04);
  box-shadow: 0 0 0 1px var(--accent);
}

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

.restaurant-title {
  font-family: var(--font-headers);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

/* Card title group with check button alignment */
.title-toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
}

.status-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.status-toggle-btn:hover {
  transform: scale(1.2);
  color: var(--accent);
}

.status-toggle-btn.to-try {
  color: var(--text-muted);
}

.status-toggle-btn.visited {
  color: var(--visited);
}

.status-toggle-btn.visited:hover {
  color: hsl(0, 85%, 65%); /* Red/Cancel color on hover for Visited to show "untoggle" action */
}

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

/* Badges for Cards */
.status-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 30px;
  white-space: nowrap;
  font-family: var(--font-headers);
}

.status-badge.to-try {
  color: var(--to-try);
  background-color: var(--to-try-bg);
  border: 1px solid var(--to-try-border);
}

.status-badge.visited {
  color: var(--visited);
  background-color: var(--visited-bg);
  border: 1px solid var(--visited-border);
}

/* Card details styling */
.restaurant-notes {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  font-style: italic;
  border-left: 2px solid var(--bg-tertiary);
  padding-left: 10px;
  margin: 2px 0;
}

.restaurant-address {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.restaurant-address i {
  color: var(--accent);
  width: 12px;
}

.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.website-link {
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
  z-index: 10;
}

.website-link:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

.timestamp {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Interactive Leaflet Popup Custom Styling */
.leaflet-popup-content-wrapper {
  background-color: var(--bg-secondary) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 12px !important;
  padding: 6px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-tip {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--card-border) !important;
}

.leaflet-popup-content h3 {
  font-family: var(--font-headers);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--accent);
}

.leaflet-popup-content p {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px !important;
  line-height: 1.3;
}

.leaflet-popup-content a {
  color: var(--accent);
  font-size: 0.72rem;
  text-decoration: none;
  font-weight: 500;
}

.leaflet-popup-content a:hover {
  text-decoration: underline;
}

/* Skeleton Loading Pulsing Effects */
.skeleton-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.skeleton-text {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(255,255,255,0.06) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: loading-pulse 1.5s infinite;
  border-radius: 4px;
}

.skeleton-title {
  height: 16px;
  width: 60%;
}

.skeleton-badge {
  height: 14px;
  width: 20%;
  border-radius: 30px !important;
}

.skeleton-notes {
  height: 35px;
  width: 100%;
}

.skeleton-address {
  height: 12px;
  width: 80%;
}

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

/* Empty State Styling */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  color: var(--bg-tertiary);
}

.empty-state h3 {
  font-family: var(--font-headers);
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.8rem;
  max-width: 260px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

/* Responsive Rules for Small Devices (Tablets / Mobile) */
@media (max-width: 840px) {
  body {
    overflow: auto;
  }
  
  .app-header {
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
    gap: 15px;
    align-items: stretch;
  }
  
  .search-filter-wrapper {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    gap: 12px;
  }
  
  .search-bar {
    max-width: 100%;
  }
  
  .filter-tabs {
    justify-content: space-between;
  }
  
  .filter-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  
  .mobile-nav {
    display: flex;
  }
  
  .dashboard-container {
    height: calc(100vh - 215px); /* Adjusted for stacked header & mobile tab bar */
    flex-direction: column;
  }
  
  .list-pane, .map-pane {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-right: none;
  }
  
  /* Mobile State Toggles */
  .list-pane.mobile-hide {
    display: none !important;
  }
  
  .map-pane.mobile-hide {
    display: none !important;
  }
}
