/**
 * Component Styles - Reusable UI Components
 */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-weight: var(--font-medium);
  font-size: var(--text-base);
  line-height: 1;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--brand);
}

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-outline:hover {
  background: var(--brand-light);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-lg);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-bottom: 0;
}

.card-body {
  color: var(--text-secondary);
}

/* Glass Card */
.card-glass {
  background: var(--glass);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--brand-light);
  color: var(--brand);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warn {
  background: var(--warn-light);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-left: var(--space-2);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--brand);
  color: var(--brand);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.theme-toggle i {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-base);
  stroke-width: 2;
}

.theme-toggle:hover i {
  transform: rotate(15deg);
}

/* Search Bar */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 600px;
}

.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Hero Map Container */
.hero-map {
  position: relative;
  width: 100%;
  height: 600px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--space-8);
}

.hero-map .hero-leaflet-map,
.hero-map .leaflet-container {
  width: 100%;
  height: 100%;
  background: var(--surface);
}

.hero-map .leaflet-container {
  font-family: var(--font-sans);
  border-radius: var(--radius-lg);
}

.hero-map .leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: var(--text-xs);
}

.hero-map .leaflet-control-zoom a {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.hero-map .leaflet-control-zoom a:hover {
  background: var(--surface-hover);
}

.hero-map-tooltip {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 6px 12px !important;
}

.hero-map-fallback,
.hero-map .hero-map-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-secondary);
  background: var(--surface);
}

.hero-map-fallback i {
  width: 56px;
  height: 56px;
  color: var(--brand);
}

@media (max-width: 768px) {
  .hero-map {
    height: 400px;
  }
}

/* Section Header */
.section-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.section-header h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.section-header p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

/* Featured Grid */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Town Card */
.town-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
  text-decoration: none;
  display: block;
}

.town-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.town-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.town-card-content {
  padding: var(--space-4);
}

.town-card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
  color: var(--text);
}

.town-card-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

/* Business Card */
.business-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
}

.business-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.business-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
  background: var(--bg-secondary);
}

.business-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
  color: var(--text);
}

.business-card-meta {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Event Card */
.event-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  display: flex;
  gap: var(--space-4);
  transition: all var(--transition-base);
}

.event-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateX(4px);
}

.event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  padding: var(--space-2);
  background: var(--brand-light);
  border-radius: var(--radius);
  color: var(--brand);
}

.event-date-day {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  line-height: 1;
}

.event-date-month {
  font-size: var(--text-xs);
  text-transform: uppercase;
  font-weight: var(--font-medium);
}

/* Job Card */
.job-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
}

.job-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.job-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--space-3);
  gap: var(--space-3);
}

.job-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: 0;
  color: var(--text);
}

.job-type {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--brand-light);
  color: var(--brand);
  white-space: nowrap;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

.pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-2);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
}

.pagination-link:hover {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
}

.pagination-link.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-secondary);
}

.empty-state i {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-base);
}

