/* ============================================
   MAKA DEFENSA - Layout (Header, Footer, Grid)
   ============================================ */

/* --- HEADER --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: var(--z-header);
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--header-border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: var(--z-header);
}

.header__logo img {
  height: 75px;
  width: auto;
}

.header__logo-text {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  color: var(--blanco);
}

/* --- NAV --- */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--gris-claro);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast);
  position: relative;
}

.nav__link:hover,
.nav__link.active {
  color: var(--blanco);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--azul-electrico);
  transition: width var(--transition-base);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 60%;
}

/* --- Mobile Menu Button --- */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  z-index: var(--z-header);
  cursor: pointer;
}

.nav__toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--blanco);
  transition: transform var(--transition-base), opacity var(--transition-fast);
  border-radius: 2px;
}

.nav__toggle-bar + .nav__toggle-bar {
  margin-top: 6px;
}

.nav__toggle.active .nav__toggle-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav__toggle.active .nav__toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav__toggle.active .nav__toggle-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* --- Mobile Nav Panel --- */
.nav__mobile-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--mobile-panel-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  z-index: calc(var(--z-header) - 1);
  transition: right var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-16) var(--space-8);
}

.nav__mobile-panel.open {
  right: 0;
}

.nav__mobile-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.nav__mobile-link {
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  color: var(--gris-claro);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  transition: color var(--transition-fast);
}

.nav__mobile-link:hover,
.nav__mobile-link.active {
  color: var(--azul-electrico);
}

.nav__mobile-cta {
  margin-top: var(--space-8);
}

/* --- FOOTER --- */
.footer {
  background: var(--navy-oscuro);
  border-top: var(--border-thin);
  padding: var(--space-16) 0 0;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-12);
  padding-bottom: var(--space-12);
}

.footer__brand p {
  color: var(--gris-texto);
  font-size: var(--text-sm);
  line-height: var(--lh-relaxed);
  margin-top: var(--space-4);
  max-width: 300px;
}

.footer__brand-logo {
  height: 36px;
  width: auto;
}

.footer__title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--blanco);
  margin-bottom: var(--space-6);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--gris-texto);
  transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.footer__link:hover {
  color: var(--azul-electrico);
  padding-left: var(--space-2);
}

.footer__contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  color: var(--gris-texto);
}

.footer__contact-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--azul-electrico);
}

.footer__social {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: var(--border-thin);
  color: var(--gris-texto);
  transition: all var(--transition-fast);
}

.footer__social-link:hover {
  color: var(--azul-electrico);
  border-color: var(--azul-electrico);
  box-shadow: var(--glow-azul);
}

.footer__social-link svg {
  width: 18px;
  height: 18px;
}

.footer__bottom {
  border-top: var(--border-thin);
  padding: var(--space-6) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__copyright {
  font-size: var(--text-xs);
  color: var(--gris-texto);
}

.footer__badges {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.footer__badge {
  font-size: var(--text-xs);
  color: var(--gris-texto);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--gris-borde);
  border-radius: var(--radius-sm);
}

/* --- WhatsApp Float --- */
.whatsapp-float {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 56px;
  height: 56px;
  background: var(--navy-medio);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-whatsapp);
  box-shadow: 0 4px 20px var(--accent-focus-ring);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.whatsapp-float:hover {
  transform: translateY(-3px);
  border-color: var(--azul-electrico);
  box-shadow: var(--glow-azul-fuerte);
  background: var(--accent-glow-10);
}

.whatsapp-float svg {
  width: 26px;
  height: 26px;
  fill: var(--azul-electrico);
  transition: fill var(--transition-fast);
}

.whatsapp-float:hover svg {
  fill: var(--azul-cielo);
}

/* --- Page Hero (interior pages) --- */
.page-hero {
  position: relative;
  height: 45vh;
  min-height: 350px;
  max-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: var(--gradiente-tech);
}

.page-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.page-hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: var(--img-filter-hero);
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--overlay-medium) 0%, var(--overlay-heavy) 100%);
  z-index: 1;
}

.page-hero__grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--accent-grid-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-grid-subtle) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 2;
}

.page-hero__content {
  position: relative;
  z-index: 3;
}

.page-hero__title {
  font-size: clamp(2rem, 5vw, var(--text-6xl));
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-4);
}

.page-hero__subtitle {
  font-size: var(--text-lg);
  color: var(--gris-texto);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--gris-texto);
  margin-bottom: var(--space-4);
  justify-content: center;
}

.breadcrumb a {
  color: var(--azul-electrico);
}

.breadcrumb__separator {
  color: var(--gris-borde);
}

/* --- Logo Filter (for theme switching) --- */
.header__logo img {
  filter: var(--logo-filter);
  transition: filter var(--transition-base);
}

.footer__brand-logo {
  filter: var(--logo-filter);
  transition: filter var(--transition-base);
}

/* --- Theme Toggle Button --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  color: var(--blanco);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-left: var(--space-4);
}

.theme-toggle:hover {
  border-color: var(--azul-electrico);
  background: var(--accent-glow-10);
  box-shadow: var(--glow-azul);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Show sun in dark mode, moon in light mode */
.theme-toggle__sun { display: block; }
.theme-toggle__moon { display: none; }
[data-theme="light"] .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle__moon { display: block; }

/* Light mode toggle styles */
[data-theme="light"] .theme-toggle {
  border-color: var(--gris-borde);
  background: rgba(0, 0, 0, 0.03);
  color: var(--gris-texto);
}

[data-theme="light"] .theme-toggle:hover {
  border-color: var(--azul-primario);
  color: var(--azul-primario);
}

/* --- Light Mode Overrides --- */
[data-theme="light"] .header.scrolled {
  background: var(--header-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .nav__link {
  color: var(--gris-texto);
}

[data-theme="light"] .nav__link:hover,
[data-theme="light"] .nav__link.active {
  color: var(--azul-primario);
}

[data-theme="light"] .nav__toggle-bar {
  background: var(--gris-texto);
}

[data-theme="light"] .nav__mobile-panel {
  background: var(--mobile-panel-bg);
}

[data-theme="light"] .nav__mobile-link {
  color: var(--gris-texto);
}

[data-theme="light"] .nav__mobile-link:hover,
[data-theme="light"] .nav__mobile-link.active {
  color: var(--azul-primario);
}

/* --- Language Switcher --- */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

.lang-switcher__link {
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.lang-switcher__link svg {
  width: 24px;
  height: 18px;
  border-radius: 2px;
  display: block;
}

.lang-switcher__link:hover {
  opacity: 0.85;
  transform: scale(1.1);
}

.lang-switcher__link.active {
  opacity: 1;
}

/* --- ISO Logo in Footer --- */
.footer__iso {
  margin-top: var(--space-4);
  background: #FFFFFF;
  border-radius: var(--radius-md);
  display: inline-block;
  padding: var(--space-2);
}

.footer__iso img {
  display: block;
  object-fit: contain;
  filter: none;
}

/* ============================================
   ACCOUNT SIDEBAR
   ============================================ */

/* --- Sidebar Trigger Button --- */
.sidebar-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gris-borde);
  background: transparent;
  color: var(--gris-texto);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.sidebar-trigger:hover {
  color: var(--azul-electrico);
  border-color: var(--azul-electrico);
  box-shadow: 0 0 12px rgba(0, 168, 255, 0.2);
}

.sidebar-trigger svg {
  width: 20px;
  height: 20px;
}

/* --- Sidebar Panel --- */
.account-sidebar {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  visibility: hidden;
}

.account-sidebar.is-open {
  pointer-events: auto;
  visibility: visible;
}

/* --- Overlay --- */
.account-sidebar__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.account-sidebar.is-open .account-sidebar__overlay {
  opacity: 1;
}

/* --- Drawer --- */
.account-sidebar__drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 360px;
  height: 100%;
  background: var(--navy-oscuro);
  border-left: 1px solid var(--gris-borde);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.account-sidebar.is-open .account-sidebar__drawer {
  transform: translateX(0);
}

/* --- Drawer Header --- */
.account-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--gris-borde);
}

.account-sidebar__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--blanco);
}

.account-sidebar__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--gris-borde);
  background: transparent;
  color: var(--gris-texto);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.account-sidebar__close:hover {
  color: var(--blanco);
  border-color: var(--gris-texto);
}

.account-sidebar__close svg {
  width: 18px;
  height: 18px;
}

/* --- Drawer Body --- */
.account-sidebar__body {
  flex: 1;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* --- Avatar Section --- */
.account-sidebar__avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
}

.account-sidebar__avatar-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gradiente-cta);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.account-sidebar__avatar-circle svg {
  width: 28px;
  height: 28px;
}

.account-sidebar__welcome {
  font-size: var(--text-sm);
  color: var(--gris-texto);
}

/* --- Auth Buttons --- */
.account-sidebar__auth {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.account-sidebar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  font-family: var(--font-principal);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.account-sidebar__btn--primary {
  background: var(--gradiente-cta);
  color: #fff;
  border: none;
}

.account-sidebar__btn--primary:hover {
  box-shadow: var(--glow-boton);
  transform: translateY(-1px);
}

.account-sidebar__btn--outline {
  background: transparent;
  color: var(--blanco);
  border: 1px solid var(--gris-borde);
}

.account-sidebar__btn--outline:hover {
  border-color: var(--azul-electrico);
  color: var(--azul-electrico);
}

/* --- Status Badge --- */
.account-sidebar__status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.2);
  border-radius: var(--radius-md);
}

.account-sidebar__status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--verde-exito);
  flex-shrink: 0;
  animation: sidebarPulse 2s ease-in-out infinite;
}

@keyframes sidebarPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
}

.account-sidebar__status-text {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--verde-exito);
  line-height: var(--lh-snug);
}

/* --- Section (Contact & Quick Links) --- */
.account-sidebar__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.account-sidebar__section-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--gris-texto);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
}

.account-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--gris-claro);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: all 0.2s ease;
}

.account-sidebar__link:hover {
  background: rgba(0, 168, 255, 0.08);
  color: var(--azul-electrico);
}

.account-sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--gris-texto);
  transition: color 0.2s ease;
}

.account-sidebar__link:hover svg {
  color: var(--azul-electrico);
}

/* --- Divider --- */
.account-sidebar__divider {
  height: 1px;
  background: var(--gris-borde);
}

/* --- Footer --- */
.account-sidebar__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--gris-borde);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.account-sidebar__social {
  display: flex;
  gap: var(--space-4);
}

.account-sidebar__social a {
  color: var(--gris-texto);
  transition: color 0.2s ease;
}

.account-sidebar__social a:hover {
  color: var(--azul-electrico);
}

.account-sidebar__social svg {
  width: 20px;
  height: 20px;
}

.account-sidebar__copyright {
  font-size: var(--text-xs);
  color: var(--gris-texto);
  opacity: 0.6;
}

/* --- Staggered Animation --- */
.account-sidebar__body > *,
.account-sidebar__footer {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.account-sidebar.is-open .account-sidebar__body > *,
.account-sidebar.is-open .account-sidebar__footer {
  opacity: 1;
  transform: translateY(0);
}

.account-sidebar.is-open .account-sidebar__body > *:nth-child(1) { transition-delay: 0.12s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(2) { transition-delay: 0.16s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(3) { transition-delay: 0.20s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(4) { transition-delay: 0.24s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(5) { transition-delay: 0.28s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(6) { transition-delay: 0.32s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(7) { transition-delay: 0.36s; }
.account-sidebar.is-open .account-sidebar__body > *:nth-child(8) { transition-delay: 0.40s; }
.account-sidebar.is-open .account-sidebar__footer { transition-delay: 0.44s; }
