/* ==========================================================================
   LAYOUT STYLES (TopBar, Sidebar & Container Layout)
   ========================================================================== */

#app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--neutral-50);
  transition: background var(--transition-normal);
}

/* MODE 1: LANDING PAGE LAYOUT (Estilo Next-Project Imagen 2) */
#app-container.mode-landing {
  flex-direction: column;
  align-items: center;
  background-color: #f8fafc;
  background-image: 
    linear-gradient(to right, rgba(226, 232, 240, 0.65) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(226, 232, 240, 0.65) 1px, transparent 1px);
  background-size: 32px 32px;
  padding-bottom: 60px;
}

#app-container.mode-landing .topbar {
  position: relative;
  width: 100%;
  max-width: 1140px;
  margin: 24px auto 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

#app-container.mode-landing .topbar-left {
  width: auto;
}

/* TOPBAR GENERAL STYLES */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  transition: all var(--transition-fast);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  width: calc(var(--sidebar-width) - 24px);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary-700);
  letter-spacing: -0.3px;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 600px;
}

.class-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--neutral-100);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  flex: 1;
}

.class-selector-wrapper svg {
  color: var(--neutral-500);
  flex-shrink: 0;
}

.class-select {
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--neutral-800);
  cursor: pointer;
}

.btn-create-class {
  background-color: var(--primary-600);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition-fast);
}

.btn-create-class:hover {
  background-color: var(--primary-700);
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--neutral-200);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--primary-100);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--neutral-800);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--primary-600);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--neutral-600);
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background-color: var(--neutral-100);
  color: var(--danger-600);
  border-color: var(--danger-100);
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);

  background-color: #ffffff;
  border-right: 1px solid var(--neutral-200);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 40;
  overflow-y: auto;
}

.sidebar-header-card {
  background-color: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
}

.active-class-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--neutral-900);
  margin-bottom: 4px;
  line-height: 1.3;
}

.active-class-badge {
  display: inline-block;
  background-color: var(--primary-100);
  color: var(--primary-700);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--neutral-400);
  margin: 16px 8px 8px 8px;
}

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

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--neutral-600);
  transition: all var(--transition-fast);
}

.nav-item a svg {
  width: 18px;
  height: 18px;
  color: var(--neutral-500);
  transition: color var(--transition-fast);
}

.nav-item a:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-900);
}

.nav-item a:hover svg {
  color: var(--neutral-800);
}

.nav-item.active a {
  background-color: var(--primary-100);
  color: var(--primary-700);
  font-weight: 600;
}

.nav-item.active a svg {
  color: var(--primary-700);
}

/* MAIN CONTENT AREA */
.main-content {
  margin-top: var(--topbar-height);
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
}



/* Auth Login Screen View */
.auth-container {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 20px;
}

.auth-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-brand-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  border-radius: var(--radius-md);
  margin: 0 auto 20px auto;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neutral-900);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--neutral-500);
  margin-bottom: 28px;
}

.btn-google-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: #ffffff;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--neutral-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-google-login:hover {
  background-color: var(--neutral-50);
  border-color: var(--neutral-400);
  box-shadow: var(--shadow-card);
}

.btn-google-login img {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   SWITCH TOGGLE STYLES (Delegado Activo)
   ========================================================================== */
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary-600) !important;
}
input:checked + .slider:before {
  transform: translateX(22px);
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE/TABLET BREAKPOINTS
   ========================================================================== */
.btn-toggle-sidebar {
  display: none;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 35;
  transition: opacity var(--transition-normal);
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

@media (max-width: 1024px) {
  :root {
    --topbar-mobile-height: 116px;
  }

  .topbar {
    flex-wrap: wrap !important;
    height: auto !important;
    padding: 10px 16px;
  }

  .topbar-left {
    order: 1;
    width: auto !important;
    gap: 10px;
  }

  .topbar-right {
    order: 2;
    margin-left: auto;
    gap: 10px;
  }

  .topbar-center {
    order: 3;
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
    flex-shrink: 0 !important;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--neutral-200);
  }

  .class-selector-wrapper {
    flex: 1;
    width: 100%;
    padding: 6px 10px;
  }

  .class-select {
    font-size: 0.85rem;
    width: 100%;
  }

  .user-name {
    display: none;
  }

  .user-profile {
    padding-left: 0;
    border-left: none;
  }

  .btn-toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--neutral-700);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
  }

  .btn-toggle-sidebar:hover {
    background-color: var(--neutral-100);
  }

  .sidebar {
    top: var(--topbar-mobile-height);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
  }

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

  #app-container.sidebar-open .sidebar-overlay {
    display: block;
  }

  .main-content {
    margin-top: var(--topbar-mobile-height) !important;
    margin-left: 0 !important;
    padding: 20px 16px !important;
    width: 100% !important;
  }

  #app-container.mode-landing .topbar {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .courses-landing-view {
    margin: 20px auto;
    padding: 0 16px;
  }

  .courses-landing-title {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 24px 16px;
  }
}


@media (max-width: 480px) {
  .brand-logo span {
    display: none;
  }

  .btn-create-class {
    padding: 6px 10px;
  }
}



