:root {
  --primary: #003D7A;
  --primary-dark: #002850;
  --primary-light: #0052B3;
  --accent-orange: #FF9900;
  --accent-gold: #C9A961;
  --black: #0a0a0a;
  --white: #ffffff;
  --gray-50: #f9f9f9;
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-400: #999;
  --gray-600: #555;
  --gray-800: #222;
}

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

html, body {
  font-family: Arial, sans-serif;
  width: 100%;
  margin: 0;
  padding: 0;
}

#bayi-bulucu-wrapper {
  width: 100%;
  display: block;
}

/* SEARCH PANEL */
.search-panel {
  background: white;
  border-radius: 20px;
  padding: 24px 28px;
  width: 900px;
  max-width: 100%;
  margin: 24px auto 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

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

.field-group select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--black);
  background: var(--gray-50);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s, background 0.2s;
}

.field-group select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: white;
}

.btn-search {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.btn-search:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-search:active { transform: translateY(0); }

/* MAIN LAYOUT */
.main-content {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 2rem;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.main-content.full-width {
  grid-template-columns: 1fr;
  justify-items: center;
}

.main-content.full-width .dealers-col {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

/* DEALER LIST */
.dealers-col {}

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

.dealers-count {
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
}

.dealers-count strong {
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  margin-right: 4px;
}

.dealers-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-right: 8px;
}

.dealers-list::-webkit-scrollbar { width: 4px; }
.dealers-list::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 4px; }
.dealers-list::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }
.dealers-list::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.dealer-card {
  background: white;
  border: 2px solid var(--gray-100);
  border-radius: 16px;
  padding: 20px 22px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.dealer-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--gray-200);
  transition: background 0.2s;
}

.dealer-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(232,0,29,0.1);
  transform: translateX(2px);
}

.dealer-card:hover::before { background: var(--primary); }
.dealer-card.active { border-color: var(--primary); box-shadow: 0 4px 24px rgba(232,0,29,0.15); }
.dealer-card.active::before { background: var(--primary); }

.dealer-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dealer-name {
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.badge {
  background: var(--accent-orange);
  color: var(--black);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.badge.blue { background: #e0f0ff; color: #0066cc; }

.dealer-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dealer-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12.5px;
  color: var(--gray-600);
  line-height: 1.4;
}

.dealer-meta-row svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.dealer-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dealer-phone {
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.dealer-phone:hover { color: var(--primary); }

.btn-directions {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  font-family: Arial, sans-serif;
}

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

.dealer-web {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
  flex: 1;
}

.dealer-web:hover {
  text-decoration: underline;
}

/* MAP */
.map-col {
  position: sticky;
  top: 16px;
  width: 100%;
  min-width: 0;
}

.map-col.hidden {
  display: none;
}

#map {
  width: 100%;
  height: calc(100vh - 120px);
  min-height: 400px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

/* ONLINE BADGE */
.badge.online {
  background: #FFF3E0;
  color: #FF9900;
  border: 1px solid #FFE0B2;
  font-weight: 700;
}

.dealer-card.online {
  border-left: 4px solid #FF9900 !important;
}

.dealer-card.online::before {
  background: #FF9900;
}

/* MAGAZA MARKER */
.marker-magaza { background: #003D7A; }
.marker-online { background: #FF9900; }

/* Leaflet custom marker */
.custom-marker {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 4px 12px rgba(232,0,29,0.4);
  cursor: pointer;
  transition: transform 0.2s;
}

.custom-marker.active {
  background: var(--black);
  transform: rotate(-45deg) scale(1.2);
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  border: none;
}

.leaflet-popup-content {
  margin: 14px 16px;
  font-family: Arial, sans-serif;
}

.popup-name {
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.popup-addr {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 8px;
  line-height: 1.4;
}

.popup-phone {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}

.empty-state svg { margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

@media (max-width: 900px) {
  .main-content { grid-template-columns: 1fr; }
  .main-content.full-width { grid-template-columns: 1fr; }
  .map-col { position: static; }
  #map { height: 360px; }
  .dealers-list { max-height: none; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .btn-search { grid-column: auto; }
  .search-panel {
    width: auto;
    margin: 16px;
  }
}

@media (max-width: 540px) {
  .search-row { grid-template-columns: 1fr; }
  .btn-search { grid-column: auto; }
  .search-panel { padding: 16px; margin: 12px; }
  .main-content { padding: 16px 1rem; }
}
