/* Tab Bar Navigation - In Header */
.tab-bar {
  display: flex;
  background: var(--bg-light);
  border-bottom: 2px solid var(--bg-medium);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  color: var(--text-medium);
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

.tab-btn:hover {
  background: var(--bg-medium);
  color: var(--text-dark);
}

.tab-btn.active {
  color: var(--rust);
  background: var(--cream);
  font-weight: 700;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--amber);
}

.tab-btn .badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #e74c3c;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tab-btn .badge.active {
  display: flex;
}

/* Tab content containers - take full area */
.tab-content {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
}

/* All tabs should fill available space */
#chat-tab,
#finds-tab,
#nearby-tab,
#following-tab {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#chat-tab.active,
#finds-tab.active,
#nearby-tab.active,
#following-tab.active {
  display: flex;
}

/* People tab */
#people-tab {
  background: var(--bg-light);
}

.people-header {
  padding: 16px 20px;
  background: var(--cream);
  border-bottom: 1px solid var(--bg-medium);
}

.people-search {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--bg-medium);
  border-radius: 20px;
  background: #fff;
  color: var(--text-dark);
  font-size: 0.95rem;
}

.people-search:focus {
  outline: none;
  border-color: var(--amber);
}

.people-view-toggle {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--bg-medium);
}

.view-toggle-btn {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid var(--bg-medium);
  border-radius: 8px;
  background: var(--cream);
  color: var(--text-dark);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle-btn.active {
  background: var(--amber);
  color: white;
  border-color: var(--amber);
}

.people-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Finds/Activity tab - styles consolidated above in #finds-tab block */

.activity-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Activity finds list is now a tile grid - styles in find-tile.css */
.activity-finds-list {
  /* Grid styles come from .find-tile-grid class */
}

/* Activity map container */
#activity-map-container {
  flex: 1;
  min-height: 400px;
  display: none;
  flex-direction: column;
}

#activity-map-container.active {
  display: flex !important;
}

#activity-map {
  width: 100%;
  flex: 1;
  min-height: 400px;
  background: var(--bg-medium);
}

/* Leaflet map container fixes */
#activity-map .leaflet-container {
  width: 100%;
  height: 100%;
}

/* Find card popup in map */
.find-card-popup .leaflet-popup-content-wrapper {
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
}

.find-card-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.map-popup-card {
  overflow: hidden;
}

.map-popup-card .find-preview-card {
  margin: 0;
  box-shadow: none;
  border-radius: 0;
}

/* Activity tab */
#activity-tab {
  background: var(--bg-light);
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-medium);
}

.activity-filter {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--bg-medium);
  border-radius: 8px;
  background: white;
  font-size: 0.9rem;
}

.activity-filter:focus {
  outline: none;
  border-color: var(--amber);
}

.view-toggle-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: var(--espresso);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.view-toggle-icon svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

.view-toggle-icon:hover {
  background: var(--dark-chocolate);
  transform: translateY(-1px);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 8px;
}

.empty-state-message {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Loading states */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-medium);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Adjust chat container for tab bar */
.chat-container {
  height: 100vh;
}

/* When tabs are active, adjust input area to be above tab bar */
.chat-container.tabs-active .input-area {
  border-top: 1px solid var(--bg-medium);
}

/* Hide input area when not on chat tab */
body[data-active-tab="finds"] .input-area,
body[data-active-tab="nearby"] .input-area,
body[data-active-tab="following"] .input-area {
  display: none;
}

/* Nearby tab - full map */
#nearby-tab {
  background: var(--bg-light);
}

.nearby-map-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#nearby-map {
  width: 100%;
  flex: 1;
  min-height: 300px;
  background: var(--bg-medium);
}
