/* ═══════════════════════════════════════════════════════
   FREEscience — Layout Styles
   Basado en estilo alternativas-feed.html
   ═══════════════════════════════════════════════════════ */

/* ── App Shell ── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  display: flex;
  flex: 1;
  padding-top: var(--header-height);
}

.app-content {
  flex: 1;
  padding: var(--space-xl) var(--space-xl) var(--space-3xl);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

.app-content-narrow { max-width: var(--content-narrow); }

/* ── Header ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(248, 247, 243, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 500;
  transition: background var(--duration-normal);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  gap: 18px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-logo { font-size: var(--fs-xl); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--muted);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
  text-decoration: none;
  white-space: nowrap;
}
.header-nav-link:hover { color: var(--text); background: var(--soft); }
.header-nav-link.active { color: var(--accent); background: var(--soft); }
.header-nav-link svg { width: 16px; height: 16px; }

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 7px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast);
  min-width: 180px;
}
.header-search:hover { border-color: var(--stone-300); }
.header-search svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.header-search span { font-size: var(--fs-sm); color: var(--muted); }

.header-notification { position: relative; }
.header-notification .badge-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--color-danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

.header-menu-toggle { display: none; padding: var(--space-sm); }
.header-menu-toggle svg { width: 22px; height: 22px; }

/* ── Sidebar ── */
.sidebar {
  display: none;
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: var(--space-lg);
  background: var(--surface);
  overflow-y: auto;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
}

.sidebar-section { margin-bottom: var(--space-xl); }

.sidebar-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 12px;
  margin: 0 0 10px 0;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  font-size: var(--fs-sm);
  color: var(--muted);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
  text-decoration: none;
  font-weight: var(--fw-medium);
}
.sidebar-link:hover { background: var(--soft); color: var(--text); }
.sidebar-link.active { background: var(--soft); color: var(--accent); font-weight: var(--fw-semibold); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--line);
  padding: var(--space-2xl) var(--space-xl);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
}

.footer-brand { display: flex; flex-direction: column; gap: var(--space-md); }
.footer-brand p { font-size: var(--fs-sm); color: var(--muted); max-width: 300px; margin: 0; }

.footer-section h4 {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-md);
  color: var(--text);
}

.footer-links { display: flex; flex-direction: column; gap: var(--space-sm); }
.footer-links a { font-size: var(--fs-sm); color: var(--muted); text-decoration: none; transition: color var(--duration-fast); }
.footer-links a:hover { color: var(--text); }

.footer-bottom {
  max-width: var(--content-max);
  margin: var(--space-xl) auto 0;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-bottom p { font-size: var(--fs-xs); color: var(--muted); margin: 0; }

/* ── Page Header ── */
.page-header {
  margin-bottom: var(--space-xl);
}
.page-header h1 { margin-bottom: var(--space-xs); }
.page-header p  { color: var(--muted); font-size: var(--fs-sm); margin: 0; }

/* ── Auth Layout ── */
.auth-layout {
  display: flex;
  min-height: 100vh;
}

.auth-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  background: var(--bg);
}

.auth-form-container {
  width: 100%;
  max-width: 400px;
}

.auth-form-container h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-xs);
}

.auth-form-container > p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-xl);
}

.auth-hero {
  flex: 1;
  background: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  position: relative;
  overflow: hidden;
}

/* Andean landscape decoration */
.auth-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 70% 30%, rgba(165, 221, 211, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 30% 70%, rgba(21, 94, 101, 0.2) 0%, transparent 50%);
}

.auth-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: -15%; right: -15%;
  height: 55%;
  background: var(--accent);
  clip-path: polygon(0 90%, 32% 12%, 46% 45%, 64% 5%, 100% 88%, 100% 100%, 0 100%);
  opacity: 0.4;
}

.auth-hero h2 {
  color: #ffffff;
  font-size: var(--fs-2xl);
  text-align: center;
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-md);
}

.auth-hero p {
  color: var(--stone-300);
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 320px;
  font-size: var(--fs-sm);
  margin: 0;
}

/* ── Grid System ── */
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Publication / feed layouts ── */
.publication-page { }

.publication-search { }

.publication-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Feed card */
.pub-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--duration-fast), border-color var(--duration-fast);
}
.pub-card:hover { box-shadow: var(--shadow-md); border-color: var(--stone-300); }

.pub-card-top { padding: 18px 20px 14px; }

.pub-card-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.pub-card h2 {
  font-size: 18px;
  line-height: 1.28;
  margin: 8px 0 10px;
  color: var(--text);
}

.pub-card > p,
.pub-card-top > p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Profile pages ── */
.profile-page { max-width: 760px; margin: 0 auto; }

.profile-heading {
  text-align: center;
  padding: var(--space-xl);
}

.profile-avatar {
  margin: 0 auto var(--space-lg);
}

.profile-stats {
  margin: var(--space-lg) 0;
}

.profile-section-title {
  font-size: var(--fs-md);
  margin-bottom: var(--space-md);
}

.profile-biography {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

.profile-coauthors,
.profile-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

/* ── Admin layout ── */
.admin-layout .sidebar { display: block; }

/* ── Mobile Menu ── */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: rgba(23, 45, 53, 0.4);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}
.mobile-menu.open { opacity: 1; pointer-events: auto; }

.mobile-menu-panel {
  position: absolute;
  top: 0; right: 0;
  width: 300px; max-width: 85%;
  height: 100%;
  background: var(--surface);
  padding: var(--space-xl);
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out);
  overflow-y: auto;
}
.mobile-menu.open .mobile-menu-panel { transform: translateX(0); }

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.mobile-menu-nav { display: flex; flex-direction: column; gap: var(--space-xs); }

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px;
  font-size: var(--fs-base);
  color: var(--stone-700);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast);
  text-decoration: none;
}
.mobile-menu-link:hover, .mobile-menu-link.active { background: var(--soft); color: var(--text); }
.mobile-menu-link svg { width: 18px; height: 18px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .auth-hero { display: none; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }

  .header-nav    { display: none; }
  .header-search { display: none; }
  .header-menu-toggle { display: flex; }

  .app-content { padding: var(--space-md) var(--space-md) var(--space-2xl); }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .footer-inner { grid-template-columns: 1fr; gap: var(--space-xl); }
  .footer-bottom { flex-direction: column; gap: var(--space-sm); text-align: center; }

  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
}

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .form-input, .form-select, .form-textarea { font-size: 16px; }
}
