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

:root {
  --blue: #002D62;
  --red: #CE1126;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-400: #ced4da;
  --gray-600: #868e96;
  --gray-800: #343a40;
  --green: #2b8a3e;
  --radius: 8px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--blue);
  color: var(--white);
  padding: 1.5rem 1rem;
  text-align: center;
  border-bottom: 4px solid var(--red);
}

.header-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

/* Main */
main {
  flex: 1;
  padding: 1.5rem 1rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* Search Card */
.search-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 2px solid var(--blue);
  background: var(--white);
  color: var(--blue);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab.active {
  background: var(--blue);
  color: var(--white);
}

.tab:hover:not(.active) {
  background: var(--gray-100);
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

#searchInput {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

#searchInput:focus {
  border-color: var(--blue);
}

#searchBtn {
  padding: 0.75rem 1.5rem;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

#searchBtn:hover {
  opacity: 0.9;
}

#searchBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

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

.hidden {
  display: none;
}

/* Result Cards */
.result-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--blue);
}

.result-card .rnc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.result-card .rnc-number {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--blue);
  font-family: 'Consolas', 'Monaco', monospace;
}

.result-card .rnc-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-activo {
  background: #d3f9d8;
  color: var(--green);
}

.badge-inactivo {
  background: #ffe3e3;
  color: #c92a2a;
}

.badge-other {
  background: #fff3bf;
  color: #e67700;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.field {
  font-size: 0.85rem;
}

.field-label {
  color: var(--gray-600);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field-value {
  color: var(--gray-800);
  word-break: break-word;
}

/* Error */
.error-card {
  background: #fff5f5;
  border: 1px solid #ffc9c9;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: #c92a2a;
  text-align: center;
  font-weight: 500;
}

/* No results */
.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--gray-600);
}

/* Result count */
.result-count {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.8rem;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-200);
}

.footer-brand {
  margin-top: 0.25rem;
  font-weight: 600;
  color: var(--blue);
}

/* Mobile */
@media (max-width: 480px) {
  .input-group {
    flex-direction: column;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .result-card .rnc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .header-content h1 {
    font-size: 1.4rem;
  }
}
