/* ── Mobile ──────────────────────────────────────────────────── */

.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 0.4rem;
  border-radius: 7px; align-items: center;
  transition: background 0.15s;
}
.hamburger:hover { background: var(--surface-2); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9;
  backdrop-filter: blur(3px);
}
.sidebar-overlay.open { display: block; }

/* ── Public nav links ────────────────────────────────────────── */

.pub-nav-link { transition: color 0.15s; }
.pub-nav-link.active { color: var(--text) !important; font-weight: 600; }
.pub-nav-link:hover { color: var(--text) !important; text-decoration: none; }

/* ── Public header ───────────────────────────────────────────── */

.pub-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.pub-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pub-brand {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
  text-decoration: none;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: -0.025em;
  transition: opacity 0.15s;
}
.pub-brand:hover { opacity: 0.82; text-decoration: none; color: var(--text); }
.pub-brand span { color: var(--brand); white-space: nowrap; }
.pub-nav { display: flex; align-items: center; gap: 1.5rem; }

/* ── Public footer ───────────────────────────────────────────── */

.pub-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.pub-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.pub-footer-brand {
  font-weight: 900;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: -0.02em;
}
.pub-footer-brand span { color: var(--brand); white-space: nowrap; }

/* ── Alert strip ─────────────────────────────────────────────── */

.alert-strip { padding: 0.65rem 1rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1rem; }
.alert-strip.warn { background: var(--warning-15); color: var(--warning); border: 1px solid rgba(242,176,70,0.28); }

/* ── Code block component (terminal style) ───────────────────── */

.code-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.code-block-dots { display: flex; gap: 6px; }
.code-block-dot { width: 10px; height: 10px; border-radius: 50%; }
.code-block-dot:nth-child(1) { background: #FF5F57; }
.code-block-dot:nth-child(2) { background: #FEBC2E; }
.code-block-dot:nth-child(3) { background: #28C840; }
.code-block-lang {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}
.code-block pre {
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  font-size: 0.82rem;
  line-height: 1.8;
}

/* ── Hero badge ──────────────────────────────────────────────── */

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-10);
  border: 1px solid var(--brand-25);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  color: var(--brand);
  margin-bottom: 1.5rem;
  font-weight: 600;
}
.hero-badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

/* ── Section headers ─────────────────────────────────────────── */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.5rem;
}
.section-header h2 { font-size: 1.2rem; font-weight: 700; }

/* ── Tooltip ─────────────────────────────────────────────────── */

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Animations ──────────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes contentEnter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-in { animation: fadeIn 0.25s ease both; }
@media (prefers-reduced-motion: reduce) {
  .animate-fade-in { animation: none; }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent !important;
}

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Progress bar ────────────────────────────────────────────── */

.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, #8B7EF0 100%);
  transition: width 0.4s ease;
}
.progress-bar-fill.success { background: linear-gradient(90deg, var(--success) 0%, #48D8A0 100%); }
.progress-bar-fill.warning { background: linear-gradient(90deg, var(--warning) 0%, #F5C862 100%); }
.progress-bar-fill.danger  { background: linear-gradient(90deg, var(--danger) 0%, #F07070 100%); }

/* ── User avatar ─────────────────────────────────────────────── */

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-15);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid var(--brand-25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
}

/* ── Nav item count badge ────────────────────────────────────── */

.nav-item-count {
  margin-left: auto;
  background: var(--brand-15);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .main-content { padding: 1.5rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Fix: mobile-header y main-content son flex-children en fila por defecto;
     en columna, el header queda arriba y el contenido abajo correctamente */
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    width: 80vw;
    max-width: 300px;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
  }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hamburger { display: flex; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 8;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
  }
  .mobile-header-logo {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
    letter-spacing: -0.025em;
  }
  .mobile-header-logo span { color: var(--brand); }
  /* Reduce animation distance on mobile */
  .main-content > * { animation-duration: 0.25s !important; }
}

@media (min-width: 769px) {
  .mobile-header { display: none !important; }
}
