/* CSS Variables - SaunaPass v2 Light Theme */
:root {
  --primary: #1E3A8A;
  --primary-light: #3B82F6;
  --accent: #F59E0B;
  --background: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1A1A1A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --success: #22C55E;
  --error: #EF4444;

  --nav-height: 95px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

/* Screens */
.screen {
  display: none;
  height: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Status Bar (iOS style) */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 21px 24px 19px;
  height: 62px;
}

.status-bar .time {
  font-size: 17px;
  font-weight: 600;
}

.status-icons {
  display: flex;
  gap: 5px;
}

/* Auth Screen */
#auth-screen {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: var(--background);
}

.auth-container {
  width: 100%;
  max-width: 354px;
}

.logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
}

.logo h1 {
  font-size: 32px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.tagline {
  color: var(--text-muted);
  font-size: 14px;
}

/* Auth Forms */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-light);
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  padding: 0 16px;
  font-size: 13px;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 14px;
  display: none;
}

.error-message.show {
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #1e40af;
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--background);
}

.btn-google {
  background: white;
  color: #333;
  border: 1px solid var(--border);
}

.btn-google:hover {
  background: var(--background);
}

.btn-large {
  height: 52px;
  font-size: 14px;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--background);
  color: var(--text);
}

.btn-round {
  width: 40px;
  height: 40px;
  border-radius: 100px;
  padding: 0;
}

/* Main App Layout */
#main-app {
  background: var(--background);
}

/* Tab Content */
.tab-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* Bottom Navigation - Pill Style */
.tab-bar-section {
  background: linear-gradient(to bottom, transparent 0%, var(--background) 25%);
  padding: 12px 21px 21px;
  padding-bottom: calc(21px + var(--safe-area-bottom));
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 4px;
  height: 62px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.2s;
  font-family: inherit;
}

.nav-item span {
  font-size: 10px;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active span {
  font-weight: 600;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 40px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--text);
}

.badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.badge-value {
  font-weight: 700;
  color: var(--primary);
}

.badge-label {
  font-weight: 500;
  color: var(--text-muted);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card-row {
  display: flex;
  gap: 12px;
}

.card-row .card {
  flex: 1;
}

.card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 0.85;
  color: var(--text);
}

.card-value.accent {
  color: var(--accent);
}

.card-value.primary {
  color: var(--primary);
}

/* Section Label */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* Entry List */
.entry-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.entry-divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.entry-date {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

.entry-date-day {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.entry-date-month {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.entry-info {
  flex: 1;
}

.entry-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.entry-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.entry-rating {
  color: var(--primary);
  font-size: 12px;
}

/* Feed Posts */
.feed-post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.feed-post:last-child {
  margin-bottom: 0;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 100px;
  background: var(--primary);
}

.post-user-info {
  flex: 1;
}

.post-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.post-time {
  font-size: 12px;
  color: var(--text-muted);
}

.post-image {
  width: 100%;
  height: 180px;
  background: var(--accent);
  object-fit: cover;
}

.post-content {
  padding: 16px;
}

.post-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}

.post-rating {
  color: var(--primary);
  font-size: 14px;
  margin-bottom: 12px;
}

.post-actions {
  display: flex;
  gap: 16px;
}

.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.post-action:hover {
  color: var(--primary);
}

/* Profile */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 100px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: 700;
}

.profile-name {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.05;
}

.profile-since {
  font-size: 12px;
  color: var(--text-muted);
}

.stats-grid {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 0.85;
  color: var(--text);
  margin-bottom: 4px;
}

.stat-value.primary {
  color: var(--primary);
}

.stat-value.accent {
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Menu List */
.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.menu-item:hover {
  background: var(--background);
}

.menu-icon {
  color: var(--primary);
  width: 20px;
  height: 20px;
}

.menu-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.menu-arrow {
  color: var(--text-light);
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.logout-btn:hover {
  background: rgba(245, 158, 11, 0.05);
}

/* Map */
#map-tab {
  position: relative;
}

#map-container {
  flex: 1;
  position: relative;
  background: var(--border);
}

#map {
  height: 100%;
  width: 100%;
}

.search-bar {
  position: absolute;
  top: 16px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 16px;
  height: 48px;
  z-index: 1000;
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

.search-bar input::placeholder {
  color: var(--text-light);
}

.search-bar input:focus {
  outline: none;
}

.search-icon {
  color: var(--text-light);
}

.sauna-marker {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sauna-marker.highlight {
  background: var(--accent);
}

.preview-card {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 16px;
  z-index: 1000;
}

.preview-image {
  width: 88px;
  height: 88px;
  background: var(--primary);
  border-radius: 8px;
  flex-shrink: 0;
}

.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.preview-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.preview-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.preview-stats {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.preview-stat {
  font-size: 12px;
  color: var(--text-muted);
}

.preview-stat strong {
  color: var(--text);
}

.locate-btn {
  position: absolute;
  bottom: 160px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

/* Check-in Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal-spacer {
  flex: 1;
}

.modal-sheet {
  background: var(--background);
  border-radius: 16px 16px 0 0;
  padding: 24px 24px 40px;
}

.modal-handle {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.modal-handle-bar {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
}

.modal-close {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}

.selected-sauna-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.sauna-thumb {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 8px;
  flex-shrink: 0;
}

.sauna-details h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.sauna-details p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Rating Stars */
.rating-section {
  margin-bottom: 24px;
}

.rating-stars {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.star-btn {
  width: 48px;
  height: 48px;
  background: var(--border);
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.2s;
}

.star-btn.active {
  background: var(--primary);
  color: white;
}

/* Notes Input */
.notes-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-height: 80px;
  width: 100%;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  resize: none;
}

.notes-input::placeholder {
  color: var(--text-light);
}

.notes-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Photo Button */
.photo-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.photo-btn:hover {
  background: var(--background);
}

/* Privacy Checkbox */
.privacy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.checkbox {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox.unchecked {
  background: var(--surface);
  border: 1px solid var(--border);
}

.privacy-text {
  font-size: 14px;
  color: var(--text);
}

/* Check-in Tab */
.checkin-content {
  padding: 24px;
}

.search-box {
  position: relative;
  margin-bottom: 24px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

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

.search-result-item:hover {
  background: var(--background);
}

.search-result-item h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.search-result-item p {
  font-size: 12px;
  color: var(--text-muted);
}

.nearby-section h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 16px;
}

.nearby-item {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.nearby-item:hover {
  background: var(--background);
}

.nearby-item h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.nearby-item p {
  font-size: 13px;
  color: var(--text-muted);
}

.nearby-item .distance {
  font-size: 12px;
  color: var(--primary);
  margin-top: 8px;
}

/* Sauna Profile */
.sauna-profile {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sauna-hero {
  height: 260px;
  background: var(--primary);
  position: relative;
}

.sauna-hero-nav {
  position: absolute;
  top: 54px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
}

.sauna-hero-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.hero-dot.inactive {
  width: 6px;
  height: 6px;
  opacity: 0.4;
}

.sauna-profile-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.sauna-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.sauna-title {
  font-size: 40px;
  font-weight: 500;
  line-height: 1.05;
  margin-bottom: 4px;
}

.sauna-type {
  font-size: 13px;
  color: var(--text-muted);
}

.rating-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.rating-badge .star {
  color: var(--primary);
}

.rating-badge .score {
  font-weight: 700;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.info-row svg {
  color: var(--primary);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.info-row span {
  font-size: 14px;
  color: var(--text);
}

.info-row a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.info-divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.action-row {
  display: flex;
  gap: 12px;
}

.action-row .btn-primary {
  flex: 1;
}

.action-row .btn-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease;
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-tip {
  background: var(--surface);
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

/* Content padding */
.content-padding {
  padding: 24px;
}

/* Responsive */
@media (min-width: 768px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .auth-container {
    padding: 48px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  }
}
