/**
 * stbc-ui.css — Componentes UI universales STBC
 * Header sticky + grids compactos para index.html
 * Incluir en TODAS las páginas junto con stbc-ui.js
 */

/* ═══════════════════════════════════════════════════════════════════
   TOPBAR UNIVERSAL
   ═══════════════════════════════════════════════════════════════════ */
.stbc-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(var(--surface-rgb, 255,255,255), 0.92);
  border-bottom: 1px solid var(--border, #e2e5eb);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.stbc-topbar .back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e5eb);
  background: var(--surface2, #f8f9fb);
  color: var(--text2, #4a5568);
  font-size: 18px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.stbc-topbar .back-btn:hover {
  background: var(--surface3, #eef0f4);
  color: var(--text, #0d1117);
}

.stbc-topbar .logo-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0d1117);
  text-decoration: none;
  transition: opacity .15s;
}
.stbc-topbar .logo-link:hover { opacity: 0.75; }
.stbc-topbar .logo-link .emoji { font-size: 16px; }

.stbc-topbar .page-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2, #4a5568);
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stbc-topbar .theme-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e5eb);
  background: var(--surface2, #f8f9fb);
  font-size: 16px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.stbc-topbar .theme-btn:hover {
  border-color: var(--accent, #2563eb);
}

/* ═══════════════════════════════════════════════════════════════════
   GRIDS Y TILES COMPACTOS (para index.html)
   ═══════════════════════════════════════════════════════════════════ */
.stbc-section {
  margin-bottom: 22px;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.stbc-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text3, #8898aa);
  margin: 0 4px 10px;
}

.stbc-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stbc-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* Tile grande (destacado) */
.stbc-tile-lg {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e5eb);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text, #0d1117);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: transform .1s, box-shadow .15s, border-color .15s;
  margin-bottom: 10px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.stbc-tile-lg:active {
  transform: scale(0.98);
}
.stbc-tile-lg:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  border-color: var(--text3, #8898aa);
}
.stbc-tile-lg .tile-emoji {
  font-size: 28px;
  flex-shrink: 0;
}
.stbc-tile-lg .tile-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.stbc-tile-lg .tile-arrow {
  margin-left: auto;
  font-size: 18px;
  color: var(--text3, #8898aa);
  transition: transform .2s;
}
.stbc-tile-lg:hover .tile-arrow {
  transform: translateX(3px);
}

/* Tile chico (grid) */
.stbc-tile-sm {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e5eb);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text, #0d1117);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: transform .1s, box-shadow .15s, border-color .15s;
  text-align: center;
  min-height: 90px;
}
.stbc-tile-sm:active {
  transform: scale(0.96);
}
.stbc-tile-sm:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  border-color: var(--text3, #8898aa);
}
.stbc-tile-sm .tile-emoji {
  font-size: 24px;
}
.stbc-tile-sm .tile-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

/* ═══════════════════════════════════════════════════════════════════
   SPINNER + BOTONES LOADING
   ═══════════════════════════════════════════════════════════════════ */
.stbc-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: stbc-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes stbc-spin {
  to { transform: rotate(360deg); }
}
button.stbc-btn-loading,
.stbc-btn-loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════
   NAV BAR GRANDE (login pages)
   ═══════════════════════════════════════════════════════════════════ */
.stbc-nav-bar {
  position: sticky;
  bottom: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface, #ffffff);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border, #e2e5eb);
}
/* Barra inyectada por stbc-ui.js: siempre fija en la parte inferior */
.stbc-nav-bar-injected {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}
body.stbc-has-bottom-nav {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
.stbc-btn-nav {
  height: 56px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform .1s, box-shadow .15s;
  font-family: inherit;
}
.stbc-btn-nav:active { transform: scale(0.96); }
.stbc-btn-back {
  background: var(--surface2, #f7f8fa);
  color: var(--text2, #4a5568);
  border: 2px solid var(--border, #e2e5eb);
}
.stbc-btn-exit {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
}
.stbc-btn-success {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
}
.stbc-btn-nav .icon { font-size: 22px; line-height: 1; }

/* ═══════════════════════════════════════════════════════════════════
   MODAL STACK — deben quedar por encima de la barra inferior
   ═══════════════════════════════════════════════════════════════════ */
.stbc-modal-overlay,
.modal-overlay,
.pin-modal-overlay,
.rt-modal-overlay,
.sheet-overlay,
[class*="-modal-overlay"] {
  z-index: 1100 !important;
}
.stbc-modal-card,
.modal-content,
.pin-modal-card,
.rt-modal-card,
[class*="-modal-card"] {
  z-index: 1110;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 581px) {
  .stbc-tile-lg { padding: 20px 24px; }
  .stbc-tile-lg .tile-emoji { font-size: 32px; }
  .stbc-tile-lg .tile-text { font-size: 18px; }
  .stbc-tile-sm { min-height: 100px; }
  .stbc-tile-sm .tile-emoji { font-size: 28px; }
  .stbc-tile-sm .tile-text { font-size: 13px; }
}
