/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid #e5e5e5;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right #search-container {
  width: 280px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: #1a1a1a;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  max-width: 600px;
}

/* Buttons */
.btn-primary {
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  background: white;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Main Content */
.main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Search Component */
.search-wrapper {
  position: relative;
  flex: 1;
}

.autocomplete-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.autocomplete-input:focus {
  border-color: #1a1a1a;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 200;
}

.autocomplete-results.active {
  display: block;
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
}

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

.autocomplete-item:hover {
  background: #f5f5f5;
}

.autocomplete-name {
  font-weight: 500;
  display: block;
}

.autocomplete-secondary {
  font-size: 0.75rem;
  color: #6b7280;
}

.autocomplete-loading,
.autocomplete-empty,
.autocomplete-error {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

.autocomplete-error {
  color: #ef4444;
}

/* Filter Bar */
.filter-bar {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-row + .filter-row {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

.filter-row .search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 0.875rem;
  outline: none;
  background: white;
}

.filter-row .search-input:focus {
  border-color: #1a1a1a;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-chips {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.375rem 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 100px;
  background: white;
  font-size: 0.8125rem;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.filter-chip.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: white;
}

.filter-select {
  padding: 0.375rem 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 0.8125rem;
  outline: none;
  background: white;
  cursor: pointer;
  color: #374151;
}

.filter-select:focus {
  border-color: #1a1a1a;
}

.filter-group-right {
  margin-left: auto;
}

.list-count {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Places Grid */
.places-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
}

/* Place Card */
.place-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: relative;
  transition: box-shadow 0.2s;
  border-left: 4px solid transparent;
}

.place-card {
  cursor: pointer;
}

.place-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Card status left border accents */
.place-card.card-status-tried {
  border-left-color: #64748b;
}

.place-card.card-status-up_next {
  border-left-color: #fb7185;
}

.place-card.card-status-goto {
  border-left-color: #f97316;
}

.place-card.card-status-outstanding {
  border-left-color: #eab308;
}

.place-photo {
  height: 150px;
  background-size: cover;
  background-position: center;
  background-color: #e5e5e5;
}

.place-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.place-photo-empty::after {
  content: '🍽️';
  font-size: 3rem;
  opacity: 0.3;
}

.place-content {
  padding: 1rem;
}

.place-header {
  margin-bottom: 0.25rem;
}

.place-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.place-address {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0 0 0.25rem;
}

.place-neighborhood {
  font-size: 0.7rem;
  color: #9ca3af;
  margin: 0 0 0.5rem;
  font-style: italic;
}

.place-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.place-rating {
  font-size: 0.75rem;
  color: #f59e0b;
}

.open-status {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
}

.open-status.open {
  background: #dcfce7;
  color: #166534;
}

.open-status.closed {
  background: #fee2e2;
  color: #991b1b;
}

/* Status Badge on Cards */
.place-status {
  margin-bottom: 0.75rem;
}

.status-badge {
  padding: 0.375rem 0.875rem;
  border: 2px solid transparent;
  border-radius: 100px;
  background: #1a1a1a;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: white;
  transition: all 0.15s;
}

.status-badge:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.status-badge-ghost {
  background: transparent;
  border: 2px dashed #d1d5db;
  color: #9ca3af;
  font-weight: 400;
}

.status-badge-ghost:hover {
  border-color: #9ca3af;
  color: #6b7280;
  opacity: 1;
}

.place-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.tag {
  background: #f5f5f5;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #6b7280;
}

.add-tag-btn {
  background: none;
  border: 1px dashed #e5e5e5;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
}

.add-tag-btn:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.tag-delete {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  margin-left: 0.25rem;
  padding: 0;
}

.tag-delete:hover {
  color: #ef4444;
}

.delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.place-card:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.9);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #1a1a1a;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid #e5e5e5;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #1a1a1a;
}

.tab-btn.active {
  color: #1a1a1a;
  border-bottom-color: #1a1a1a;
}

.tab-content {
  display: none;
}

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

.tab-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1rem;
}

/* File Upload */
.file-upload {
  margin-bottom: 1rem;
}

.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.file-label:hover,
.file-label.dragover {
  border-color: #1a1a1a;
  background: #f5f5f5;
}

.file-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.file-count {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.file-preview-grid {
  display: none;
  margin-top: 1rem;
}

.file-preview-grid.active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.preview-item:hover .preview-remove {
  opacity: 1;
}

.preview-remove:hover {
  background: rgba(0, 0, 0, 0.8);
}

.file-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
}

/* Text Input */
.text-input {
  width: 100%;
  min-height: 150px;
  padding: 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-bottom: 1rem;
}

.text-input:focus {
  border-color: #1a1a1a;
}

.extract-btn {
  width: 100%;
  padding: 0.75rem;
  background: #1a1a1a;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.extract-btn:disabled {
  background: #e5e5e5;
  color: #6b7280;
  cursor: not-allowed;
}

.extract-btn:not(:disabled):hover {
  background: #333;
}

/* Loading */
.modal-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 10;
}

.modal-loading[hidden] {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e5e5;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Confirmation Table */
.confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.confirm-table th {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 2px solid #e5e5e5;
  font-weight: 600;
}

.confirm-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: top;
}

.confirm-table tr:last-child td {
  border-bottom: none;
}

.confirm-table tr.no-match {
  background: #fef2f2;
}

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

.extracted-location {
  font-size: 0.75rem;
  color: #6b7280;
}

.candidate-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  font-size: 0.875rem;
  outline: none;
  background: white;
}

.candidate-details {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.candidate-address {
  display: block;
}

.confidence {
  font-weight: 500;
}

.status-add {
  color: #10b981;
  font-weight: 500;
}

.status-skip {
  color: #6b7280;
}

.skip-label {
  color: #ef4444;
  font-weight: 500;
}

.error-cell {
  color: #ef4444;
}

.location-context {
  background: #f5f5f5;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Manual Search in Confirm Modal */
.manual-search-inline {
  position: relative;
}

.manual-search-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  font-size: 0.875rem;
  outline: none;
}

.manual-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.manual-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.manual-search-results.active {
  display: block;
}

.manual-search-results .autocomplete-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
}

.manual-search-results .autocomplete-item:last-child {
  border-bottom: none;
}

.manual-search-results .autocomplete-item:hover {
  background: #f5f5f5;
}

.manual-search-results .autocomplete-name {
  display: block;
  font-weight: 500;
}

.manual-search-results .autocomplete-secondary {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
}

.manual-search-results .autocomplete-loading,
.manual-search-results .autocomplete-empty,
.manual-search-results .autocomplete-error {
  padding: 0.75rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

.manual-search-results .autocomplete-error {
  color: #ef4444;
}

.manual-selected {
  padding: 0.5rem;
  background: #f0fdf4;
  border-radius: 4px;
  border: 1px solid #86efac;
}

.manual-selected strong {
  display: block;
  margin-bottom: 0.25rem;
}

.no-match-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.no-match-text {
  color: #ef4444;
  font-size: 0.875rem;
}

.btn-link {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  text-decoration: underline;
}

.btn-link:hover {
  color: #1d4ed8;
}

.cancel-manual {
  margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .header-inner {
    flex-direction: column;
    gap: 1rem;
  }

  .header-left {
    width: 100%;
    justify-content: space-between;
  }

  .header-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-right #search-container {
    order: 1;
    flex: 1;
    min-width: 100%;
  }

  .header-right #import-btn {
    order: 2;
  }

  .header-right .user-menu {
    order: 3;
    margin-left: auto;
  }

  .header-actions {
    width: 100%;
    max-width: none;
  }

  .main {
    padding: 1rem;
  }

  .places-grid {
    grid-template-columns: 1fr;
  }

  /* Filter bar mobile */
  .filter-bar {
    padding: 0.75rem;
  }

  .filter-row {
    gap: 0.5rem;
  }

  .filter-row .search-input {
    min-width: 0;
    width: 100%;
  }

  .filter-group {
    flex-wrap: wrap;
  }

  .filter-label {
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .filter-chip {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }

  .filter-group-right {
    margin-left: 0;
  }

  .list-count {
    width: 100%;
    text-align: right;
  }

  /* Card status chips mobile */
  .place-status-chips {
    flex-wrap: wrap;
  }

  .status-chip {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  .modal-content {
    width: 95%;
    margin: 1rem;
  }

  .confirm-table {
    font-size: 0.75rem;
  }

  .confirm-table th,
  .confirm-table td {
    padding: 0.5rem;
  }
}

/* Hidden state */
.hidden {
  display: none !important;
}

/* Auth Screen */
.auth-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #fafaf9;
  z-index: 2000;
}

/* Subtle grain texture for auth screen */
.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
}

.auth-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  max-width: 380px;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: #fffffe;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid #e8e8e6;
}

.auth-logo {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 0.5rem;
  color: #1a1a1a;
  letter-spacing: -0.02em;
}

.auth-tagline {
  text-align: center;
  color: #78716c;
  margin: 0 0 2rem;
  font-size: 0.9375rem;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #78716c;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab:hover {
  border-color: #d5d5d5;
  color: #1a1a1a;
}

.auth-tab.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: white;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a1a;
}

.form-group input {
  padding: 0.75rem 1rem;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafaf9;
}

.form-group input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
  background: white;
}

.auth-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
}

.auth-error[hidden] {
  display: none;
}

.auth-success {
  background: #f0fdf4;
  color: #166534;
  padding: 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.auth-success p {
  margin: 0;
}

.auth-success p + p {
  margin-top: 0.5rem;
}

.auth-back {
  width: 100%;
  padding: 0.75rem;
  background: transparent;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
  border-radius: 100px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-back:hover {
  background: #fafaf9;
  border-color: #d5d5d5;
}

.auth-submit {
  padding: 0.875rem;
  background: #1a1a1a;
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-submit:hover:not(:disabled) {
  background: #333;
  transform: translateY(-1px);
}

.auth-submit:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-email {
  font-size: 0.875rem;
  color: #6b7280;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
}

.loading-state .spinner {
  margin: 0 auto 1rem;
}

/* View Toggle */
.view-toggle {
  display: flex;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 2px;
}

.view-toggle-btn {
  padding: 0.375rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.view-toggle-btn:hover {
  color: #1a1a1a;
}

.view-toggle-btn.active {
  background: white;
  color: #1a1a1a;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.view-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* Map Container */
#map-container {
  display: none;
  width: 100%;
  height: calc(100vh - 80px);
  min-height: 400px;
  position: relative;
}

#map-container.active {
  display: block;
}

/* Map Filter Overlay */
.map-filter-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 10;
  pointer-events: none;
}

.map-filter-overlay .filter-bar {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .map-filter-overlay {
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
  }

  .map-filter-overlay .filter-bar {
    padding: 0.5rem;
  }
}

/* Adjust main for map view */
.main:has(#map-container.active) {
  padding: 0;
  max-width: none;
}

.main:has(#map-container.active) #places-list {
  display: none;
}

/* Map Markers */
.map-marker {
  width: 24px;
  height: 24px;
  background: #1a1a1a;
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}

.map-marker:hover {
  transform: scale(1.2);
}

.map-marker.marker-up-next {
  background: #fb7185;
}

.map-marker.marker-tried {
  background: #64748b;
}

.map-marker.marker-goto {
  background: #f97316;
}

.map-marker.marker-outstanding {
  background: #eab308;
}

/* Map Popup */
.map-popup {
  padding: 0.25rem 0;
}

.popup-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  color: #1a1a1a;
}

.popup-address {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.popup-status {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.popup-status-up_next {
  background: #fce7f3;
  color: #be185d;
}

.popup-status-tried {
  background: #f1f5f9;
  color: #475569;
}

.popup-status-goto {
  background: #ffedd5;
  color: #c2410c;
}

.popup-status-outstanding {
  background: #fef3c7;
  color: #a16207;
}

.popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.popup-tag {
  background: #f5f5f5;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.6875rem;
  color: #6b7280;
}

.popup-link {
  display: block;
  font-size: 0.75rem;
  color: #3b82f6;
  text-decoration: none;
  margin-top: 0.25rem;
}

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

/* MapLibre popup overrides */
.maplibregl-popup-content {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.maplibregl-popup-close-button {
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  color: #6b7280;
}

.maplibregl-popup-close-button:hover {
  color: #1a1a1a;
  background: transparent;
}

/* Settings Modal */
.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.settings-section h4 {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.settings-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1rem;
}

/* API Key Section */
.api-key-section {
  background: #f9fafb;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.api-key-loading {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.api-key-loading[hidden] {
  display: none;
}

.no-key-state p {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.key-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.api-key-display {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.api-key-value {
  flex: 1;
  padding: 0.625rem 0.75rem;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.75rem;
  word-break: break-all;
  line-height: 1.4;
}

.copy-key-btn {
  white-space: nowrap;
}

.copy-key-btn.copied {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.key-actions {
  margin-top: 0.75rem;
  text-align: right;
}

.regenerate-key-btn {
  font-size: 0.75rem;
  color: #6b7280;
}

.regenerate-key-btn:hover {
  color: #ef4444;
}

/* Subscription Section */
.subscription-section {
  background: #f9fafb;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.subscription-loading {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.subscription-loading[hidden] {
  display: none;
}

.subscription-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.subscription-badge.active {
  background: #dcfce7;
  color: #166534;
}

.subscription-badge .badge-icon {
  font-size: 0.875rem;
}

.portal-link {
  display: inline-block;
  text-decoration: none;
}

/* Shortcut Instructions */
.shortcut-instructions {
  background: #f0fdf4;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #bbf7d0;
}

.setup-steps {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.setup-steps li {
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.setup-steps li:last-child {
  margin-bottom: 0;
}

.shortcut-link {
  display: inline-block;
  margin-top: 0.5rem;
  text-decoration: none;
  font-size: 0.8125rem;
}

.shortcut-link:hover {
  background: #333;
}

/* Settings button icon alignment */
#settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.5rem;
}

#settings-btn svg {
  display: block;
}

/* Detail Modal */
.detail-modal {
  max-width: 500px;
  max-height: 90vh;
  padding: 0;
  overflow-y: auto;
}

.detail-modal .modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.detail-modal .modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.detail-hero {
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: #e5e5e5;
}

.detail-hero-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-hero-empty::after {
  content: '';
  font-size: 4rem;
  opacity: 0.3;
}

.detail-body {
  padding: 1.25rem;
}

.detail-header {
  margin-bottom: 1rem;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.detail-name {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
}

.detail-status-btn {
  flex-shrink: 0;
  padding: 0.375rem 0.875rem;
  border: 2px solid transparent;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.15s;
}

.detail-status-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.detail-status-ghost {
  background: transparent;
  border: 2px dashed #d1d5db;
  color: #9ca3af;
  font-weight: 400;
}

.detail-status-ghost:hover {
  border-color: #9ca3af;
  color: #6b7280;
  opacity: 1;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: #6b7280;
  font-size: 0.875rem;
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #1a1a1a;
  font-weight: 500;
}

.detail-rating .star {
  color: #f59e0b;
}

.detail-rating .rating-count {
  color: #6b7280;
  font-weight: 400;
}

.detail-price {
  color: #10b981;
  font-weight: 500;
}

.detail-neighborhood {
  color: #6b7280;
}

.detail-section {
  padding: 1rem 0;
  border-top: 1px solid #f0f0f0;
}

.detail-section h4 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.detail-hours-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hours-indicator {
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.hours-indicator.open {
  background: #dcfce7;
  color: #166534;
}

.hours-indicator.closed {
  background: #fee2e2;
  color: #991b1b;
}

.hours-next {
  color: #6b7280;
  font-size: 0.875rem;
}

.detail-hours-grid {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.hours-row {
  display: flex;
  font-size: 0.875rem;
}

.hours-row.today {
  font-weight: 500;
}

.hours-day {
  width: 40px;
  flex-shrink: 0;
  color: #6b7280;
}

.hours-row.today .hours-day {
  color: #1a1a1a;
}

.hours-times {
  color: #1a1a1a;
}

.hours-times.closed {
  color: #6b7280;
}

.detail-contact {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.contact-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.contact-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

.contact-text {
  color: #374151;
  line-height: 1.4;
}

.contact-link {
  color: #3b82f6;
  text-decoration: none;
}

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

.detail-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-notes p {
  margin: 0;
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.5;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.detail-tag {
  background: #f5f5f5;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: #6b7280;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
}

.detail-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 0.75rem;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #1a1a1a;
  text-decoration: none;
  transition: background 0.2s;
}

.detail-action-btn:hover {
  background: #e5e5e5;
}

.action-icon {
  font-size: 1rem;
}

/* Similar Places Section */
.detail-similar h4 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.similar-places-grid {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.similar-places-grid::-webkit-scrollbar {
  height: 4px;
}

.similar-places-grid::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 2px;
}

.similar-places-grid::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

.similar-loading {
  color: #6b7280;
  font-size: 0.875rem;
  padding: 1rem;
}

.similar-place-card {
  flex: 0 0 140px;
  cursor: pointer;
  transition: transform 0.15s;
}

.similar-place-card:hover {
  transform: translateY(-2px);
}

.similar-place-photo {
  width: 140px;
  height: 100px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: #e5e5e5;
  margin-bottom: 0.5rem;
}

.similar-place-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.similar-place-photo-empty span {
  font-size: 2rem;
  opacity: 0.3;
}

.similar-place-info {
  padding: 0 0.125rem;
}

.similar-place-name {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.similar-place-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: #6b7280;
}

.similar-save-count {
  background: #f0fdf4;
  color: #166534;
  padding: 0.125rem 0.375rem;
  border-radius: 100px;
}

@media (max-width: 768px) {
  .detail-modal {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .detail-hero {
    height: 180px;
  }

  .detail-name {
    font-size: 1.25rem;
  }

  .detail-actions {
    flex-wrap: wrap;
  }

  .detail-action-btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: calc(50% - 0.25rem);
  }

  .similar-place-card {
    flex: 0 0 120px;
  }

  .similar-place-photo {
    width: 120px;
    height: 85px;
  }
}
