/* ==========================================================================
   INTERAKTYWNA MAPA SIEDZIB SPÓŁEK GPW (company_map.css)
   ========================================================================== */

.company-map-view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.company-map-view.active {
  display: block;
}

.company-map__nav {
  margin-bottom: 20px;
}

.company-map__back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.company-map__header h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

/* --- PANEL FILTRÓW --- */
.company-map__filters-panel {
  padding: 18px 22px;
  margin-bottom: 22px;
}

.company-map__filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1.2fr auto;
  gap: 16px;
  align-items: flex-end;
}

.company-map__filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.company-map__filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.company-map__input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.company-map__search-icon {
  position: absolute;
  left: 12px;
  pointer-events: none;
}

.company-map__input {
  padding-left: 36px;
  padding-right: 32px;
  width: 100%;
  height: 42px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--overlay-10);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.company-map__input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
  outline: none;
}

.company-map__clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.company-map__clear-btn:hover {
  color: var(--neon-cyan);
}

.company-map__select {
  height: 42px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--overlay-10);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 13.5px;
  padding: 0 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.company-map__select:focus {
  border-color: var(--neon-cyan);
  outline: none;
}

.company-map__select option {
  background: #0f172a;
  color: #f1f5f9;
}

.company-map__filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
}

.company-map__reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 16px;
  font-size: 13px;
  white-space: nowrap;
}

.company-map__count-badge {
  height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* --- KARTA I PŁÓTNO MAPY --- */
.company-map__canvas-card {
  padding: 6px;
  margin-bottom: 28px;
  overflow: hidden;
  border: 1px solid rgba(0, 212, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.company-map__canvas {
  height: 600px;
  width: 100%;
  border-radius: 10px;
  background: #0b1120;
  position: relative;
  z-index: 10;
}

.company-map__loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(4px);
  color: var(--neon-cyan);
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
}

/* --- DOSTOSOWANIE LEAFLET POD DARK THEME --- */
.leaflet-container {
  background: #0b1120 !important;
  font-family: inherit !important;
}

/* Automatyczny Dark Mode dla kafelków mapy (gdy brak klucza CARTO) */
.company-map__canvas .osm-dark-tiles {
  filter: invert(100%) hue-rotate(180deg) brightness(85%) contrast(90%);
}

.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(0, 212, 255, 0.3) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 212, 255, 0.15) !important;
  border-radius: 12px !important;
  padding: 4px !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid rgba(0, 212, 255, 0.3) !important;
}

.leaflet-popup-close-button {
  color: var(--neon-cyan) !important;
  padding: 6px !important;
  font-size: 16px !important;
}

.leaflet-popup-close-button:hover {
  color: #fff !important;
}

/* --- WNĘTRZE POPUPU SPÓŁKI --- */
.company-popup {
  padding: 10px 12px;
  min-width: 260px;
  max-width: 320px;
}

.company-popup__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.company-popup__logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #1e293b;
  object-fit: contain;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.company-popup__logo-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-cyan);
}

.company-popup__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.company-popup__ticker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  background: rgba(0, 212, 255, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.company-popup__body {
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.company-popup__meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.company-popup__meta-label {
  color: var(--text-muted);
}

.company-popup__meta-val {
  font-weight: 600;
  color: #e2e8f0;
}

.company-popup__price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.company-popup__price {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.company-popup__change.positive {
  color: #10b981;
  font-weight: 700;
}

.company-popup__change.negative {
  color: #ef4444;
  font-weight: 700;
}

.company-popup__btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

/* --- CUSTOM PINS (MARKERS) --- */
.company-map-marker {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.company-map-marker:hover {
  transform: scale(1.2) translateY(-4px);
  z-index: 1000 !important;
}

.company-map-pin-inner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(11, 17, 32, 0.9);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.6), inset 0 0 6px rgba(0, 212, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.3px;
  text-transform: uppercase;
  overflow: hidden;
}

.company-map-pin-inner.is-international {
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.company-map-pin-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 9px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 0 4px;
}

/* --- KATALOG POD MAPĄ --- */
.company-map__directory {
  margin-top: 10px;
}

.company-map__directory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

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

.company-card-map {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--overlay-08);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.company-card-map:hover {
  background: rgba(15, 23, 42, 0.7);
  border-color: var(--neon-cyan);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.15);
}

.company-card-map__top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.company-card-map__logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  background: #1e293b;
}

.company-card-map__name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-card-map__meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.company-card-map__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--overlay-05);
  font-size: 12px;
}

.company-card-map__price {
  font-weight: 800;
  color: #fff;
}

/* RWD */
@media (max-width: 1024px) {
  .company-map__filters-grid {
    grid-template-columns: 1fr 1fr;
  }
  .company-map__canvas {
    height: 480px;
  }
}

@media (max-width: 640px) {
  .company-map__filters-grid {
    grid-template-columns: 1fr;
  }
  .company-map__canvas {
    height: 380px;
  }
}
