/* ==========================================================================
   LEARNING TOLEDO - APP LAYOUT & SHELL
   ========================================================================== */

#app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Application Shell for Authenticated Users */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.75rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #FFFFFF;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

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

.sidebar-brand-title {
  font-family: var(--font-family-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #FFFFFF;
}

.sidebar-brand-subtitle {
  font-size: 0.68rem;
  color: #94A3B8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  font-weight: 600;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  color: #CBD5E1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover:not(.disabled) {
  background-color: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.nav-item.active {
  background-color: var(--color-brand-accent);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nav-item-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
}

.nav-item-label {
  flex: 1;
}

.nav-badge-future {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* Sidebar Footer (User Info & Logout) */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-card-mini {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: #3B82F6;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-details-mini {
  flex: 1;
  overflow: hidden;
}

.user-name-mini {
  font-size: 0.85rem;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge-mini {
  font-size: 0.68rem;
  color: #93C5FD;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-x: hidden;
  background-color: var(--bg-app);
}

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

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.navbar-toggle-mobile {
  display: none;
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  font-size: 1.25rem;
  color: #0F172A;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.navbar-toggle-mobile:hover {
  background: #E2E8F0;
  border-color: #2563EB;
  color: #2563EB;
}

.navbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-breadcrumb-divider {
  color: var(--text-muted);
}

.navbar-breadcrumb-current {
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* Sidebar Backdrop Overlay for Mobile */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 35;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Page Container */
.page-container {
  padding: 2rem;
  flex: 1;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header-text h1 {
  margin-bottom: 0.25rem;
  font-size: 1.75rem;
  font-weight: 800;
}

.page-header-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Form Row Responsive Grid */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Table Responsive Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table-responsive table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

/* Responsive Breakpoints & Mobile Drawer */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .navbar-toggle-mobile {
    display: flex !important;
  }

  .app-navbar {
    padding: 0 1.25rem;
  }

  .page-container {
    padding: 1.5rem 1.25rem;
  }
}

@media (max-width: 640px) {
  .app-navbar {
    padding: 0 0.85rem;
    height: 60px;
  }

  .navbar-breadcrumb span:first-child,
  .navbar-breadcrumb .navbar-breadcrumb-divider {
    display: none;
  }

  .page-container {
    padding: 1rem 0.75rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .page-header-text h1 {
    font-size: 1.35rem;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
