/* Header Navigation con Estándar Verde Petróleo */
header {
  height: var(--header-height);
  background: var(--petrol-grad-header);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(20, 184, 166, 0.22);
  box-shadow: 0 2px 14px rgba(2, 26, 31, 0.5);
}
.brand {
  font: 700 15px var(--font-sans);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand span { color: var(--petrol-300); }

.nav { display: flex; gap: 8px; align-items: center; }
.nav button, button {
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--slate-700);
  padding: 8px 16px;
  cursor: pointer;
  font: 600 13px var(--font-sans);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.nav button {
  background: transparent;
  border-color: transparent;
  color: #94a3b8;
}
.nav button:hover {
  color: #ffffff;
  background: rgba(20, 184, 166, 0.12);
}
.nav button.active {
  background: var(--petrol-grad-primary);
  border-color: #14b8a6;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.35);
}
.nav button.active:hover {
  background: var(--petrol-grad-hover);
  border-color: #2dd4bf;
}

.primary {
  background: var(--petrol-grad-primary);
  border: 1px solid #14b8a6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.28);
}
.primary:hover {
  background: var(--petrol-grad-hover);
  border-color: #2dd4bf;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.38);
  transform: translateY(-1px);
}

.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 34px; border-radius: 6px; }
.btn-outline { background: transparent; color: var(--slate-700); border: 1px solid var(--border-color); }
.btn-outline:hover { background: var(--petrol-50); color: var(--primary-hover); border-color: var(--primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #07353f; border-color: #0a434f; color: #ffffff; }
.btn-secondary:hover { background: #04272e; }

/* Layout & Views */
.layout { flex: 1; position: relative; overflow: hidden; height: calc(100vh - var(--header-height) - 32px); }
.view { position: absolute; inset: 0; display: none; }
.view.active-view { display: block; }

/* Badges & Spatial Status */
.badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-admin { background: #e0e7ff; color: #3730a3; }
.badge-user { background: #f3f4f6; color: #374151; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

.spatial-valid { background: #dcfce7; color: #166534; padding: 4px 8px; border-radius: 4px; font-weight: 600; font-size: 11px; }
.spatial-warning { background: #fef3c7; color: #92400e; padding: 4px 8px; border-radius: 4px; font-weight: 600; font-size: 11px; }

.user-grid { width: 100%; font-size: 13px; border-collapse: collapse; background: var(--card-bg); }
.user-grid th, .user-grid td { padding: 12px 10px; border-bottom: 1px solid var(--border-color); text-align: left; }
.action-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Auth Method Toggles */
.btn-auth-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  user-select: none;
}
.btn-auth-local-on {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.btn-auth-local-on:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
  transform: translateY(-1px);
}
.btn-auth-local-off {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
  opacity: 0.85;
}
.btn-auth-local-off:hover {
  background: #fee2e2;
  opacity: 1;
  transform: translateY(-1px);
}
.btn-auth-sso-on {
  background: #f0fdfa;
  color: #0f766e;
  border-color: #99f6e4;
}
.btn-auth-sso-on:hover {
  background: #ccfbf1;
  border-color: #5eead4;
  transform: translateY(-1px);
}
.btn-auth-sso-off {
  background: #f8fafc;
  color: #64748b;
  border-color: #cbd5e1;
  opacity: 0.85;
}
.btn-auth-sso-off:hover {
  background: #f1f5f9;
  opacity: 1;
  transform: translateY(-1px);
}

/* Checkboxes */
.reference { border-top: 1px solid var(--border-color); margin-top: 16px; padding-top: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 6px 14px 0 0; text-transform: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--slate-700); }
.check input { width: auto; min-height: 0; }

/* Footer */
footer {
  height: 32px;
  background: var(--slate-900);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* Botón de marca en cabecera (semántico sin chrome de botón estándar) */
.brand-trigger {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.brand-trigger:hover {
  background: transparent;
  opacity: 0.92;
}
.user-greeting-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 4px 12px;
  border-radius: 20px;
  color: #ffffff;
  font-weight: 600;
  font-size: 12px;
}

/* Elementos móviles ocultos por defecto en desktop */
.mobile-bottom-nav { display: none; }
.mobile-map-search-bar { display: none; }
.mobile-map-dock { display: none; }
.mobile-bottom-sheet { display: none; }
.mobile-cards-list { display: none; }
.mobile-menu-drawer { display: none; }

/* Ocultar barra de herramientas y navegación móvil durante el inicio de sesión */
body.not-authenticated .mobile-bottom-nav,
body.not-authenticated header#headerNav,
body.not-authenticated .mobile-map-search-bar,
body.not-authenticated .mobile-map-dock,
body.not-authenticated .mobile-bottom-sheet,
body.not-authenticated #mobileMenuDrawer,
body.not-authenticated #floatingBasemapSwitcher,
#loginView:not([style*="display: none"]) ~ .mobile-bottom-nav,
#loginView:not([style*="display: none"]) ~ header#headerNav,
#loginView:not([style*="display: none"]) ~ .mobile-map-search-bar,
#loginView:not([style*="display: none"]) ~ .mobile-map-dock,
#loginView:not([style*="display: none"]) ~ .mobile-bottom-sheet,
#loginView:not([style*="display: none"]) ~ #mobileMenuDrawer,
#loginView:not([style*="display: none"]) ~ #floatingBasemapSwitcher {
  display: none !important;
}

/* Ocultar barra de navegación inferior móvil en Home (solo presente dentro de las herramientas) */
body:has(#homeView.active-view) #mobileBottomNav,
main.layout:has(#homeView.active-view) ~ #mobileBottomNav {
  display: none !important;
}


/* User Profile Menu & Role Switcher (Aero-Geológico) */
.user-profile-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-profile-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(47, 168, 132, 0.35);
  border-radius: 20px;
  padding: 4px 10px 4px 5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #f1f5f9;
}

.user-profile-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(47, 168, 132, 0.6);
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #C87D55);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.user-info-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.15;
}

.user-display-name {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 4px;
}

.user-role-badge.badge-admin {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
}

.user-role-badge.badge-vip {
  color: #f59e0b;
  background: rgba(200, 125, 85, 0.2);
}

.user-role-badge.badge-estandar {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.15);
}

.user-caret-icon {
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.user-profile-menu-wrap.is-open .user-caret-icon {
  transform: rotate(180deg);
}

/* Header Right Actions & Quick Nav */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(47, 168, 132, 0.35);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  margin-left: 14px;
  transition: all 0.2s ease;
  min-height: auto;
}

.header-back-home-btn:hover {
  background: rgba(47, 168, 132, 0.25);
  border-color: rgba(47, 168, 132, 0.6);
  color: #ffffff;
  transform: translateX(-2px);
}

.btn-theme-header {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: auto;
}

.btn-theme-header:hover {
  background: rgba(47, 168, 132, 0.2);
  border-color: rgba(47, 168, 132, 0.5);
  color: #ffffff;
}

/* Dropdown Flotante Glassmorphism (SaaS Perfil & Suscripción) */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: 290px;
  background: rgba(17, 24, 34, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(47, 168, 132, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 16px rgba(47, 168, 132, 0.12);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-profile-menu-wrap.is-open .user-profile-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile-dropdown-header {
  padding: 10px;
  background: rgba(8, 40, 32, 0.7);
  border: 1px solid rgba(47, 168, 132, 0.25);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.profile-header-name {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-header-handle {
  font-size: 11px;
  color: #94a3b8;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-plan-container {
  display: flex;
}

.profile-plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.profile-plan-pill.pill-admin {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.profile-plan-pill.pill-vip {
  background: rgba(200, 125, 85, 0.2);
  border: 1px solid rgba(200, 125, 85, 0.5);
  color: #f59e0b;
}

.profile-plan-pill.pill-estandar {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
}

/* Capacidades del Plan */
.profile-saas-features {
  background: rgba(8, 40, 32, 0.45);
  border: 1px solid rgba(47, 168, 132, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
}

.profile-features-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 6px;
}

.profile-features-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.profile-features-list .feat-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #cbd5e1;
}

.profile-features-list .feat-item .feat-ico {
  width: 13px;
  height: 13px;
  stroke: #10b981;
  stroke-width: 3;
  fill: none;
  flex-shrink: 0;
}

.profile-features-list .feat-item.feat-locked {
  color: #64748b;
}

.profile-features-list .feat-item.feat-locked .feat-ico {
  stroke: #94a3b8;
  opacity: 0.5;
}

/* Upgrade Banner para Plan Estándar */
.profile-upgrade-banner {
  background: linear-gradient(135deg, rgba(200, 125, 85, 0.22), rgba(184, 115, 51, 0.14));
  border: 1px solid rgba(200, 125, 85, 0.45);
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-upgrade-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  color: #f8fafc;
  line-height: 1.35;
}

.profile-upgrade-star {
  font-size: 16px;
  flex-shrink: 0;
}

.profile-upgrade-btn {
  background: linear-gradient(135deg, #C87D55, #B87333);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(200, 125, 85, 0.35);
  transition: all 0.2s ease;
  min-height: auto;
}

.profile-upgrade-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.profile-dropdown-footer {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-footer-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  cursor: pointer;
  min-height: auto;
}

.profile-footer-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.profile-footer-btn.logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
