/* ============================================================
   Layout: App shell, sidebar, main, page, login, responsive
   ============================================================ */

/* ── App shell ─────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--color-sidebar);
  color: white;
  padding: 20px 0;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.sidebar__logo-mark {
  font-family: var(--font-display);
  background: var(--color-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
}

.sidebar__logo-text {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}

.sidebar__link:hover {
  color: white;
  background: rgba(255,255,255,0.06);
}

.sidebar__link--active {
  color: white;
  background: var(--color-primary);
}

.main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

/* ── Page ───────────────────────────────────────── */
.page {
  display: none;
  padding: 32px;
  max-width: 1100px;
}

.page--active {
  display: block;
}

.page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page__title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
}

.page__header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page__header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.page__subtitle { color: var(--color-text-secondary); font-size: 13px; margin-top: 4px; }

/* ── Sidebar footer ────────────────────────────── */
.sidebar__footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar__user {
  padding: 6px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__link--logout {
  color: rgba(255,255,255,0.4) !important;
}

.sidebar__link--logout:hover {
  color: var(--color-negative) !important;
  background: rgba(193,41,46,0.12) !important;
}

/* ── Login Screen ──────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
  padding: 20px;
}

.login-card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.login-card__header {
  text-align: center;
  margin-bottom: 32px;
}

.login-card__logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: white;
  font-family: var(--font-display);
  font-size: 20px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.login-card__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: 4px;
}

.login-card__subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-recaptcha-notice {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.login-error {
  background: rgba(193,41,46,0.08);
  border: 1px solid rgba(193,41,46,0.2);
  color: var(--color-negative);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 15px;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .site-selector { flex-direction: column; }
  .redactor-selector { flex-direction: column; }
  .bulk-actions { flex-direction: column; }
  .bulk-actions__buttons { justify-content: center; }
  .pagination__controls { flex-wrap: wrap; justify-content: center; }
  .scheduler-grid { grid-template-columns: repeat(2, 1fr); }
  .vista-previa__layout--split { flex-direction: column; }
  .vista-previa__layout--split .vista-previa__editor { flex: none; position: static; max-height: none; }
  .nn-manual__layout--split { flex-direction: column; }
  .nn-manual__preview { flex: none; position: static; max-height: none; }
  .nn-tabs { overflow-x: auto; }
  .nn-tab { white-space: nowrap; padding: 10px 16px; font-size: 13px; }
  .np-header { padding: 20px 20px 16px; }
  .np-header__title { font-size: 24px; }
  .np-body { padding: 16px 20px; }
  .np-takeaways { margin: 16px 20px; }
  .np-tags { padding: 16px 20px 20px; }
  .img-picker__results { grid-template-columns: repeat(2, 1fr); }
  .img-picker__search-row { flex-direction: column; }
  .img-picker__gen-row { flex-direction: column; }
  .banco-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .banco-filters { flex-direction: column; }
  .banco-detail__content { width: 95%; margin: 16px auto; }
  .dash-next-edition { flex-wrap: wrap; padding: 16px; }
  .dash-next-edition__schedule { margin-left: 0; flex-basis: 100%; margin-top: 8px; }
  .dash-sites-grid { grid-template-columns: 1fr; }
  .dash-site-card__stats { grid-template-columns: repeat(2, 1fr); }
  .dash-site-card__stat:nth-child(3) { border-left: 0; }
}
