:root {
  --bg: #d4d2ce;
  --surface: #e8e6e3;
  --ink: #18181b;
  --muted: #71717a;
  --primary: #0ea5e9;
  --accent: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
  --space: 1rem;
  --transition: 150ms ease;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

button {
  font-family: 'Work Sans', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
}

/* HEADER & NAVIGATION */
.header {
  background: var(--surface);
  padding: 1.5rem var(--space);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.nav-bar {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.nav-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  text-decoration: none;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  margin-bottom: 0.75rem;
  color: var(--ink);
}

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

/* CONTAINER & LAYOUT */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space);
}

.tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #c8c6c1;
  justify-content: center;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.screen {
  display: none;
  animation: fadeIn 300ms ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* SPLIT VIEW */
.split-view {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.filters-panel {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 1rem;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.filter-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-btn {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  border: 1px solid #a8a5a0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--primary);
  background: #f5f4f1;
}

.filter-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  font-weight: 600;
}

.btn-reset {
  width: 100%;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid #a8a5a0;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 1rem;
}

.btn-reset:hover {
  background: #f5f4f1;
  border-color: var(--muted);
}

/* RESULTS PANEL */
.results-panel {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.results-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 1rem;
}

/* BUSINESS CARD */
.business-card {
  padding: 1.25rem;
  border: 2px solid #c8c6c1;
  border-radius: var(--radius);
  background: #ffffff;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

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

.business-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.trust-chip {
  position: absolute;
  top: -10px;
  right: 1rem;
  background: #ffffff;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  border: 2px solid;
  animation: chipPulse 1.5s ease-out;
}

@keyframes chipPulse {
  0% { transform: scale(0.95); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.trust-high {
  color: var(--success);
  border-color: var(--success);
}

.trust-mid {
  color: var(--warning);
  border-color: var(--warning);
}

.trust-low {
  color: var(--accent);
  border-color: var(--accent);
}

.business-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
  color: var(--ink);
}

.business-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.services {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.service-tag {
  padding: 0.25rem 0.6rem;
  background: #dbeafe;
  color: #0369a1;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.business-card > p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-box {
  background: #fee2e2;
  border-left: 4px solid var(--accent);
  padding: 0.75rem;
  margin-top: 0.75rem;
  border-radius: 4px;
}

.alert-box strong {
  color: #991b1b;
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.alert-box p {
  font-size: 0.85rem;
  color: #991b1b;
}

/* DETAIL VIEW */
.detail-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn-back {
  background: #ffffff;
  border: 1px solid #a8a5a0;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 1.5rem;
  transition: all var(--transition);
}

.btn-back:hover {
  background: #f5f4f1;
  border-color: var(--primary);
}

.btn-back:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.detail-header h2 {
  flex: 1;
}

.contact-box {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid #c8c6c1;
}

.contact-box p {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.contact-box strong {
  color: var(--ink);
  font-weight: 600;
}

.detail-header .business-meta {
  margin-top: 0.5rem;
}

.reviews-section {
  margin-top: 1.5rem;
}

.reviews-section h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.review {
  background: #ffffff;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid #c8c6c1;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.review-source {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.review-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
}

/* ALERTS SCREEN */
.alerts-container {
  max-width: 900px;
  margin: 0 auto;
}

.alerts-intro {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.fraud-cases-grid {
  display: grid;
  gap: 1.5rem;
}

.fraud-case {
  background: #ffffff;
  border: 2px solid var(--accent);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

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

.fraud-case h3 {
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.fraud-case-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.fraud-case-description {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.fraud-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.75rem 0;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.5px;
}

.fraud-case-note {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* AD SLOT */
.ad-slot {
  min-height: 0;
  margin: 2rem 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px dashed #a8a5a0;
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.ad-slot:empty {
  display: none;
}

.ad-slot[data-ad-slot-candidate]:before {
  content: 'Espacio publicitario';
  display: block;
  padding: 1rem;
  color: var(--muted);
}

/* FOOTER */
.footer {
  background: var(--surface);
  padding: 2rem var(--space);
  margin-top: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

.footer a {
  color: var(--primary);
}

.footer a:hover {
  color: var(--accent);
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .split-view {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .nav-links {
    gap: 1rem;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}

@media (max-width: 640px) {
  .header {
    padding: 1rem var(--space);
  }

  .nav-bar {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-link {
    padding: 0.5rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .tabs-nav {
    gap: 0.25rem;
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .split-view {
    gap: 1rem;
  }

  .filters-panel {
    padding: 1rem;
  }

  .results-panel {
    padding: 1rem;
  }

  .business-card {
    padding: 1rem;
  }

  .business-card h3 {
    font-size: 1.1rem;
  }

  .trust-chip {
    font-size: 0.95rem;
    padding: 0.3rem 0.75rem;
    right: 0.75rem;
    top: -8px;
  }

  .business-meta {
    font-size: 0.8rem;
    gap: 0.5rem;
  }

  .detail-container {
    padding: 1.5rem;
  }

  .detail-header {
    flex-direction: column;
  }

  .review-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .fraud-case {
    padding: 1rem;
  }

  .fraud-amount {
    font-size: 1.25rem;
  }

  .footer {
    padding: 1.5rem var(--space);
    font-size: 0.8rem;
  }
}

/* ACCESSIBILITY */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}