/* =============================================================
   LAYOUT - Shell con Sidebar + Topbar
   ============================================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--in-primary);
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: width 0.2s ease;
}

.app-sidebar__brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.75rem;
}

.app-sidebar__logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--in-accent) 0%, #006d6d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 163, 163, 0.3);
}

.app-sidebar__title {
  font-weight: 600;
  font-size: 1rem;
  color: white;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.app-sidebar__subtitle {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.app-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.app-sidebar__section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.4);
  padding: 0.75rem 0.75rem 0.5rem;
  margin-top: 0.5rem;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  position: relative;
}

.app-sidebar__link i {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.app-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.app-sidebar__link.active {
  background: rgba(0, 163, 163, 0.18);
  color: white;
}

.app-sidebar__link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--in-accent);
}

.app-sidebar__badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--in-accent);
  color: white;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
}

.app-sidebar__footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.02em;
}

/* ===== MAIN ===== */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== TOPBAR ===== */
.app-topbar {
  height: var(--topbar-height);
  background: var(--in-surface);
  border-bottom: 1px solid var(--in-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-topbar__breadcrumb {
  font-size: 0.875rem;
  color: var(--in-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-topbar__breadcrumb a {
  color: var(--in-text-muted);
  text-decoration: none;
}

.app-topbar__breadcrumb a:hover {
  color: var(--in-primary);
}

.app-topbar__breadcrumb .current {
  color: var(--in-text);
  font-weight: 500;
}

.app-topbar__spacer { flex: 1; }

.app-topbar__action {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--in-text-muted);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.app-topbar__action:hover {
  background: var(--in-bg);
  color: var(--in-text);
}

.app-topbar__action .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--in-accent);
  border-radius: 50%;
  border: 2px solid var(--in-surface);
}

/* User switcher */
.user-switcher {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--in-border);
  background: var(--in-surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-switcher:hover {
  border-color: var(--in-border-strong);
  background: var(--in-surface-alt);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  background: var(--in-primary);
  flex-shrink: 0;
}

.user-avatar--sm { width: 24px; height: 24px; font-size: 0.65rem; }
.user-avatar--lg { width: 44px; height: 44px; font-size: 0.95rem; }

.user-switcher__info {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.user-switcher__name {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--in-text);
}

.user-switcher__role {
  font-size: 0.7rem;
  color: var(--in-text-muted);
}

/* ===== CONTENT ===== */
.app-content {
  flex: 1;
  padding: 1.75rem 1.75rem 3rem;
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header__left h1 {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--in-text);
}

.page-header__subtitle {
  margin-top: 0.25rem;
  color: var(--in-text-muted);
  font-size: 0.9rem;
}

.page-header__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* User topbar info (replaces user-switcher dropdown) */
.user-topbar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--in-border);
  background: var(--in-surface);
}

/* Logout button */
.btn-logout {
  color: var(--in-text-muted);
}

.btn-logout:hover {
  color: var(--in-danger);
  background: rgba(185, 28, 28, 0.06);
  border-color: rgba(185, 28, 28, 0.2);
}

/* Responsive */
@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
}
