/* =====================================================================
   RECAUDAZ - layout.css
   Estructura de pantalla: top bar, contenido, bottom nav, admin shell.
   ===================================================================== */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-body { display: flex; flex: 1; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-container {
  width: 100%;
  max-width: var(--rz-max-width);
  margin: 0 auto;
  padding: 0 var(--rz-space-4) 96px;
  flex: 1;
}
.app-container.wide { max-width: var(--rz-max-width-wide); }

/* Top bar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(245, 246, 251, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rz-border);
}
.topbar-inner {
  max-width: var(--rz-max-width);
  margin: 0 auto;
  padding: var(--rz-space-4);
  display: flex; align-items: center; justify-content: space-between;
}
.app-container.wide + .topbar-inner,
.topbar-inner.wide { max-width: var(--rz-max-width-wide); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; color: var(--rz-text); }
.brand .brand-dot { color: var(--rz-primary-dark); }
.topbar-actions { display: flex; align-items: center; gap: var(--rz-space-3); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--rz-border);
  background: var(--rz-surface); display: flex; align-items: center; justify-content: center;
  color: var(--rz-text-muted); position: relative; cursor: pointer;
}
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--rz-danger); border: 2px solid var(--rz-surface); }
.page-title { padding: var(--rz-space-4) 0 var(--rz-space-2); }
.page-title h1 { margin-bottom: 2px; }
.page-title .back-link { font-size: 13px; font-weight: 600; color: var(--rz-text-muted); display: inline-flex; align-items: center; gap: 4px; margin-bottom: var(--rz-space-2); }

/* Tabs de rol (cuando el usuario tiene mas de un rol) ---------------------
   Aparecen debajo del topbar, en todos los anchos: son la forma de saltar
   entre "mundos" (comprador/vendedor/responsable/admin). Si el usuario
   tiene un solo rol, el partial no imprime nada. */
.role-tabs {
  display: flex; gap: 6px; overflow-x: auto;
  max-width: var(--rz-max-width); margin: 0 auto; padding: 10px var(--rz-space-4) 4px;
}
.role-tabs a {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--rz-radius-pill);
  background: var(--rz-surface); border: 1px solid var(--rz-border);
  color: var(--rz-text-muted); font-weight: 600; font-size: 13px;
}
.role-tabs a:hover { text-decoration: none; border-color: var(--rz-primary-dark); color: var(--rz-primary-dark); }
.role-tabs a.active { background: var(--rz-primary); border-color: var(--rz-primary); color: var(--rz-ink-on-primary); }
.role-tab-icon { font-size: 15px; line-height: 1; }

@media (min-width: 960px) {
  .role-tabs { max-width: 1080px; padding: 10px var(--rz-space-6) 0; }
}

/* Bottom nav (mobile) ---------------------------------------------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--rz-surface);
  border-top: 1px solid var(--rz-border);
  display: flex;
  padding: 6px var(--rz-space-2) calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(20,22,43,.05);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px;
  color: var(--rz-text-faint);
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--rz-radius-md);
}
.bottom-nav a .nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--rz-primary-dark); }
.bottom-nav a:hover { text-decoration: none; }

@media (min-width: 720px) {
  .bottom-nav { display: none; }
  .app-container { padding-bottom: var(--rz-space-6); }
}

/* Nav superior desktop (pantallas medianas, 720-959px) --------------------- */
.desktop-nav { display: none; }
@media (min-width: 720px) {
  .desktop-nav { display: flex; gap: var(--rz-space-4); align-items: center; }
  .desktop-nav a { color: var(--rz-text-muted); font-weight: 600; font-size: 14px; padding: 8px 4px; border-bottom: 2px solid transparent; }
  .desktop-nav a.active { color: var(--rz-primary-dark); border-color: var(--rz-primary-dark); }
  .desktop-nav a:hover { text-decoration: none; }
}

/* Sidebar de la app en pantallas grandes (>=960px): reemplaza el nav
   superior y la bottom-nav por una navegacion lateral persistente, mas
   parecida a una app de escritorio real. La bottom-nav sigue siendo la
   navegacion principal en mobile (lo prioritario segun el pedido). */
.app-sidebar { display: none; }

@media (min-width: 960px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 248px;
    flex-shrink: 0;
    background: var(--rz-surface);
    border-right: 1px solid var(--rz-border);
    padding: var(--rz-space-5) var(--rz-space-4);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
  .app-sidebar .brand { margin-bottom: var(--rz-space-6); }
  .app-sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: var(--rz-radius-sm);
    color: var(--rz-text-muted); font-weight: 600; font-size: 14px; margin-bottom: 2px;
  }
  .app-sidebar-nav a .nav-icon { font-size: 17px; line-height: 1; }
  .app-sidebar-nav a:hover { background: var(--rz-primary-light); color: var(--rz-primary-dark); text-decoration: none; }
  .app-sidebar-nav a.active { background: var(--rz-primary); color: var(--rz-ink-on-primary); }
  .app-sidebar-account {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--rz-radius-md);
    border: 1px solid var(--rz-border); color: var(--rz-text);
  }
  .app-sidebar-account:hover { background: var(--rz-surface-alt); text-decoration: none; }

  .app-body .topbar .brand { display: none; }
  .app-body .desktop-nav { display: none; }
  .bottom-nav { display: none; }

  .app-container { max-width: 760px; padding: var(--rz-space-6) var(--rz-space-6) var(--rz-space-6); }
  .app-container.wide { max-width: 1080px; }
  .app-body .topbar-inner { max-width: none; padding: var(--rz-space-4) var(--rz-space-6); justify-content: flex-end; }
}

/* Grillas responsive genericas -------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--rz-space-4); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--rz-space-4); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Grilla de cards independientes (suscripciones, organizaciones...): se
   mantiene en una columna hasta el tamaño de escritorio real, para no
   apretar las cards en tablets angostas. */
.cards-grid { display: grid; grid-template-columns: 1fr; gap: var(--rz-space-3); }
@media (min-width: 960px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); align-items: start; }
}

/* Admin shell (sidebar) --------------------------------------------------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; flex-shrink: 0; background: #16182E; color: #fff;
  padding: var(--rz-space-5) var(--rz-space-4);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar .brand { color: #fff; margin-bottom: var(--rz-space-6); }
.admin-sidebar .brand .brand-dot { color: var(--rz-primary); }
.admin-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--rz-radius-sm);
  color: rgba(255,255,255,.68); font-weight: 600; font-size: 13.5px; margin-bottom: 2px;
}
.admin-nav a:hover { text-decoration: none; background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a.active { background: var(--rz-primary); color: var(--rz-ink-on-primary); }
.admin-nav .nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.35); margin: var(--rz-space-4) 0 var(--rz-space-1) 12px; }
.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--rz-space-4) var(--rz-space-5); border-bottom: 1px solid var(--rz-border);
  background: var(--rz-surface); position: sticky; top: 0; z-index: 10;
}
.admin-content { padding: var(--rz-space-5); max-width: var(--rz-max-width-wide); margin: 0 auto; }
.admin-mobile-topbar { display: none; }

@media (max-width: 959px) {
  .admin-sidebar { display: none; }
  /* En mobile el brand + "salir" ya viven en .admin-mobile-topbar y la
     navegacion en .admin-mobile-nav: mostrar tambien .admin-topbar
     duplicaba el encabezado (quedaban 3 barras apiladas). */
  .admin-topbar { display: none; }
  .admin-mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--rz-space-4); border-bottom: 1px solid var(--rz-border); background: #16182E; color: #fff;
  }
  .admin-mobile-topbar .brand { color: #fff; }
  .admin-mobile-nav { display: flex; overflow-x: auto; gap: var(--rz-space-2); padding: var(--rz-space-3) var(--rz-space-4); background: #16182E; }
  .admin-mobile-nav a { flex-shrink: 0; color: rgba(255,255,255,.7); font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: var(--rz-radius-pill); background: rgba(255,255,255,.08); }
  .admin-mobile-nav a.active { background: var(--rz-primary); color: var(--rz-ink-on-primary); }
}

/* Pantallas de auth / publico (login, registro, join) --------------------- */
.centered-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--rz-space-5);
  background: radial-gradient(circle at 20% 0%, var(--rz-primary-light) 0%, var(--rz-bg) 55%);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: var(--rz-space-5); }

/* Pagina publica del vendedor -------------------------------------------- */
.seller-public-hero {
  background: linear-gradient(160deg, #20222E 0%, #0E0F16 100%);
  color: #fff; border-radius: 0 0 32px 32px;
  padding: var(--rz-space-6) var(--rz-space-4) var(--rz-space-7);
  text-align: center;
}
.seller-public-hero .avatar-lg { margin: 0 auto var(--rz-space-3); border: 4px solid rgba(198,241,53,.35); }
.seller-public-hero .org-name { color: var(--rz-primary); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.seller-public-content { max-width: var(--rz-max-width); margin: -32px auto 0; padding: 0 var(--rz-space-4) var(--rz-space-7); }
.plan-option {
  display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid var(--rz-border); border-radius: var(--rz-radius-md);
  padding: var(--rz-space-4); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.plan-option:hover { border-color: var(--rz-primary-dark); }
.plan-option input { accent-color: var(--rz-primary-dark); }
.plan-option.selected { border-color: var(--rz-primary-dark); background: var(--rz-primary-light); }
.sticky-cta {
  position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(245,246,251,0) 0%, var(--rz-bg) 30%);
  padding: var(--rz-space-4) 0 var(--rz-space-3);
}

.gallery-scroll { display: flex; gap: var(--rz-space-2); overflow-x: auto; padding-bottom: 4px; }
.gallery-scroll img { width: 130px; height: 130px; object-fit: cover; border-radius: var(--rz-radius-md); flex-shrink: 0; }

.video-embed { position: relative; padding-top: 56.25%; border-radius: var(--rz-radius-md); overflow: hidden; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
