/* Modern Light Theme UI for OfertoMapa — Simplified Single Link Version */
:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-sidebar: #ffffff;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  --border-focus: #0d9488;
  
  --accent-primary: #0d9488;  /* Teal */
  --accent-secondary: #0284c7;/* Sky Blue */
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  
  --text-main: #0f172a;       /* Slate 900 */
  --text-muted: #475569;      /* Slate 600 */
  --text-dim: #94a3b8;        /* Slate 400 */
  
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header Navbar */
.navbar {
  height: 68px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 180px;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
  transition: transform 0.2s ease;
}

.brand-logo-img:hover {
  transform: scale(1.1) rotate(5deg);
}

.brand-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-text span {
  color: var(--accent-primary);
}

/* Search Bar */
.search-container {
  flex: 1;
  max-width: 960px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.url-guide-label {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  background: #ccfbf1;
  color: #0f766e;
  border: 1px dashed #0d9488;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.1);
  user-select: none;
  flex-shrink: 0;
}

.url-guide-label i {
  font-size: 1.05rem;
  color: #0d9488;
  animation: pulse-arrow 1.4s infinite ease-in-out;
}

@keyframes pulse-arrow {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  height: 44px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.btn-search {
  height: 44px;
  padding: 0 20px;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
  flex-shrink: 0;
}

.btn-search:hover {
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
}

.btn-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  line-height: 1.25;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-contact:hover {
  background: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* Main Split Content */
.main-container {
  flex: 1;
  display: flex;
  height: calc(100vh - 68px);
  position: relative;
}

/* Map Section */
.map-section {
  flex: 1;
  height: 100%;
  position: relative;
}

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

/* Map Controls Overlay */
.map-controls-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-btn {
  width: 38px;
  height: 38px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.control-btn:hover {
  background: #f8fafc;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.control-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Stats Bar floating on map */
.map-stats-banner {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 800;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border-light);
}

/* Sidebar Section */
.sidebar-section {
  width: 440px;
  height: 100%;
  background: #ffffff;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 900;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.count-badge {
  padding: 3px 10px;
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.select-custom, .input-mini {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 0.85rem;
}

.select-custom {
  flex: 1;
}

.input-mini {
  width: 90px;
}

/* Listings Scroll Container */
.listings-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

/* Offer Card */
.ad-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 140px;
  width: 100%;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.ad-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.ad-card.highlighted {
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 20px rgba(13, 148, 136, 0.2);
  background: #f0fdf4;
}

.card-top {
  display: flex;
  min-height: 110px;
  position: relative;
}

.card-img-wrapper {
  width: 130px;
  min-height: 110px;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ad-card:hover .card-img {
  transform: scale(1.05);
}

.no-img {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 28px;
}

.photo-count-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.75);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.card-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.card-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.location-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

.card-footer {
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.btn-card-action {
  padding: 4px 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.btn-card-action:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Custom Map Price Markers */
.custom-price-marker-wrapper {
  background: transparent !important;
  border: none !important;
  width: auto !important;
  height: auto !important;
}

.custom-price-marker {
  display: inline-block;
  background: #ffffff;
  border: 2px solid var(--accent-primary);
  border-radius: 12px;
  color: var(--accent-primary);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 10px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: center;
  width: max-content;
}

.custom-price-marker:hover, .custom-price-marker.active {
  background: var(--accent-primary);
  color: #ffffff;
  transform: scale(1.15);
  z-index: 1000 !important;
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-tip {
  background: #ffffff !important;
}

.popup-content {
  width: 260px;
  display: flex;
  flex-direction: column;
}

.popup-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.popup-body {
  padding: 12px;
}

.popup-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.popup-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.popup-location {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.popup-btn {
  width: 100%;
  padding: 6px;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
}

/* Detail Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: var(--accent-rose);
}

.modal-gallery {
  width: 100%;
  height: 340px;
  background: #0f172a;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-main-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
}

.modal-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-primary);
  white-space: nowrap;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.param-tag {
  padding: 6px 12px;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.param-tag strong {
  color: var(--text-main);
  margin-right: 4px;
}

.modal-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  white-space: pre-line;
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(13, 148, 136, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
}

/* Responsive design */
@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
  }
  .sidebar-section {
    width: 100%;
    height: 50%;
  }
  .map-section {
    height: 50%;
  }
}
