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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f1f5f9;
  line-height: 1.5;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }

/* ============================================================
   Login
   ============================================================ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 50%, #f0fdf4 100%);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 16px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 4px 32px rgba(37,99,235,.10), 0 1px 4px rgba(0,0,0,.06);
  text-align: center;
}

.login-logo {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.login-sub {
  color: #64748b;
  margin-bottom: 24px;
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-form label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.login-form input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
  background: #f8fafc;
}

.login-form input[type="password"]:focus { border-color: #2563eb; background: #fff; }

.login-form button[type="submit"] {
  padding: 11px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  transition: background .15s;
}

.login-form button[type="submit"]:hover { background: #1d4ed8; }

.login-version {
  margin-top: 20px;
  font-size: 11px;
  color: #94a3b8;
}

/* ============================================================
   App Layout
   ============================================================ */
.app-body { overflow: hidden; height: 100vh; }

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width .2s, min-width .2s;
  z-index: 10;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
}

.btn-logout {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 12px;
  transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: #ef4444; color: #ef4444; }

.sidebar-section {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.filter-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}

.filter-input, .filter-select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  color: #1e293b;
  transition: border-color .15s;
}
.filter-input:focus, .filter-select:focus { border-color: #2563eb; background: #fff; }

.gps-search-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #2563eb;
  background: #eff6ff;
  border-radius: 6px;
  padding: 4px 8px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar .chip-group {
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sidebar .chip-group::-webkit-scrollbar { display: none; }

.chip {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  transition: all .15s;
  white-space: nowrap;
}

.sidebar .chip {
  padding: 4px 9px;
  font-size: 12px;
  flex-shrink: 0;
}
.chip:hover { border-color: #2563eb; color: #2563eb; }
.chip.active { background: #2563eb; border-color: #2563eb; color: white; }
.chip-green.active { background: #059669; border-color: #059669; }
.chip-yellow.active { background: #d97706; border-color: #d97706; }
.chip-red.active { background: #dc2626; border-color: #dc2626; }
.chip-star.active { background: #f59e0b; border-color: #f59e0b; color: white; }

.btn-star {
  background: none;
  border: none;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  color: #94a3b8;
  transition: transform .15s;
}
.btn-star:hover { transform: scale(1.2); }
.btn-star.active { color: #f59e0b; }

.btn-primary {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-full { width: 100%; padding: 10px; }

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1.5px solid #fecaca;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
}

.version-badge {
  font-size: 11px;
  color: #94a3b8;
}

/* ============================================================
   Main content
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all .15s;
}
.btn-icon:hover { border-color: #2563eb; color: #2563eb; }

.view-toggle {
  display: flex;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #fff;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: all .15s;
}
.view-btn + .view-btn { border-left: 1.5px solid #e2e8f0; }
.view-btn.active { background: #eff6ff; color: #2563eb; }
.view-btn:hover:not(.active) { background: #f8fafc; }

.result-count {
  margin-left: auto;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

/* ============================================================
   List view
   ============================================================ */
.list-view {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.billboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.bb-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.bb-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 16px rgba(37,99,235,.12);
  transform: translateY(-1px);
}

.bb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.bb-typ {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 12px;
}

.bb-stav {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.stav-free { background: #dcfce7; color: #15803d; }
.stav-res { background: #fef3c7; color: #b45309; }
.stav-busy { background: #fee2e2; color: #dc2626; }

.bb-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.bb-card-mesto {
  font-size: 12px;
  color: #2563eb;
  font-weight: 500;
  margin-bottom: 4px;
}

.bb-card-adresa {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bb-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  margin-top: auto;
}

.bb-cena {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.bb-notes-badge {
  font-size: 12px;
  color: #64748b;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 15px;
}

/* ============================================================
   Map view
   ============================================================ */
.map-view {
  flex: 1;
  min-height: 0;
}

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

/* Map popup */
.map-popup { min-width: 200px; }
.mp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mp-typ { font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; }
.mp-stav { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.mp-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.mp-mesto { font-size: 12px; color: #2563eb; font-weight: 500; margin-bottom: 2px; }
.mp-adresa { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.mp-cena { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.mp-foto img { width: 100%; border-radius: 6px; margin-bottom: 8px; max-height: 120px; object-fit: cover; }
.mp-btn {
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mp-btn:hover { background: #1d4ed8; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal {
  background: #fff;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: sticky;
  top: 16px;
  float: right;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 16px 0 auto;
  z-index: 2;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.modal-close:hover { background: #e2e8f0; }

/* Detail modal */
.modal-detail {
  width: 100%;
  max-width: 680px;
  padding: 0 0 24px;
}

.detail-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.detail-badges { display: flex; gap: 8px; margin-bottom: 8px; }

.detail-title { font-size: 22px; font-weight: 700; color: #0f172a; margin-bottom: 12px; }

.detail-actions { display: flex; gap: 8px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 20px 24px;
}

.detail-foto {
  width: 180px;
  flex-shrink: 0;
  cursor: zoom-in;
}
.detail-foto img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  max-height: 160px;
  transition: opacity .15s;
}
.detail-foto:hover img { opacity: .85; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f8fafc;
  gap: 12px;
}
.info-row span { color: #64748b; font-size: 13px; white-space: nowrap; }
.info-row strong { font-size: 13px; text-align: right; word-break: break-word; }

.link { color: #2563eb; font-weight: 500; }

.detail-mini-map {
  margin: 0 24px;
  height: 180px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #e2e8f0;
  margin-bottom: 20px;
}

/* Notes */
.notes-section { padding: 0 24px; }
.notes-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: #0f172a; }

.note-item {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.note-meta { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }

.note-body { font-size: 13px; color: #1e293b; line-height: 1.6; margin-bottom: 8px; }

.note-actions { display: flex; gap: 6px; }

.no-notes { color: #94a3b8; font-size: 13px; margin-bottom: 12px; }

.add-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.add-note textarea {
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
  background: #f8fafc;
}
.add-note textarea:focus { border-color: #2563eb; background: #fff; }

/* ============================================================
   Paste foto
   ============================================================ */
.paste-hint {
  font-weight: 400;
  color: #94a3b8;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}


.foto-paste-status {
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}
.foto-paste-status.uploading { color: #64748b; }
.foto-paste-status.ok { color: #059669; }
.foto-paste-status.error { color: #dc2626; }

/* Edit modal */
.modal-edit {
  width: 100%;
  max-width: 600px;
  padding: 24px;
}

.modal-edit h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: #0f172a; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.form-group-full { grid-column: 1 / -1; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  color: #1e293b;
  transition: border-color .15s;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus { border-color: #2563eb; background: #fff; }

.gps-lon-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.gps-lon-row input { flex: 1; min-width: 0; }
.btn-geocode {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   Alerts & Loading
   ============================================================ */
.alert-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 15px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .sidebar { position: fixed; height: 100vh; box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  .billboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-foto { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group-full { grid-column: auto; }
}

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lb-in .15s ease;
}

@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-overlay img {
  width: 96vw;
  height: 96vh;
  border-radius: 8px;
  box-shadow: 0 8px 48px rgba(0,0,0,.6);
  object-fit: contain;
  cursor: default;
  animation: lb-img-in .15s ease;
}

@keyframes lb-img-in {
  from { transform: scale(.93); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  z-index: 2001;
}
.lightbox-close:hover { background: rgba(255,255,255,.28); }

/* Fotka v popup bublině – kliknutelná */
.mp-foto img { cursor: zoom-in; }
