* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fafafa;
  color: #1f2937;
  line-height: 1.6;
  overflow: hidden;
}

.header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.logo img {
  height: 40px;
  width: auto;
}

.header-info h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.25rem;
}

.header-info p {
  font-size: 0.875rem;
  color: #6b7280;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  color: #6b7280;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f3f4f6;
}

.social-links a:hover {
  color: #111827;
  background: #e5e7eb;
}

.main-container {
  display: flex;
  height: calc(100vh - 84px);
  position: relative;
}

.map-wrapper {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.country-filter {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.country-filter select {
  border: none;
  background: transparent;
  font-size: 0.875rem;
  color: #374151;
  font-weight: 500;
  cursor: pointer;
  min-width: 160px;
}

.country-filter select:focus {
  outline: none;
}

.basemap-selector {
  position: relative;
}

.basemap-toggle {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.basemap-toggle:hover {
  background: #ffffff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.basemap-options {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-width: 160px;
  display: none;
}

.basemap-options.show {
  display: block;
}

.basemap-options button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
  transition: background 0.2s ease;
}

.basemap-options button:hover {
  background: #f3f4f6;
}

.basemap-options button.active {
  background: #3b82f6;
  color: white;
}

.sidebar {
  width: 400px;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-content {
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ranking-section {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
}

.ranking-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

#rankingList {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ranking-item:hover {
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ranking-position {
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 2rem;
  text-align: center;
}

.ranking-info {
  flex: 1;
}

.ranking-country {
  font-weight: 600;
  color: #111827;
  font-size: 0.875rem;
}

.ranking-stats {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.ranking-total {
  font-weight: 700;
  color: #3b82f6;
  font-size: 1.125rem;
}

.loading-stats {
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
  padding: 1rem;
  font-style: italic;
}

.error-state {
  text-align: center;
  color: #ef4444;
  font-size: 0.875rem;
  padding: 1rem;
  font-style: italic;
}

.country-stats {
  min-width: 200px;
}

.country-stats h3 {
  margin: 0 0 0.75rem 0;
  color: #111827;
  font-size: 1rem;
  font-weight: 600;
}

.country-stats p {
  margin: 0.25rem 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.country-stats-mini {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.8rem;
}

.location-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.location-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.location-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 15px -3px rgba(59, 130, 246, 0.4);
}

#locationStatus {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
}

.cta-section {
  background: linear-gradient(135deg, #10b981, #059669);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  color: white;
}

.cta-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.cta-section p {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1rem;
  background: white;
  color: #10b981;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.cta-btn:hover {
  background: #f9fafb;
  transform: translateY(-1px);
}

.nearby-section {
  flex: 1;
  min-height: 0;
}

.nearby-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

#nearbyList {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty-state {
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
  padding: 2rem;
  font-style: italic;
}

.professional-item {
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.professional-item:hover {
  background: #f3f4f6;
  transform: translateX(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.professional-item.empresa {
  border-left-color: #f59e0b;
}

.professional-item.persona {
  border-left-color: #10b981;
}

.professional-name {
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.professional-info {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.4;
}

.distance {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 500;
}

.form-section {
  display: none;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
}

.form-section.active {
  display: block;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.form-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.tipo-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tipo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  color: #6b7280;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.tipo-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.tipo-btn.active {
  border-color: #3b82f6;
  background: #3b82f6;
  color: white;
}

.coordinates-info {
  background: #f3f4f6;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  border: 2px dashed #d1d5db;
}

.coordinates-selected {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.location-form-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.location-form-btn:hover {
  background: #2563eb;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  color: #111827;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
  height: 80px;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #9ca3af;
}

.form-group input.error {
  border-color: #ef4444;
}

.error-message {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.required {
  color: #ef4444;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-submit {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-cancel {
  padding: 0.875rem 1rem;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.btn-cancel:hover {
  background: #e5e7eb;
  color: #374151;
}

.loading {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.mobile-panel-toggle {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 1rem;
  z-index: 1000;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #374151;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-panel-toggle:active {
  background: #f3f4f6;
}

.mobile-panel-toggle svg {
  transition: transform 0.3s ease;
}

.leaflet-popup-content {
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 280px;
}

.leaflet-popup-content h3 {
  margin: 0 0 0.75rem 0;
  color: #111827;
  font-size: 1rem;
  font-weight: 600;
}

.leaflet-popup-content p {
  margin: 0.5rem 0;
  color: #6b7280;
}

.leaflet-popup-content strong {
  color: #374151;
}

.leaflet-popup-content a {
  color: #3b82f6;
  text-decoration: none;
}

.leaflet-popup-content a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .header-info h1 {
    font-size: 1.25rem;
  }

  .header-info p {
    font-size: 0.8rem;
  }

  .social-links {
    gap: 0.75rem;
  }

  .social-links a {
    width: 32px;
    height: 32px;
  }

  .main-container {
    height: calc(100vh - 120px);
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    z-index: 1000;
    transition: bottom 0.3s ease;
    border-left: none;
    border-top: 1px solid #e5e7eb;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    bottom: 0;
  }

  .sidebar-content {
    padding: 1rem;
    gap: 1rem;
    height: calc(100% - 60px);
    margin-top: 60px;
  }

  .sidebar::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
  }

  .mobile-panel-toggle {
    display: flex;
  }

  .mobile-panel-toggle.hidden {
    display: none;
  }

  .map-controls {
    top: 0.75rem;
    right: 0.75rem;
  }

  .basemap-toggle {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .country-filter select {
    font-size: 0.8rem;
    min-width: 140px;
  }

  .ranking-section {
    padding: 1rem;
  }

  .ranking-item {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .ranking-position {
    font-size: 1rem;
    min-width: 1.5rem;
  }

  .ranking-country {
    font-size: 0.8rem;
  }

  .ranking-total {
    font-size: 1rem;
  }

  .form-section {
    margin-top: 0;
  }

  .tipo-selector {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .location-btn {
    padding: 0.875rem;
    font-size: 0.8rem;
  }

  .cta-section {
    padding: 1rem;
  }

  .cta-section h3 {
    font-size: 1rem;
  }

  .professional-item {
    padding: 0.75rem;
  }

  .professional-name {
    font-size: 0.875rem;
  }

  .professional-info {
    font-size: 0.8rem;
  }

  .loading {
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.5rem;
  }

  .header-content {
    gap: 0.5rem;
  }

  .header-info h1 {
    font-size: 1.125rem;
  }

  .logo img {
    height: 32px;
  }

  .social-links a {
    width: 28px;
    height: 28px;
  }

  .sidebar-content {
    padding: 0.75rem;
  }

  .stats-section {
    padding: 1rem;
  }

  .stats-grid {
    gap: 0.5rem;
  }

  .form-group input,
  .form-group textarea {
    padding: 0.625rem;
  }

  .location-form-btn,
  .cta-btn,
  .btn-submit {
    padding: 0.75rem;
  }
}