/* ============================================
   Instrumental Quirúrgico — Design System v2
   Modern, clean, medical-grade redesign
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&family=Noto+Sans:wght@300;400;500;700&display=swap');

/* --- CSS Variables / Design Tokens --- */
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary: #059669;
  --secondary-hover: #047857;
  --secondary-light: #D1FAE5;
  --accent: #F97316;
  --accent-light: #FED7AA;
  --bg-body: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-nav: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --font-heading: 'Figtree', sans-serif;
  --font-body: 'Noto Sans', sans-serif;
  --max-width: 1200px;
  --header-height: 72px;
  --transition: 200ms ease;
}

/* --- Reset / Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  padding-top: var(--header-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: 0;
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

p { margin: 0 0 1rem; }

/* --- Skip Link --- */
#skip-link a {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  z-index: 10000;
  font-weight: 600;
}

#skip-link a:focus {
  top: 16px;
}

/* --- Header / Navigation --- */
header#header {
  display: none; /* Hide old Drupal header, we use the new nav */
}

#main-navigation {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
}

#main-navigation .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
}

#main-navigation-inside {
  display: flex;
  align-items: center;
  height: 100%;
}

/* Brand / Logo area */
#main-navigation-inside .row {
  display: flex;
  align-items: center;
  width: 100%;
}

#main-navigation-inside .col-md-12 {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 32px;
}

#logo {
  flex-shrink: 0;
}

#logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
}

#logo img {
  height: 40px;
  width: auto;
  border-radius: 0;
}

#site-name {
  display: none; /* Integrated into logo */
}

/* Mega Menu - Modern Restyle */
.tb-megamenu {
  position: relative;
}

.tb-megamenu-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  align-items: center;
}

.tb-megamenu-nav > li {
  position: relative;
}

.tb-megamenu-nav > li > a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.tb-megamenu-nav > li > a:hover,
.tb-megamenu-nav > li > a:focus {
  color: var(--primary);
  background: var(--primary-light);
}

.tb-megamenu-nav > li > a .caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 4px;
  transition: transform var(--transition);
}

.tb-megamenu-nav > li:hover > a .caret,
.tb-megamenu-nav > li:focus-within > a .caret {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.tb-megamenu-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 200ms ease;
  z-index: 1001;
  padding: 8px;
}

.tb-megamenu-nav > li:hover .tb-megamenu-submenu,
.tb-megamenu-nav > li:focus-within .tb-megamenu-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tb-megamenu-subnav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tb-megamenu-subnav li a {
  display: block;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all var(--transition);
  text-decoration: none;
}

.tb-megamenu-subnav li a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Mobile Nav Toggle */
.tb-megamenu-button {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-primary);
}

/* --- Banner --- */
#banner {
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 50%, #1D4ED8 100%);
  padding: 48px 0 40px;
  margin-top: 0;
}

#banner .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

#banner img {
  display: none; /* Hide Drupal image, use background */
}

#on-banner-title {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  color: white;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#banner .field-content {
  text-align: center;
}

/* --- Page Content --- */
#page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

#main-content {
  padding: 32px 0;
}

/* Content area */
#content-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 32px;
  margin: -20px auto 32px;
  position: relative;
  z-index: 10;
}

.node-content {
  max-width: 800px;
  margin: 0 auto;
}

/* Article styling */
article {
  line-height: 1.8;
}

article p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

/* Field items */
.field-items .field-item {
  margin-bottom: 24px;
}

.field-items .field-item:last-child {
  margin-bottom: 0;
}

/* Text fields */
.field-name-field-descripcion p {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

/* Highlighted text */
.texto-destacado {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 20px 24px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 24px 0;
}

.texto-destacado p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.texto-destacado a {
  font-weight: 600;
}

/* --- Thumbnail Grid (Categories) --- */
.views-bootstrap-thumbnail-plugin-style .row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 0;
}

.views-bootstrap-thumbnail-plugin-style .thumbnail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 300ms ease;
  display: flex;
  flex-direction: column;
}

.views-bootstrap-thumbnail-plugin-style .thumbnail:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.views-bootstrap-thumbnail-plugin-style .thumbnail img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}

.views-bootstrap-thumbnail-plugin-style .caption {
  padding: 16px 20px 20px;
}

.views-bootstrap-thumbnail-plugin-style .caption h3 {
  margin: 0;
  font-size: 1.1rem;
}

.views-bootstrap-thumbnail-plugin-style .caption h3 a {
  color: var(--text-primary);
  text-decoration: none;
}

.views-bootstrap-thumbnail-plugin-style .caption h3 a:hover {
  color: var(--primary);
}

/* --- Grid (New images) --- */
.views-bootstrap-grid-plugin-style .row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 0;
}

.views-bootstrap-grid-plugin-style .row > div {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 300ms ease;
}

.views-bootstrap-grid-plugin-style .row > div:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.views-bootstrap-grid-plugin-style img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}

.views-bootstrap-grid-plugin-style .caption {
  padding: 12px 16px 16px;
}

.views-bootstrap-grid-plugin-style .caption h3 {
  margin: 0;
  font-size: 0.95rem;
}

.views-bootstrap-grid-plugin-style .caption h3 a {
  color: var(--text-primary);
  text-decoration: none;
}

/* --- Amazon Product Grid --- */
.amazon-my-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.amazon-my-grid .amazon-my-item {
  width: 100% !important;
  padding: 0 !important;
}

.amazon-my-grid .thumbnail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 300ms ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

.amazon-my-grid .thumbnail:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.amazon-my-grid .producto {
  padding: 16px;
  text-align: center;
}

.amazon-my-grid .producto img {
  height: 150px;
  width: auto;
  object-fit: contain;
}

.amazon-my-grid .price {
  margin-top: 8px;
  font-weight: 700;
  color: var(--secondary);
  font-size: 1.1rem;
}

.amazon-my-grid .price .sin-rebaja {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.9rem;
  margin-right: 8px;
}

.amazon-my-grid .price .con-rebaja {
  color: #DC2626;
  font-weight: 700;
}

.amazon-my-grid .caption {
  padding: 12px 16px 16px;
  flex: 1;
}

.amazon-my-grid .caption h4 {
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.4;
}

.amazon-my-grid .caption h4 a {
  color: var(--text-primary);
  text-decoration: none;
}

.amazon-my-grid .caption h4 a:hover {
  color: var(--primary);
}

/* --- AdSense (Keep as is) --- */
.adsbygoogle {
  margin: 24px 0;
  border-radius: var(--radius-sm);
}

/* --- Social Sharing --- */
.a2a_kit {
  padding: 24px 0 16px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  text-align: center;
}

/* --- Cross-links (letprompt) --- */
div[style*="background:#f0fdf4"] {
  background: var(--secondary-light) !important;
  border-color: #86EFAC !important;
  border-radius: var(--radius) !important;
  padding: 20px 24px !important;
  margin: 24px 0 !important;
}

div[style*="background:#f0fdf4"] a {
  color: var(--secondary) !important;
}

/* --- Footer --- */
footer#subfooter {
  background: #0F172A;
  color: #94A3B8;
  padding: 40px 0;
  margin-top: 48px;
}

footer#subfooter .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

footer#subfooter .region-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

footer#subfooter .block {
  width: 100%;
}

footer#subfooter p {
  font-size: 0.85rem;
  margin: 0;
  color: #64748B;
}

footer#subfooter a {
  color: var(--primary-light);
}

/* --- Cookie Consent (already present, just restyle) --- */
.cc-window {
  font-family: var(--font-body) !important;
}

/* --- To Top Button --- */
#toTop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 999;
  transition: all var(--transition);
  border: none;
  opacity: 0;
}

#toTop:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* --- Messages / Errors --- */
.messages.error {
  display: none !important; /* Hide any remaining Drupal errors */
}

#messages-console {
  display: none !important;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .tb-megamenu-nav > li > a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 60px;
  }

  :root {
    --header-height: 60px;
  }

  #main-navigation-inside .col-md-12 {
    gap: 16px;
  }

  /* Mobile: hide mega menu, show hamburger */
  .tb-megamenu-button {
    display: block;
    margin-left: auto;
  }

  .nav-collapse {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    max-height: 80vh;
    overflow-y: auto;
  }

  .nav-collapse.always-show {
    display: none !important;
  }

  .nav-collapse.in {
    display: block !important;
  }

  .tb-megamenu-nav {
    flex-direction: column;
    gap: 0;
  }

  .tb-megamenu-nav > li > a {
    padding: 12px 16px;
    width: 100%;
    justify-content: space-between;
  }

  .tb-megamenu-submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 0 16px;
    min-width: auto;
  }

  #banner {
    padding: 32px 0 24px;
  }

  #on-banner-title {
    font-size: 1.6rem;
  }

  #content-wrapper {
    padding: 20px;
    margin-top: -12px;
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }

  .views-bootstrap-thumbnail-plugin-style .row {
    grid-template-columns: 1fr;
  }

  .views-bootstrap-grid-plugin-style .row {
    grid-template-columns: repeat(2, 1fr);
  }

  .amazon-my-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #toTop {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  #content-wrapper {
    padding: 16px;
    border-radius: var(--radius-sm);
  }

  .views-bootstrap-grid-plugin-style .row {
    grid-template-columns: 1fr;
  }

  .amazon-my-grid {
    grid-template-columns: 1fr;
  }

  #banner {
    padding: 24px 0 16px;
  }

  #on-banner-title {
    font-size: 1.3rem;
  }

  h1 { font-size: 1.4rem; }
}

/* --- Print styles --- */
@media print {
  #main-navigation, #toTop, .adsbygoogle, #banner, footer#subfooter {
    display: none !important;
  }

  body {
    padding-top: 0;
  }
}
