/* ==========================================================================
   APP LAYOUT: NAVBAR, SIDEBAR & MAIN CONTAINER
   Instituto de Educación Superior Tecnológico Público "Nueva Esperanza"
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-body);
}

/* Sidebar Component */
.app-sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-drawer);
  transition: transform var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1),
              width var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-md);
}

.sidebar-header {
  height: 72px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  height: 42px;
  background: #ffffff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-size: var(--text-sm);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--text-sidebar-muted);
}

.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-3);
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sidebar-muted);
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.65rem var(--space-3);
  margin-bottom: 3px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--secondary);
}

.nav-item .icon {
  width: 1.15rem;
  height: 1.15rem;
  opacity: 0.85;
}

.nav-item.active .icon {
  opacity: 1;
  stroke: var(--accent);
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-tag {
  font-size: var(--text-xs);
  color: var(--text-sidebar-muted);
}

/* App Main Layout */
.app-main {
  flex: 1;
  margin-left: 270px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Top Navbar */
.app-navbar {
  height: 72px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: blur(8px);
}

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

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

/* Sync Indicator Badge */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(46, 125, 50, 0.2);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  animation: pulseGlow 1.8s infinite;
}

/* Header Action Buttons & Dropdowns */
.nav-action-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.nav-action-btn:hover {
  background-color: var(--bg-surface-alt);
  color: var(--primary);
  border-color: var(--primary);
}

.nav-action-btn .badge-counter {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--secondary);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface);
}

/* Dropdown Menus */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 260px;
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  display: none;
  animation: slideDown var(--transition-fast) ease-out;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.6rem var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--bg-surface-alt);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-light);
  margin: var(--space-2) 0;
}

/* App Content Area */
.app-content {
  flex: 1;
  padding: var(--space-8) var(--space-6);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.content-title-wrap {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
