/* =============================================
   V2 MÍDIA — HUB DE GESTÃO
   layout.css — Estrutura, Sidebar, Topbar,
                Content, Footer
   ============================================= */

/* ─── ESTRUTURA PRINCIPAL ────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: transform 0.3s ease, width 0.3s ease;
  z-index: 100;
  overflow: hidden;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-text small {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Nav Menu */
.nav-menu {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 8px;
}

.nav-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.18s ease;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.18s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent-light);
  font-weight: 500;
}

.nav-item.active svg { opacity: 1; }

/* Sidebar Footer / Usuário */
.sidebar-footer {
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-mini {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-mini-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-mini-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── ÁREA PRINCIPAL ─────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── TOPBAR ─────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.menu-toggle:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }
.menu-toggle svg   { width: 20px; height: 20px; display: block; }

.welcome-text {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 300;
}

.welcome-text span {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 16px;
  transition: border-color 0.18s;
}

.search-bar:focus-within { border-color: var(--accent); }

.search-bar svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  width: 180px;
  caret-color: var(--accent);
}

.search-bar input::placeholder { color: var(--text-muted); }

/* Ações da topbar */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.18s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.icon-btn svg { width: 16px; height: 16px; }

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg-surface);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── CONTENT ────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 0;
  position: relative;
  overflow: hidden;
}

/* Modo iframe: sem padding, sem scroll */
.content--iframe {
  padding: 0 !important;
  overflow: hidden !important;
}

/* Páginas */
.page {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cabeçalho de página */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.date-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Iframe */
.page--iframe {
  position: absolute;
  inset: 0;
  padding: 0 !important;
}

.page--iframe iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--bg);
}

/* ─── FOOTER ─────────────────────────────────── */
.footer {
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  background: var(--bg-surface);
}

/* ─── LOGOUT BUTTON (sidebar-footer) ────────── */
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}

.btn-logout svg { width: 15px; height: 15px; }

.btn-logout:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.2);
}