/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #10b981;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== CONTAINER ===== */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-icon {
  font-size: 1.5rem;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.breadcrumb-item {
  color: var(--text-light);
}

.breadcrumb-item.active {
  color: var(--text);
  font-weight: 600;
}

.breadcrumb-item a {
  color: var(--primary);
  transition: color 0.2s;
}

.breadcrumb-item a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.breadcrumb-sep {
  margin: 0 0.25rem;
  color: var(--border);
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  margin-bottom: 2rem;
}

.search-bar input {
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-bar input::placeholder {
  color: var(--text-light);
}

/* ===== SECTION ===== */
.directory-section {
  margin-bottom: 3rem;
}

.directory-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ===== CARD GRID ===== */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* ===== CARD ===== */
.card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: transform 0.15s;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 88px;
}

.card:hover {
  transform: translateY(-2px);
}

.card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.card-flag {
  font-size: 2rem;
  flex-shrink: 0;
}

.card-flag-img {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  flex-shrink: 0;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
}

.card-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  border-radius: 50%;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.card-info p {
  font-size: 0.875rem;
  color: var(--text-light);
}

.card-arrow {
  font-size: 1.5rem;
  color: var(--text-light);
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}

.card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* ===== TECHNICIAN CARD ===== */
.tech-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: transform 0.15s;
}

.tech-card:hover {
  transform: translateY(-2px);
}

.tech-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.tech-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.tech-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.tech-badge.available {
  background: #dcfce7;
  color: #166534;
}

.tech-badge.unavailable {
  background: #fee2e2;
  color: #991b1b;
}

.tech-rating {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.tech-rating .stars {
  color: #f59e0b;
}

.tech-address {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.tech-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
}

.btn-whatsapp:hover {
  background: #1da851;
}

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

.btn-outline:hover {
  background: #eff6ff;
}

.btn-alt {
  background: #f1f5f9;
  color: var(--text);
}

.btn-alt:hover {
  background: #e2e8f0;
}

/* ===== LOAD MORE ===== */
.load-more-wrap {
  text-align: center;
  padding: 2rem 0;
}

.load-more-count {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.empty-state p {
  font-size: 1rem;
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

/* ===== PAGE HEADER ===== */
.page-header {
  padding: 2rem 0 1rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--text-light);
  font-size: 1rem;
}

.page-flag {
  width: 40px;
  height: 27px;
  object-fit: cover;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ===== LOADING STATE ===== */
.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

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

.loading-state p {
  font-size: 1rem;
}

/* ===== TOOLBAR (Sort + Filter) ===== */
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar select {
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.toolbar select:focus {
  border-color: var(--primary);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.filter-toggle input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===== MOBILE MENU ===== */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
  border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 639px) {
  .menu-toggle {
    display: block;
  }

  .breadcrumb {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }

  .breadcrumb.open {
    display: flex;
  }

  .breadcrumb-sep {
    display: none;
  }

  .breadcrumb-item {
    padding: 0.25rem 0;
  }
}

/* ===== ERROR PAGE ===== */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}

.error-page .error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-page h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.error-page p {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .hero h1 {
    font-size: 2.5rem;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
