:root {
  color-scheme: light;

  /* Google DESIGN.md-compatible BUSCADOC tokens */
  --bd-primary: #005387;
  --bd-primary-bright: #0071c2;
  --bd-primary-deep: #003a5e;
  --bd-secondary: #19b6ea;
  --bd-bg: #f5f8fa;
  --bd-surface: #ffffff;
  --bd-surface-soft: #f8fbfe;
  --bd-surface-glass: rgba(255, 255, 255, 0.76);
  --bd-line: #e3e9ef;
  --bd-line-strong: #b7c7d6;
  --bd-text: #1a202c;
  --bd-muted: #4a5568;
  --bd-success: #008766;
  --bd-success-bg: #e6fffa;
  --bd-warning: #ffcd4a;
  --bd-error: #e53e3e;

  --bd-font: "Nunito Sans", "Segoe UI Variable", "Segoe UI", sans-serif;
  --bd-radius-sm: 8px;
  --bd-radius-md: 16px;
  --bd-radius-lg: 24px;
  --bd-radius-pill: 9999px;
  --bd-space-xs: 4px;
  --bd-space-sm: 8px;
  --bd-space-md: 16px;
  --bd-space-lg: 24px;
  --bd-space-xl: 32px;
  --bd-space-section: 64px;
  --bd-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.04);
  --bd-shadow-hover: 0 16px 40px rgba(13, 47, 80, 0.10);
  --bd-focus-ring: 0 0 0 4px rgba(0, 113, 194, 0.18);

  /* Backward-compatible aliases used by existing pages */
  --blue-main: var(--bd-primary-bright);
  --blue-deep: var(--bd-primary-deep);
  --blue-light: #f0f7ff;
  --ink: #10263f;
  --muted: var(--bd-muted);
  --line: var(--bd-line);
  --bg: var(--bd-bg);
  --white: var(--bd-surface);
}

/* Defaults defensivos — aplicables a páginas que no declaran su propio body */
html { background: var(--bd-bg); scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--bd-font);
  color: var(--bd-text);
  background: var(--bd-bg);
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
img, svg, video { max-width: 100%; }
a { text-underline-offset: 3px; }

:focus-visible {
  outline: 0;
  box-shadow: var(--bd-focus-ring) !important;
}

::selection {
  background: rgba(25, 182, 234, 0.24);
  color: var(--bd-text);
}

.bd-container,
.container,
.section-block,
.top .wrap {
  max-width: min(1220px, 92vw);
}

.bd-card,
.doctor-card,
.panel,
.trust-card,
.hero-blog-card {
  border-radius: var(--bd-radius-md);
  border-color: var(--bd-line);
  box-shadow: var(--bd-shadow-card);
}

.bd-card {
  background: var(--bd-surface);
  border: 1px solid var(--bd-line);
  padding: var(--bd-space-lg);
}

.bd-glass,
.glass {
  background: var(--bd-surface-glass) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.38) !important;
}

.bd-kicker {
  color: var(--bd-primary-bright);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.bd-muted {
  color: var(--bd-muted);
}

.bd-verified,
.verified,
.verified-badge {
  background: var(--bd-success-bg) !important;
  color: var(--bd-success) !important;
  border-radius: var(--bd-radius-pill) !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.bd-search-shell,
.search-shell,
.search-wrap {
  border: 1px solid var(--bd-line);
  box-shadow: 0 10px 30px rgba(0, 58, 94, 0.15);
}

.bd-search-shell input,
.search-shell input,
.search-wrap input {
  color: #143a5e;
}

.bd-search-shell input::placeholder,
.search-shell input::placeholder,
.search-wrap input::placeholder {
  color: #6f88a2;
}

/* Topbar estándar */
.top {
  background: var(--blue-main);
  color: #fff;
}
.top .wrap {
  width: min(1220px, 92vw);
  margin: 0 auto;
}
.top .nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top .brand {
  display: inline-flex;
  align-items: center;
}
.top .brand img {
  width: clamp(135px, 19vw, 200px);
  height: auto;
  display: block;
  object-fit: contain;
}
.top .back-link,
.top .back-link:visited,
.nav .back-link,
.nav .back-link:visited {
  background: transparent !important;
  color: #fff !important;
  border: 0 !important;
  text-decoration: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto !important;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.top .back-link:hover,
.nav .back-link:hover { background: rgba(255,255,255,0.12) !important; }
.top .back-link svg,
.nav .back-link svg { display: block; stroke: #fff; }
.top .back-link:hover {
  background: var(--blue-deep);
  color: #fff;
  border-color: var(--blue-deep);
}
@media (max-width: 760px) {
  .top .nav {
    min-height: auto;
    padding: 12px 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .top .brand img { max-width: 60vw; }
  /* Botones del nav (Volver, home, etc) SIEMPRE alineados al borde derecho en mobile */
  .top .links,
  .top .top-actions,
  .top .nav > div:not(.brand) {
    margin-left: auto !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .top .nav .back-link,
  .top .nav .top-link,
  .top .nav .links a {
    margin-left: 0 !important;
  }
}

/* Global Premium Button Styles */
.btn-pill, .btn-pill:visited {
  background: var(--bd-surface);
  border: 1px solid var(--bd-line);
  color: var(--bd-primary-deep);
  padding: 8px 20px;
  border-radius: var(--bd-radius-pill);
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  cursor: pointer;
  line-height: 1.1;
  white-space: nowrap;
}

.btn-pill:hover {
  background: var(--bd-primary-bright);
  color: var(--bd-surface);
  border-color: var(--bd-primary-bright);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(17, 119, 200, 0.2);
}

.bd-button-primary,
.btn-primary-solid,
.search-btn {
  background: var(--bd-primary-bright) !important;
  color: var(--bd-surface) !important;
  border: 1px solid var(--bd-primary-bright) !important;
  border-radius: var(--bd-radius-sm);
  min-height: 44px;
  font-weight: 800;
}

.bd-button-primary:hover,
.btn-primary-solid:hover,
.search-btn:hover {
  background: var(--bd-primary-deep) !important;
  border-color: var(--bd-primary-deep) !important;
}

.bd-button-secondary,
.btn-white-to-blue {
  border-radius: var(--bd-radius-sm);
}

.btn-white-to-blue {
  position: relative;
  overflow: hidden;
}

/* Infinite Shine Effect (must be used with animations.css) */
.btn-white-to-blue::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transform: skewX(-20deg);
  pointer-events: none;
}

.btn-white-to-blue:hover::after {
  animation: glassShineInfinite 3s ease-in-out infinite;
}

/* Global Footer Styles */
.mega-footer {
  background: #f8fbfe;
  border-top: 1px solid var(--line);
  padding: 60px 0 30px;
  margin-top: 50px;
}

.mega-footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.mega-footer h5 {
  color: var(--blue-deep);
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 20px;
}

.mega-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-footer ul li {
  margin-bottom: 12px;
}

.mega-footer ul li a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.mega-footer ul li a:hover {
  color: var(--blue-main);
  padding-left: 5px;
}

.footer-brand-logo {
  height: 48px; /* Increased from 40px */
  margin-bottom: 20px;
}

@media (max-width: 760px) {
  .bd-card,
  .doctor-card,
  .panel,
  .trust-card,
  .hero-blog-card {
    border-radius: 14px;
  }

  .btn-pill,
  .bd-button-primary,
  .bd-button-secondary,
  .btn-primary-solid,
  .search-btn {
    min-height: 42px;
  }

  .mega-footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
