/* ─── Reset i zmienne ─────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-primary:    #070d1c;
  --bg-secondary:  #0f1a2e;
  --bg-card:       #152036;
  --bg-input:      #1a2840;

  --accent-blue:   #2196F3;
  --accent-blue-d: #0D47A1;
  --accent-orange: #FF6D00;
  --accent-orange-d: #BF360C;

  --text-primary:   #e8edf5;
  --text-secondary: #8a9bb5;
  --text-muted:     #4a5a72;

  --border:        #1e2e45;
  --border-light:  #253650;

  --success:  #00c853;
  --warning:  #ff9100;
  --danger:   #f44336;

  --wind-safe:        #00c853;
  --wind-conditional: #ff9100;
  --wind-danger:      #f44336;
  --wind-none:        #253650;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --top-bar-h:    56px;
  --bottom-nav-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
  height: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  /* Ciemne tło po bokach kontenera na szerokich ekranach */
  display: flex;
  justify-content: center;
}

/* ─── Splash screen ───────────────────────────────────────────────────────── */

#splash-screen {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

#splash-screen img {
  width: 160px;
  height: auto;
}

#splash-screen p {
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 0.05em;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ─── Layout aplikacji ────────────────────────────────────────────────────── */

#app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-secondary);
  flex-shrink: 0;
  isolation: isolate;
}

/* ─── Górny pasek ─────────────────────────────────────────────────────────── */

#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-h);
  background: rgba(7, 13, 28, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
}

#top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

#top-bar-logo {
  height: 36px;
  width: auto;
}

#app-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

#app-title span {
  color: var(--accent-orange);
}

/* Hamburger po prawej */
#btn-menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

#btn-menu span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: opacity 0.2s;
}

#btn-menu:hover span {
  background: var(--accent-blue);
}

/* Przycisk szukaj po lewej - ukryty w tej wersji */
#btn-search {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-search:hover {
  color: var(--text-primary);
}

/* ─── Mapa ────────────────────────────────────────────────────────────────── */

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Zoom controls - nad dolną nawigacją */
.leaflet-bottom.leaflet-right {
  bottom: calc(var(--bottom-nav-h) + 12px) !important;
}

/* Nadpisanie domyślnych stylów Leaflet dla ciemnego motywu */
.leaflet-container {
  background: #0a1628;
  font-family: var(--font);
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-input) !important;
}

.leaflet-bar {
  border: none !important;
}

/* ─── Dolna nawigacja ─────────────────────────────────────────────────────── */

#bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 22px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 8px 0;
}

.nav-btn span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-btn.active {
  color: var(--accent-blue);
}

.nav-btn:hover {
  color: var(--text-primary);
}

/* ─── Przyciski ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: var(--bg-input); }

/* Przycisk lokalizacji - pod kontrolkami zoom */
#btn-location {
  position: absolute;
  right: 10px;
  bottom: calc(var(--bottom-nav-h) + 96px);
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

#btn-location.locating i {
  animation: spin 1s linear infinite;
}

/* ─── Panel boczny / drawer ───────────────────────────────────────────────── */

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 90vw);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  z-index: 500;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 56px 0 24px;
}

.drawer.open { transform: translateX(0); }

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 499;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ─── Bottom sheet (panel punktu) ────────────────────────────────────────── */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-h);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 75vh;
  overflow-y: auto;
}

.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 12px auto 0;
}

.sheet-content {
  padding: 16px 20px 24px;
}

/* ─── Karty ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* ─── Formularze ──────────────────────────────────────────────────────────── */

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

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 12px;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-blue);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select option {
  background: var(--bg-input);
}

/* ─── Checkboxy zaplecza ──────────────────────────────────────────────────── */

.amenities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.amenity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.amenity-item input { display: none; }

.amenity-item.checked {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.amenity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  flex-shrink: 0;
}

.amenity-item.checked .amenity-dot {
  background: var(--accent-blue);
}

/* ─── Różyczka wiatru ─────────────────────────────────────────────────────── */

.wind-rose-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.wind-rose {
  position: relative;
  width: 180px;
  height: 180px;
}

/* ─── Markery na mapie ────────────────────────────────────────────────────── */

.map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  font-size: 16px;
}

.map-marker-inner {
  transform: rotate(45deg);
}

.marker-marina    { background: var(--accent-blue); }
.marker-anchor    { background: #7c4dff; }
.marker-buoy      { background: var(--warning); }
.marker-fishing   { background: #00bcd4; }
.marker-other     { background: var(--text-muted); }

/* ─── Tagi zaplecza w widoku punktu ──────────────────────────────────────── */

.amenity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.amenity-tag {
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Ograniczenia jednostki ──────────────────────────────────────────────── */

.vessel-limits {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.vessel-limit-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 70px;
}

.vessel-limit-val {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-blue);
}

.vessel-limit-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* ─── Komentarze ──────────────────────────────────────────────────────────── */

.comment-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.comment-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-blue);
}

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

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

/* ─── Toast / powiadomienia ───────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(400px, 90vw);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  white-space: nowrap;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ─── Spinner ─────────────────────────────────────────────────────────────── */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 24px auto;
}

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

/* ─── Sekcje nagłówkowe ───────────────────────────────────────────────────── */

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 16px 0 8px;
}

/* ─── Badge weryfikacji ───────────────────────────────────────────────────── */

.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(0,200,83,0.15);
  border: 1px solid var(--success);
  border-radius: 20px;
  font-size: 11px;
  color: var(--success);
}

.badge-private {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(255,145,0,0.15);
  border: 1px solid var(--warning);
  border-radius: 20px;
  font-size: 11px;
  color: var(--warning);
}

/* ─── Responsywność ───────────────────────────────────────────────────────── */

@media (min-width: 768px) {
  .sheet {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 380px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    max-height: calc(100vh - 80px);
  }

  .drawer {
    width: 300px;
  }
}
