/* components.css — piezas reutilizables. */

/* ---------- Cabecera ---------- */
.page-head { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; }
.page-head h1 { font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.02em; flex: 1; min-width: 0; }
.page-head .head-actions { display: flex; gap: var(--space-2); }
.hero { margin-top: var(--space-6); }
.hero .eyebrow { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.hero h1 { font-size: var(--fs-hero); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin-top: var(--space-1); }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .stats { margin-top: var(--space-3); color: var(--text-secondary); font-weight: 500; }
.project-desc { color: var(--text-secondary); margin-top: var(--space-2); max-width: 70ch; }

.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--fs-md); letter-spacing: -0.01em; color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6B5CFF, #2EC4B6); color: #fff; font-size: 16px; box-shadow: var(--shadow-primary);
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-5); border-radius: var(--radius-md);
  font-weight: 700; line-height: 1.25; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast), box-shadow var(--t);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary-solid); color: var(--on-primary); box-shadow: var(--shadow-primary); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { color: var(--primary); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 var(--space-4); font-size: var(--fs-sm); }

.icon-btn {
  width: 44px; height: 44px; border-radius: var(--radius-sm); display: inline-grid; place-items: center;
  font-size: 20px; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.plain { background: none; border-color: transparent; }

/* ---------- Buscador ---------- */
.search {
  display: flex; align-items: center; gap: var(--space-2); height: 48px; padding: 0 var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: var(--space-6);
}
.search i { color: var(--text-muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 100%; }

/* ---------- Rejillas ---------- */
.grid-projects { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-decks { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 72%); gap: var(--space-4);
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--space-2);
  margin: 0 calc(var(--space-5) * -1); padding-inline: var(--space-5); scrollbar-width: none;
}
.row-scroll::-webkit-scrollbar { display: none; }
.row-scroll > * { scroll-snap-align: start; }
@media (min-width: 720px) { .row-scroll { grid-auto-columns: 280px; } }
.empty-wide { grid-column: 1 / -1; }

/* ---------- Tarjeta de proyecto ---------- */
.project-card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); color: var(--text);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t);
}
.project-card:active { transform: scale(.985); }
@media (hover: hover) { .project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); } }
.project-cover { position: relative; height: 128px; overflow: hidden; }
.project-cover .mesh { position: absolute; inset: 0; }
.project-cover .initials {
  position: absolute; left: var(--space-5); bottom: var(--space-3); font-size: 44px; font-weight: 800;
  letter-spacing: -0.04em; color: rgba(255, 255, 255, .92); text-shadow: 0 2px 18px rgba(0, 0, 0, .18);
}
.project-cover .stack { position: absolute; right: var(--space-4); bottom: -18px; display: flex; }
.project-cover .stack img {
  width: 92px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .45); margin-left: -46px; transform: rotate(-4deg);
}
.project-cover .stack img:nth-child(2) { transform: rotate(3deg) translateY(-6px); }
.project-cover .stack img:nth-child(3) { transform: rotate(-1deg) translateY(-12px); }
.project-body { padding: var(--space-4) var(--space-5) var(--space-5); display: grid; gap: 2px; }
.project-body h3 { font-size: var(--fs-md); font-weight: 750; }
.project-body .meta { font-size: var(--fs-sm); color: var(--text-muted); }
.project-body .latest { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: var(--space-1); }

/* ---------- Tarjeta de presentación ---------- */
.deck-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); color: var(--text); min-width: 0; }
.deck-card .thumb { transition: transform var(--t) var(--ease-out), box-shadow var(--t); }
.deck-card:active .thumb { transform: scale(.985); }
@media (hover: hover) { .deck-card:hover .thumb { transform: translateY(-3px); box-shadow: var(--shadow-lift); } }
.deck-info { display: flex; align-items: flex-start; gap: var(--space-2); }
.deck-info .text { flex: 1; min-width: 0; }
.deck-info h3 { font-size: var(--fs-base); font-weight: 700; }
.deck-info .meta { font-size: var(--fs-sm); color: var(--text-muted); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.deck-info .icon-btn { width: 44px; height: 44px; margin: -6px -10px 0 0; }

.thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow-card);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb iframe {
  position: absolute; top: 0; left: 0; width: 1280px; height: 720px; border: 0; pointer-events: none;
  transform-origin: 0 0; transform: scale(var(--s, .25)); background: #fff; opacity: 0; transition: opacity .4s;
}
.thumb iframe.ready { opacity: 1; }
.thumb .shield { position: absolute; inset: 0; }
.thumb .poster { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: var(--space-4); color: #fff; }
.thumb .poster b { font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; text-shadow: 0 2px 16px rgba(0, 0, 0, .2); }
.thumb .kind-badge {
  position: absolute; top: var(--space-3); left: var(--space-3); padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; background: rgba(10, 10, 20, .62); color: #fff; backdrop-filter: blur(8px);
}
.thumb .play {
  position: absolute; right: var(--space-3); bottom: var(--space-3); width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #16152B; font-size: 18px;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .5); opacity: 0; transform: scale(.85);
  transition: opacity var(--t), transform var(--t) var(--ease-out);
}
@media (hover: hover) { .deck-card:hover .play { opacity: 1; transform: none; } }
@media (hover: none) { .thumb .play { opacity: 1; transform: none; } }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-secondary);
}
.tag.primary { background: var(--primary-soft); color: var(--primary); }

/* ---------- Barra inferior ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  padding-bottom: var(--safe-bottom); background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.bottom-nav .inner { max-width: 560px; margin: 0 auto; height: var(--nav-height); display: flex; align-items: center; }
.nav-item {
  flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.nav-item .pill { width: 56px; height: 30px; border-radius: var(--radius-full); display: grid; place-items: center; font-size: 20px; transition: background var(--t); }
.nav-item[aria-current="page"] { color: var(--text); }
.nav-item[aria-current="page"] .pill { background: var(--primary-soft); color: var(--primary); }
.nav-add { flex: 1 1 0; display: grid; place-items: center; }
.nav-add button {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; color: #fff;
  background: linear-gradient(135deg, #6B5CFF, #4F44CE 60%, #3B32A8); box-shadow: var(--shadow-primary);
  transform: translateY(-10px); transition: transform var(--t-fast) var(--ease-out);
}
.nav-add button:active { transform: translateY(-10px) scale(.94); }

/* ---------- Hojas ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 1000; background: var(--veil); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade 200ms ease both;
}
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100dvh - var(--safe-top) - 24px); overflow: auto;
  background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-3) var(--space-5) calc(var(--safe-bottom) + var(--space-5));
  animation: sheet-up 320ms var(--ease-out) both;
}
@media (min-width: 720px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: var(--radius-xl); padding-bottom: var(--space-6); }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto var(--space-3); }
.sheet-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.sheet-head h2 { flex: 1; font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.01em; }
.sheet-foot { margin-top: var(--space-5); display: grid; gap: var(--space-2); }
.sheet p.lead { color: var(--text-secondary); }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; margin-top: var(--space-4); }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.input {
  width: 100%; min-height: 48px; padding: 12px var(--space-4); border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid transparent; outline: none; transition: border-color var(--t-fast), background var(--t-fast);
}
.input:focus { border-color: var(--primary); background: var(--surface); }
textarea.input { min-height: 88px; resize: vertical; }
.segmented { display: flex; background: var(--surface-2); border-radius: var(--radius-md); padding: 4px; gap: 4px; }
.segmented button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 600; color: var(--text-secondary); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }

.dropzone {
  position: relative; display: grid; place-items: center; gap: var(--space-2); text-align: center;
  padding: var(--space-8) var(--space-4); border-radius: var(--radius-lg); border: 2px dashed var(--surface-3);
  background: var(--surface-2); transition: border-color var(--t), background var(--t);
}
.dropzone i { font-size: 34px; color: var(--primary); }
.dropzone b { font-weight: 700; }
.dropzone span { font-size: var(--fs-sm); color: var(--text-muted); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.drag, .dropzone.has-file { border-color: var(--primary); background: var(--primary-soft); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: var(--space-4); }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-solid), var(--accent)); transition: width 120ms linear; }

.drop-veil {
  position: fixed; inset: 0; z-index: 1050; display: grid; place-items: center; background: var(--veil); backdrop-filter: blur(6px);
  color: #fff; font-size: var(--fs-lg); font-weight: 800; animation: fade 150ms both; pointer-events: none;
}
.drop-veil div { padding: var(--space-10) var(--space-12); border: 2px dashed rgba(255, 255, 255, .7); border-radius: var(--radius-xl); }

/* ---------- Listas tipo ajustes ---------- */
.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.list-row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 56px; padding: var(--space-3) var(--space-4);
  text-align: left; color: var(--text); border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: 0; }
button.list-row:active, a.list-row:active { background: var(--surface-2); }
.list-row .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-secondary); font-size: 17px; flex: none; }
.list-row .ico.primary { background: var(--primary-soft); color: var(--primary); }
.list-row .ico.danger { background: var(--danger-soft); color: var(--danger); }
.list-row .main { flex: 1; min-width: 0; }
.list-row .main small { display: block; color: var(--text-muted); font-size: var(--fs-sm); }
.list-row .end { color: var(--text-muted); font-size: var(--fs-sm); }
.list-row.danger { color: var(--danger); }

.code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; line-height: 1.55;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4);
  white-space: pre-wrap; word-break: break-all; color: var(--text);
}
.callout { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning-text); font-size: var(--fs-sm); font-weight: 600; }

/* ---------- Estados ---------- */
.empty {
  display: grid; justify-items: center; gap: var(--space-3); text-align: center; padding: var(--space-12) var(--space-5);
  border: 1px dashed var(--surface-3); border-radius: var(--radius-lg); color: var(--text-secondary);
}
.empty i { font-size: 40px; color: var(--primary); }
.empty h3 { font-size: var(--fs-md); }
.empty p { max-width: 42ch; font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Avisos ---------- */
.toast-host { position: fixed; top: calc(var(--safe-top) + 12px); left: 0; right: 0; z-index: 1100; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: min(92vw, 420px); padding: 12px 16px; border-radius: var(--radius-md); background: var(--glass); backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lift); font-weight: 600;
  animation: rise 260ms var(--ease-out) both; pointer-events: auto;
}
.toast.error { border-left-color: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(-8px); transition: all 200ms; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-6) var(--space-5); position: relative; overflow: hidden; }
.login-wrap::before {
  content: ""; position: absolute; width: 900px; height: 900px; left: 50%; top: -420px; translate: -50% 0; border-radius: 50%;
  background: conic-gradient(from 200deg, #6B5CFF, #2EC4B6, #FF7AB6, #6B5CFF); filter: blur(110px); opacity: .28; z-index: -1;
}
.login-card { width: 100%; max-width: 380px; display: grid; gap: var(--space-4); animation: rise 600ms var(--ease-out) both; }
.login-card h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.login-card p { color: var(--text-secondary); }
.error-text { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; min-height: 1.2em; }

/* ---------- Visor ---------- */
body.viewer { background: #0A0A12; overflow: hidden; }
.viewer-frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
body.viewer.kind-presentacion .viewer-frame { background: #0A0A12; }
.viewer-bar {
  position: fixed; top: calc(var(--safe-top) + 10px); left: 10px; right: 10px; z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 18px;
  background: rgba(14, 14, 24, .72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: #fff;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); transition: opacity 300ms, transform 300ms var(--ease-out);
  max-width: 760px; margin: 0 auto;
}
.viewer-bar.hide { opacity: 0; transform: translateY(-16px); pointer-events: none; }
.viewer-bar .icon-btn { background: transparent; border: 0; color: #fff; }
.viewer-bar .icon-btn:active { background: rgba(255, 255, 255, .12); }
.viewer-bar .title { flex: 1; min-width: 0; line-height: 1.2; }
.viewer-bar .title b { display: block; font-size: var(--fs-base); }
.viewer-bar .title small { color: rgba(255, 255, 255, .72); font-size: var(--fs-xs); }
.viewer-handle {
  position: fixed; top: 0; left: 50%; translate: -50% 0; z-index: 9; width: 120px; height: 28px;
  display: grid; place-items: center; padding-top: var(--safe-top);
}
.viewer-handle span { width: 44px; height: 5px; border-radius: 3px; background: rgba(128, 128, 140, .55); }
.rotate-hint {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 20px); translate: -50% 0; z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-full);
  background: rgba(14, 14, 24, .78); color: #fff; font-size: var(--fs-sm); font-weight: 600; backdrop-filter: blur(12px);
  animation: rise 400ms var(--ease-out) both;
}
.rotate-hint i { font-size: 18px; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (max-width: 420px) { .viewer-bar #reload, .viewer-bar #open { display: none; } }
