/* ─── Reisetagebuch Custom Styles ─── */

/* Smooth Transitions zwischen Views */
#app {
  transition: opacity 0.2s ease;
}

/* Bottom Nav Padding für Mobile */
body {
  padding-bottom: 4rem;
}

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }
}

/* Hero Cover Image */
.hero-cover {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 50vh;
}

.hero-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.6) 100%);
}

.hero-cover .hero-content {
  position: relative;
  z-index: 1;
}

/* Timeline */
.timeline-day {
  min-width: 3.5rem;
  scroll-snap-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline-day:hover {
  transform: translateY(-2px);
}

.timeline-day.active {
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.4);
}

.timeline-scroll {
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.timeline-scroll::-webkit-scrollbar {
  display: none;
}

/* Section Cards */
.section-card {
  border-left: 4px solid var(--section-color, #1B5E20);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.section-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Journal Entries */
.journal-entry {
  border-left: 3px solid #e5e7eb;
  transition: border-color 0.2s ease;
}

.journal-entry:hover {
  border-left-color: #9ca3af;
}

.journal-entry.private {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.05);
}

/* Day Navigation */
.day-nav-btn {
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.day-nav-btn:active {
  transform: scale(0.95);
}

/* Place Type Badges */
.place-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Traveler Timeline Bar */
.traveler-bar {
  height: 0.5rem;
  border-radius: 9999px;
  transition: opacity 0.2s ease;
}

/* Photo in Journal */
.journal-photo {
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.journal-photo:hover {
  transform: scale(1.02);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0.5rem;
}

/* Highlight Chips */
.highlight-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  background: rgba(27, 94, 32, 0.1);
  color: #1B5E20;
  font-weight: 500;
}

/* Bottom Nav Active State */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.25rem;
  font-size: 0.65rem;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.2s ease;
  min-width: 3.5rem;
}

.nav-item.active {
  color: #1B5E20;
  font-weight: 600;
}

.nav-item span.nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* Desktop Sidebar Navigation */
@media (min-width: 768px) {
  .desktop-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 4.5rem;
    height: 100vh;
    background: white;
    border-right: 1px solid #e5e7eb;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    gap: 0.25rem;
  }

  .desktop-nav .nav-item {
    font-size: 0.6rem;
    padding: 0.75rem 0.25rem;
    border-radius: 0.5rem;
    width: 3.75rem;
  }

  .desktop-nav .nav-item:hover {
    background: #f3f4f6;
  }

  .desktop-nav .nav-item.active {
    background: rgba(27, 94, 32, 0.1);
  }

  #app {
    margin-left: 4.5rem;
  }
}

/* Countdown */
.countdown-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.countdown-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

/* Swipe hint animation */
@keyframes swipe-hint {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-8px); }
}

.swipe-hint {
  animation: swipe-hint 2s ease-in-out 3;
}

/* Private entry lock */
.private-lock {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #d97706;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Smooth page transitions */
.view-enter {
  animation: fadeIn 0.25s ease-out;
}

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

/* ─── Phase 2 Additions ─── */

/* Leaflet Map Overrides */
.leaflet-container {
  font-family: system-ui, -apple-system, sans-serif;
  border-radius: 0.75rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
  margin: 0.75rem 1rem;
  line-height: 1.5;
}

/* Info Accordion */
.info-accordion-btn {
  transition: background-color 0.15s ease;
}

.info-accordion-btn:hover {
  background-color: #f9fafb;
}

.info-chevron {
  transition: transform 0.2s ease;
}

/* Password Dialog */
#pw-dialog input:focus {
  border-color: #1B5E20;
}

/* Filter Buttons */
.place-filter-btn,
.tip-filter-btn {
  transition: all 0.15s ease;
  cursor: pointer;
}

.place-filter-btn:hover,
.tip-filter-btn:hover {
  opacity: 0.85;
}

/* ─── Editor Toolbar ─── */
#editor-toolbar:empty {
  display: none;
}

/* Auto-save toast */
#autosave-toast {
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Editor form inputs focus ring uses primary color */
.view-enter input:focus,
.view-enter textarea:focus,
.view-enter select:focus {
  --tw-ring-color: var(--primary-color, #1B5E20);
  border-color: var(--primary-color, #1B5E20);
}

/* ─── Phase 7: Polish & Accessibility ─── */

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1B5E20;
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 0 0 0.75rem 0.75rem;
  z-index: 9999;
  font-size: 0.875rem;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* Loading skeleton pulse */
#loading-skeleton .animate-pulse > div {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Improved focus outlines for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--primary-color, #1B5E20);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Remove outline for mouse clicks */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
  outline: none;
}

/* Better contrast for muted text */
.text-gray-400 {
  color: #6b7280 !important;
}

/* Smoother view transition */
#app {
  transition: opacity 0.12s ease;
}

/* Offline banner */
#offline-banner {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .view-enter,
  .timeline-day,
  .section-card,
  .journal-photo,
  #app {
    animation: none !important;
    transition: none !important;
  }

  .swipe-hint {
    animation: none !important;
  }
}

/* Leaflet fix: ensure map tiles load fully */
#places-map .leaflet-tile-pane,
#event-map .leaflet-tile-pane {
  opacity: 1;
}
