/* =========================================================
   LECTURELEGACY — Dashboard SPA Styles
   combines dashboard, generate, and course views
   ========================================================= */

/* BASE DASHBOARD LAYOUT */
.dashboard-body {
  background: var(--navy-950);
  margin: 0;
  overflow: hidden; 
  height: 100vh;
}

.dashboard-layout {
  display: flex;
  height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: rgba(10, 22, 40, 0.4);
  border-right: none;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
}
.sidebar-header { padding: 24px; }
.sidebar-nav { flex: 1; padding: 0 16px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-link {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-radius: var(--radius-sm); color: var(--gray-400); font-size: 15px; font-weight: 500; transition: all 0.2s;
  text-decoration: none;
}
.sidebar-link:hover { 
  background: rgba(181, 232, 74, 0.06); 
  color: var(--white); 
  box-shadow: 0 0 15px rgba(181, 232, 74, 0.05);
}
.sidebar-link:hover .sl-icon {
  filter: drop-shadow(0 0 5px rgba(181, 232, 74, 0.3));
}
.sidebar-link.active { 
  background: rgba(255, 255, 255, 0.1); 
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white); 
  font-weight: 600; 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.sidebar-link.active .sl-icon {
  color: var(--lime-400);
}
.sl-icon { font-size: 20px; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 12px 0; }
.sidebar-section { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ss-header { 
  display: flex; justify-content: space-between; align-items: center; 
  padding: 0 14px; font-size: 13px; color: var(--gray-400); font-weight: 600; 
  margin-bottom: 4px; 
}
.ss-add { cursor: pointer; font-size: 16px; font-weight: 400; transition: color 0.2s; }
.ss-add:hover { color: var(--white); }
.ss-recent { padding: 8px 14px; font-size: 14px; color: var(--white); }
.sidebar-folders-list { 
  display: flex; 
  flex-direction: column;
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.sidebar-folders-list.collapsed {
  max-height: 0;
}
.folder-chevron {
  color: var(--gray-400);
  transition: transform 0.2s;
}
.folder-chevron.collapsed {
  transform: rotate(-90deg);
}
.sidebar-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.folder-count {
  font-size: 12px;
  color: var(--gray-500);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.sidebar-footer { padding: 24px 16px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; flex-direction: column; gap: 16px; }

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ced1, #00ffd5);
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0,206,209,0.5);
}

.credits-info { 
  background: linear-gradient(145deg, rgba(20, 36, 60, 0.7), rgba(10, 22, 40, 0.9));
  padding: 12px 14px; 
  border-radius: var(--radius-md); 
  border: 1px solid rgba(0, 206, 209, 0.2); 
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.credits-info:hover {
  border-color: rgba(0, 206, 209, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 206, 209, 0.1);
}

.credits-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  font-size: 9px; 
  color: var(--gray-400); 
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-bottom: 8px; 
}

.credits-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.credits-count {
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.credits-count span {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
}

.credits-count-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}


.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ced1, #00ffd5);
  border-radius: 12px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-upgrade-btn {
  width: 100%;
  padding: 8px;
  background: var(--grad-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--navy-950);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-upgrade-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.sidebar-upgrade-btn:active {
  transform: translateY(0);
}

.btn-sparkle {
  animation: sparkle 2s infinite ease-in-out;
}

@keyframes sparkle {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}


.user-profile-dropdown {
  position: relative;
}
.profile-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.profile-trigger:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-700);
  object-fit: cover;
  flex-shrink: 0;
}
.user-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-subtitle {
  font-size: 12px;
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown-arrow {
  color: var(--gray-400);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.profile-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}
.profile-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 8px;
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1000;
}
.profile-menu.hidden {
  display: none;
}
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--white);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s;
}
.profile-menu-item:hover {
  background: rgba(255,255,255,0.05);
}
.profile-menu-item.danger {
  color: #ef4444;
}
.profile-menu-item.danger:hover {
  background: rgba(239,68,68,0.1);
}
.menu-icon {
  font-size: 16px;
}
.profile-menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 8px 0;
}

/* LIBRARY VIEW */
.library-view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 40px;
}
.library-view.active { display: flex !important; }

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.library-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--white);
}

.library-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.library-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.library-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.library-section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}
.course-count {
  font-size: 14px;
  color: var(--gray-400);
  background: rgba(255,255,255,0.05);
  padding: 4px 12px;
  border-radius: 12px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  min-height: 100px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 2px dashed transparent;
  transition: all 0.3s;
}
.library-grid.drag-over {
  background: rgba(181,232,74,0.05);
  border-color: rgba(181,232,74,0.3);
}

.library-course-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: grab;
  transition: all 0.3s;
}
.library-course-card:active {
  cursor: grabbing;
}
.library-course-card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}
.library-course-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(181,232,74,0.3);
  transform: translateY(-2px);
}
.library-course-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-course-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-400);
}

.folder-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.folder-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.folder-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}
.folder-icon {
  font-size: 20px;
}
.folder-actions {
  display: flex;
  gap: 8px;
}
.folder-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.folder-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}
.folder-btn.delete:hover {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

/* CUSTOM NOTIFICATION MODAL */
.notification-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.notification-overlay.hidden {
  display: none;
}
.notification-modal {
  background: rgba(14, 22, 40, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.notification-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}
.notification-close {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.notification-close:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}
.notification-body {
  padding: 24px;
}
.notification-body p {
  color: var(--gray-300);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 16px 0;
}
.notification-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--white);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}
.notification-input:focus {
  outline: none;
  border-color: var(--lime-400);
  background: rgba(255,255,255,0.08);
}
.notification-input.hidden {
  display: none;
}
.notification-actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  justify-content: flex-end;
}
.btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

/* SETTINGS VIEW */
.settings-view {
  display: none;
  height: 100%;
  background: var(--navy-900);
}
.settings-view.active { display: block !important; }

.settings-container {
  display: flex;
  height: 100%;
}

.settings-sidebar {
  width: 220px;
  padding: 40px 20px;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.settings-sidebar h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 24px;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--gray-400);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

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

.settings-nav-item.active {
  background: rgba(0,206,209,0.15);
  color: #00ced1;
}

.settings-nav-icon {
  font-size: 18px;
}

.settings-main {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.settings-tab {
  display: none;
}

.settings-tab.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.settings-card.danger-card {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.05);
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.settings-card-icon {
  font-size: 20px;
}

.settings-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #00ced1;
}

.danger-card .settings-card-title {
  color: #ef4444;
}

.settings-card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-400);
}

.form-input {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--white);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #00ced1;
  background: rgba(0,0,0,0.4);
}

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-hint {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}

.btn-save {
  background: #00ced1;
  border: none;
  color: #000;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-start;
}

.btn-save:hover {
  background: #00b8ba;
  transform: translateY(-1px);
}

.subscription-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subscription-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subscription-plan h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

.subscription-badge {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subscription-desc {
  font-size: 14px;
  color: var(--gray-400);
  margin: 0;
}

.btn-upgrade-plan {
  background: transparent;
  border: 1px solid #00ced1;
  color: #00ced1;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-start;
}

.btn-upgrade-plan:hover {
  background: rgba(0,206,209,0.1);
}

.danger-desc {
  font-size: 14px;
  color: var(--gray-400);
  margin: 0;
}

.btn-delete {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-start;
}

.btn-delete:hover {
  background: rgba(239,68,68,0.1);
}

/* COURSES GRID */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
  isolation: isolate;
}
.course-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  transform: translateZ(0);
  will-change: transform;
}
.course-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(181,232,74,0.3);
  transform: translateY(-2px);
}
.course-card-img {
  width: 100%;
  height: 160px;
  background: var(--navy-800);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.course-card-content {
  padding: 16px;
}
.course-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.course-card-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--gray-400);
}
.course-card-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.course-card-empty h3 {
  font-size: 18px;
  color: var(--white);
  margin-bottom: 8px;
}

/* MAIN CONTENT CONTAINER */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* TOP HEADER */
.top-header {
  height: 72px; display: flex; justify-content: space-between; align-items: center;
  padding: 0 32px; border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(5,12,26,0.6); backdrop-filter: blur(10px); z-index: 10;
}
.search-wrap { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-md); padding: 10px 16px; width: 400px; transition: border-color 0.2s; }
.search-wrap:focus-within { border-color: rgba(181,232,74,0.4); }
.search-icon { font-size: 16px; opacity: 0.6; }
.search-input { background: none; border: none; outline: none; color: var(--white); font-size: 14px; width: 100%; }
.search-input::placeholder { color: var(--gray-600); }
.header-actions { display: flex; align-items: center; gap: 20px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 16px; transition: all 0.2s; border:none; cursor:pointer;}
.icon-btn:hover { background: rgba(255,255,255,0.08); }
.user-profile { display: flex; align-items: center; gap: 12px; padding: 6px 14px 6px 6px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 999px; cursor: pointer; transition: all 0.2s; }
.user-profile:hover { background: rgba(255,255,255,0.08); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-name { font-size: 14px; font-weight: 600; color: var(--white); }
.mt-4 { margin-top:24px; }
.w-full { width:100%; }

/* SPA VIEW SYSTEM */
.app-view {
  display: none;
  flex: 1;
  width: 100%;
  height: calc(100vh - 72px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.app-view.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease forwards;
}

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

/* ---------------------------------------------------
   VIEW: CHAT
   --------------------------------------------------- */
.chat-view {
  display: none;
  height: 100%;
  background: var(--navy-950);
}
.chat-view.active { display: block !important; }

.chat-container {
  display: flex;
  height: 100%;
}

.chat-sidebar {
  width: 260px;
  background: var(--navy-900);
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-header {
  padding: 16px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}

.btn-new-chat span:first-child {
  font-size: 18px;
  font-weight: 400;
}

.btn-chat-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-chat-menu:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}

.btn-chat-menu span {
  font-size: 18px;
  font-weight: 700;
}

.chat-threads {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chat-threads-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.chat-threads-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-thread-item {
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.chat-thread-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.chat-thread-item.active {
  background: rgba(163,230,53,0.15);
  border-color: rgba(163,230,53,0.3);
}

.chat-thread-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-time {
  font-size: 12px;
  color: var(--gray-500);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 40px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(5,12,26,0.5);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.chat-title-area { display: flex; align-items: center; gap: 12px; }
.chat-icon-title { font-size: 22px; }
.chat-title { font-size: 18px; font-weight: 700; color: var(--white); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  align-self: center;
  box-sizing: border-box;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}
.chat-messages::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.msg-row { display: flex; align-items: flex-start; gap: 16px; }
.msg-ai { flex-direction: row; }
.msg-user { flex-direction: row-reverse; }

.msg-avatar-ai {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(181,232,74,0.12); border: 1px solid rgba(181,232,74,0.25);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  flex-shrink: 0;
}
.msg-bubble-ai {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px 16px 16px 16px;
  padding: 18px 20px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-100);
  max-width: 640px;
}
.msg-bubble-ai p {
  margin: 0;
  line-height: 1.6;
}
.msg-bubble-ai br {
  display: block;
  content: "";
  margin: 8px 0;
}
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime-400);
  opacity: 0.4;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}
.msg-bubble-user {
  background: var(--grad-primary);
  border-radius: 16px 4px 16px 16px;
  padding: 14px 18px;
  font-size: 15px;
  color: var(--navy-950);
  font-weight: 600;
  max-width: 480px;
}

/* Suggestion chips */
.suggestion-chips {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px;
}
.chip {
  background: rgba(181,232,74,0.07);
  border: 1px solid rgba(181,232,74,0.25);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--lime-400);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.chip:hover {
  background: rgba(181,232,74,0.18);
  border-color: rgba(181,232,74,0.5);
  transform: translateY(-1px);
}

/* Chat input */
.chat-input-area {
  padding: 20px 40px 28px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(5,12,26,0.5);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.chat-input-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 10px 10px 10px 18px;
  max-width: 780px; margin: 0 auto;
  transition: border-color 0.2s;
}
.chat-input-wrap:focus-within { border-color: rgba(181,232,74,0.4); }
.chat-text-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--white); font-size: 15px; font-family: inherit;
}
.chat-text-input::placeholder { color: var(--gray-500); }
.chat-attach-btn, .chat-mic-btn {
  width: 32px; height: 32px; border-radius: 50%; background: none; border: none;
  color: var(--gray-400); font-size: 16px; cursor: pointer; transition: color 0.2s;
  display: flex; align-items: center; justify-content: center; font-family: inherit; flex-shrink: 0;
}
.chat-attach-btn:hover, .chat-mic-btn:hover { color: var(--white); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad-primary); border: none;
  color: var(--navy-950); cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-send-btn:hover { opacity: 0.85; }

/* ---------------------------------------------------
   VIEW 1: DASHBOARD
   --------------------------------------------------- */
#view-dashboard {
  background: radial-gradient(circle at top right, rgba(14,32,64,0.6), transparent 50%),
              radial-gradient(circle at bottom left, rgba(26,58,122,0.2), transparent 40%);
}
.new-home-layout { padding: 40px 60px; width: 100%; box-sizing: border-box; }

/* Welcome */
.wb-header { display: flex; align-items: center; gap: 20px; margin-bottom: 48px; }
.wb-avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255,255,255,0.1); }
.wb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wb-header h1 { font-family: var(--font-m); font-size: 32px; font-weight: 500; letter-spacing: -0.5px; } /* Using serif-like or standard */

.home-grid { display: grid; grid-template-columns: 1fr 320px; gap: 40px; }

/* Sections */
.h-section { margin-bottom: 40px; isolation: isolate; }
.h-section h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--white); }

/* Quick start */
.qs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; position: relative; z-index: 10; }
.qs-card { 
  background: rgba(255, 255, 255, 0.06); 
  border: 1px solid rgba(255, 255, 255, 0.08); 
  border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; 
  cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  transform: translateZ(0);
  will-change: transform;
}
.qs-card:hover { 
  background: rgba(255, 255, 255, 0.1); 
  border-color: rgba(181, 232, 74, 0.3); 
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.qs-icon { 
  width: 44px; height: 44px; border-radius: var(--radius-sm); 
  background: rgba(181, 232, 74, 0.1); 
  color: var(--lime-400); display: flex; align-items: center; justify-content: center; font-size: 20px; 
  transition: all 0.3s ease;
}
.qs-card:hover .qs-icon {
  background: rgba(181, 232, 74, 0.2);
  transform: scale(1.05);
}
.qs-text { display: flex; flex-direction: column; }
.qs-text strong { font-size: 15px; font-weight: 600; color: var(--white); margin-bottom: 2px; }
.qs-text span { font-size: 13px; color: var(--gray-400); margin-top: 2px; }

/* Continue studying */
.cs-card {
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg); display: flex; align-items: center; gap: 24px;
  padding: 16px; padding-right: 24px; cursor: pointer; transition: all 0.2s; position: relative;
}
.cs-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }
.cs-img { width: 140px; height: 90px; border-radius: var(--radius-sm);  background-size: cover; background-position: center; }
.cs-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cs-kicker { font-size: 11px; font-weight: 800; color: var(--lime-400); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.cs-content h3 { font-size: 18px; font-weight: 700; color: var(--white); margin-bottom: 4px; line-height: 1.3; }
.cs-content p { font-size: 13px; color: var(--gray-400); }
.cs-btn { 
  background: transparent; border: 1px solid rgba(255,255,255,0.2); 
  border-radius: 99px; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--white);
  transition: all 0.2s; white-space: nowrap; cursor: pointer;
}
.cs-card:hover .cs-btn { background: rgba(255,255,255,0.1); }

/* Side Column */
.home-side { display: flex; flex-direction: column; gap: 16px; margin-top: 40px; }
.side-card { 
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius-lg); 
  padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: all 0.2s; cursor: pointer;
}
.side-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); transform: translateX(2px); }
.scd-content h3 { font-size: 15px; font-weight: 600; color: var(--white); margin-bottom: 4px; }
.scd-content p { font-size: 13px; color: var(--gray-400); line-height: 1.5; }
.scd-icon { font-size: 28px; background: rgba(255,255,255,0.05); width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;}

@media (max-width: 1024px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { margin-top: 0; }
}

/* ---------------------------------------------------
   VIEW 2: GENERATE
   --------------------------------------------------- */
.gen-container-view {
  background-image: radial-gradient(circle at top, rgba(14,32,64,1) 0%, var(--navy-950) 60%);
}
.gen-container-view.active {
  overflow: hidden;
  flex-direction: column;
}
.gen-container {
  max-width: 800px; margin: 0 auto; padding: 40px 24px 60px; width: 100%;
  flex: 1; overflow-y: auto; scrollbar-width: none; box-sizing: border-box;
}
.gen-container::-webkit-scrollbar { display: none; }
.gen-header-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 60px; }
.back-link { border:none; background:none; cursor:pointer; color: var(--gray-400); font-family:inherit; font-size: 14px; font-weight: 500; transition: color 0.2s; text-align: left; }
.back-link:hover { color: var(--white); }

.gen-step { display: none; animation: fadeIn 0.3s ease; }
.gen-step.active { display: block; }
.step-header { text-align: center; margin-bottom: 48px; }
.step-title { font-family: var(--font-display); font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.step-sub { color: var(--gray-400); font-size: 16px; }

/* STEP 1: SOURCE GRID */
.source-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.source-card { display: flex; align-items: center; gap: 20px; padding: 24px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-lg); cursor: pointer; transition: all 0.2s; }
.source-card:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); transform: translateY(-2px); }
.source-card.selected { background: rgba(181,232,74,0.05); border-color: rgba(181,232,74,0.4); }
.src-icon { width: 50px; height: 50px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.src-content h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.src-content p { font-size: 14px; color: var(--gray-400); }

/* INPUT AREA */
.source-input-area { background: rgba(14,32,64,0.4); border-radius: var(--radius-lg); padding: 32px; border: 1px solid rgba(255,255,255,0.05); animation: fadeIn 0.3s; }
.input-view { display: none; flex-direction: column; gap: 16px; }
.input-view.active { display: flex; }
.input-view label { font-size: 14px; font-weight: 600; color: var(--gray-200); }
.upload-box { border: 2px dashed rgba(255,255,255,0.15); border-radius: var(--radius-md); padding: 40px; text-align: center; color: var(--gray-400); font-size: 14px; transition: all 0.2s; cursor: pointer; }
.upload-box:hover { border-color: var(--lime-400); color: var(--white); background: rgba(181,232,74,0.03); }
.or-separator { text-align: center; font-size: 12px; font-weight: 700; color: var(--gray-600); margin: 8px 0; }
textarea { width: 100%; height: 120px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-md); padding: 16px; color: var(--white); font-family: inherit; font-size: 14px; resize: vertical; }
textarea:focus { outline: none; border-color: var(--lime-400); }
.yt-input { width: 100%; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-md); padding: 14px 16px; color: var(--white); font-size: 15px; }
.yt-input:focus { outline: none; border-color: var(--lime-400); }

/* STEP 2: CONFIG ACCORDIONS */
.config-list { display: flex; flex-direction: column; gap: 12px; }
.accordion-item { background: rgba(10,22,40,0.6); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-md); overflow: hidden; transition: border-color 0.2s; }
.accordion-item:hover { border-color: rgba(255,255,255,0.15); }
.accordion-item.open { border-color: rgba(181,232,74,0.3); }
.acc-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; cursor: pointer; }
.acc-title-col { display: flex; align-items: center; gap: 16px; }
.acc-icon { font-size: 22px; width: 30px; text-align: center; }
.acc-text h4 { font-size: 16px; font-weight: 600; color: var(--white); margin-bottom: 2px; }
.acc-text p { font-size: 13px; color: var(--gray-400); }
.acc-chevron { font-size: 16px; color: var(--gray-400); transition: transform 0.2s; }
.accordion-item.open .acc-chevron { transform: rotate(180deg); }

.acc-content { display: none; }
.accordion-item.open .acc-content { display: block; }
.acc-inner { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.acc-inner label { font-size: 13px; font-weight: 600; color: var(--gray-200); }

.conf-select { width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--white); font-size: 14px; outline: none; appearance: none; }
.conf-select option { background: var(--navy-800); }
.conf-select:focus { border-color: var(--lime-400); }

.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-group label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--gray-200); }
.checkbox-group input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--lime-500); border-radius: 4px; flex-shrink: 0; }

.conf-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 8px;
}
.conf-toggle-label { font-size: 14px; font-weight: 600; color: var(--gray-200); }
.conf-toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.conf-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.conf-toggle-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  transition: background 0.2s;
}
.conf-toggle-track::before {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
}
.conf-toggle input:checked + .conf-toggle-track { background: #b5e84a; }
.conf-toggle input:checked + .conf-toggle-track::before { transform: translateX(20px); background: #0a1628; }

/* BOTTOM NAV BAR */
.bottom-nav {
  flex-shrink: 0;
  padding: 18px 40px;
  background: rgba(6, 12, 26, 0.98);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  gap: 16px;
}
.bn-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.bn-hint {
  font-size: 13px;
  color: #475569;
  font-weight: 400;
}
.step-badge {
  display: inline-block;
  background: rgba(181,232,74,0.12);
  color: #b5e84a;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 14px;
}

/* ---------------------------------------------------
   VIEW 3: COURSE / STUDY PACK
   --------------------------------------------------- */
.course-view-container {
  background-image: radial-gradient(circle at top left, rgba(14,32,64,0.6) 0%, var(--navy-950) 100%);
}
.course-container { max-width: 760px; margin: 40px auto; padding: 0 24px 100px; }

.course-header { margin-bottom: 40px; }
.course-title { font-family: var(--font-display); font-size: clamp(28px, 4vw, 36px); font-weight: 800; line-height: 1.2; margin-bottom: 16px; letter-spacing: -0.5px; }
.course-desc { font-size: 15px; color: var(--gray-400); line-height: 1.6; }

/* Sections */
.c-section { margin-bottom: 48px; }
.c-section-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.c-section-sub { font-size: 13px; color: var(--gray-400); margin-bottom: 16px; }

/* Practice Grid */
.practice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.p-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-md); padding: 16px; display: flex; align-items: center; gap: 16px; position: relative; transition: background 0.2s; cursor: pointer; }
.p-card:hover { background: rgba(255,255,255,0.06); }
.pc-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.pc-text { display: flex; flex-direction: column; flex: 1; }
.pc-text strong { font-size: 15px; font-weight: 600; color: var(--white); }
.pc-text span { font-size: 13px; color: var(--gray-400); }
.pc-lock { font-size: 14px; opacity: 0.5; color: var(--gray-400); }

/* Modules */
.module-group { margin-bottom: 32px; }
.mod-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mod-num { width: 24px; height: 24px; border-radius: 50%; background: rgba(181,232,74,0.15); color: var(--lime-400); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.mod-title { font-size: 18px; font-weight: 700; color: var(--white); }
.mod-desc { font-size: 14px; color: var(--gray-400); line-height: 1.6; margin-bottom: 16px; padding-left: 36px; }
.mod-items { display: flex; flex-direction: column; gap: 8px; padding-left: 36px; }
.mod-item { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius-sm); padding: 14px 16px; transition: background 0.2s; cursor: pointer; }
.mod-item:hover { background: rgba(255,255,255,0.05); }
.mi-icon { width: 32px; height: 32px; background: rgba(255,255,255,0.05); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.mi-text { display: flex; flex-direction: column; flex: 1; justify-content: center; gap: 2px;}
.mi-text strong { font-size: 14px; font-weight: 600; color: var(--gray-200); }
.mi-text span { font-size: 12px; color: var(--gray-400); }
.mi-check { font-size: 16px; color: var(--gray-600); }
.mi-check.completed { color: var(--lime-500); font-weight: bold; text-shadow: 0 0 10px rgba(181,232,74,0.5); }
.mi-chevron { font-size: 18px; color: var(--gray-400); }

.c-section .mod-items[style] { padding-left: 0 !important; }

/* Reused Utilities */
.bg-purple { background: rgba(168,85,247,0.15); color: #a855f7; }
.bg-blue { background: rgba(59,130,246,0.15); color: #60a5fa; }
.bg-pink { background: rgba(236,72,153,0.15); color: #f472b6; }
.bg-lime { background: rgba(163,230,53,0.15); color: #a3e635; }

.topic-input {
  width: 100%;
  padding: 16px;
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(168,85,247,0.3);
  border-radius: var(--radius-md);
  color: var(--white);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
}

.topic-input:focus {
  outline: none;
  border-color: #a855f7;
  background: rgba(0,0,0,0.4);
}

.topic-input::placeholder {
  color: var(--gray-500);
}

.input-hint {
  margin-top: 12px;
  font-size: 14px;
  color: var(--gray-400);
  line-height: 1.5;
}

/* Source Video */
.video-card { width: 220px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid rgba(255,255,255,0.1); cursor: pointer; position: relative; }
.vid-thumb { width: 100%; height: 120px; display: flex; align-items: center; justify-content: center; background-position: center; background-size: cover; }
.vid-thumb::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.3); }
.vid-play { width: 40px; height: 28px; background: #ff0000; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; z-index: 2; position: relative; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 1000; transform: translateX(-100%); transition: transform 0.3s; }
  .practice-grid { grid-template-columns: 1fr; }
  .mod-items { padding-left: 0; }
  .mod-desc { padding-left: 0; }
}

/* --------------------------------------
   NOTES VIEWER VIEW
-------------------------------------- */
.notes-view-container {
  background-color: #0B1120;
  color: #F8FAFC;
  min-height: 100%;
  display: flex !important;
  flex-direction: column;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
}

#view-notes:not(.active) {
  display: none !important;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
}

.nh-title-col h1 {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: inherit;
}

.nh-meta {
  font-size: 13px;
  color: #94A3B8;
  display: flex;
  gap: 8px;
  align-items: center;
}

.notes-body {
  flex: 1;
  font-family: 'Inter', sans-serif;
  line-height: 1.8;
  font-size: 16px;
  color: #E2E8F0;
  margin-bottom: 40px;
}

.notes-body h1,
.notes-body h2,
.notes-body h3 {
  font-family: var(--font-display, 'Outfit', sans-serif);
  color: #F8FAFC;
  margin-top: 32px;
  margin-bottom: 16px;
}

.notes-body h3 {
  font-size: 20px;
}

.notes-body h4 {
  font-size: 16px;
  margin-top: 24px;
  margin-bottom: 12px;
  color: #cbd5e1;
}

.notes-body p {
  margin-bottom: 16px;
}

.notes-body ul {
  margin-bottom: 24px;
  padding-left: 20px;
}

.notes-body li {
  margin-bottom: 12px;
}

.notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-top: none;
  background: transparent;
}

.notes-nav-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1;
  padding: 0;
}

.notes-nav-circle:hover {
  border-color: rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.9);
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 24px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.btn-icon:hover {
  background: rgba(181, 232, 74, 0.15);
  border-color: var(--lime-500);
  color: var(--lime-400);
}

.btn-icon[style*='hidden'] {
  pointer-events: none;
  opacity: 0;
}

.notes-view-container {
  overflow-y: auto;
  scrollbar-width: none;
}
.notes-view-container::-webkit-scrollbar {
  display: none;
}

/* --------------------------------------
   GENERATING BUTTON SPINNER
-------------------------------------- */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

@keyframes btn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: rgba(0, 0, 0, 0.85);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  flex-shrink: 0;
}

#btn-generate.is-generating {
  animation: btn-pulse 1.4s ease-in-out infinite;
  cursor: not-allowed;
  gap: 10px;
}

/* --------------------------------------
   QUIZ GAME VIEW
-------------------------------------- */
.quiz-game-view {
  background: #080f1e;
  display: flex !important;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}
.quiz-game-view::-webkit-scrollbar { display: none; }
#view-quiz:not(.active) { display: none !important; }

.qg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  flex-shrink: 0;
}
.qg-meta { display: flex; align-items: center; gap: 16px; }
.qg-mode-badge {
  background: rgba(181,232,74,0.15);
  color: #b5e84a;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.qg-counter { color: #64748b; font-size: 15px; font-weight: 500; }
.qg-close {
  background: none; border: none; color: #64748b;
  font-size: 20px; cursor: pointer; padding: 8px;
  border-radius: 8px; transition: color 0.2s, background 0.2s;
}
.qg-close:hover { background: rgba(255,255,255,0.05); color: #f8fafc; }

.qg-progress-bar {
  height: 3px; background: rgba(255,255,255,0.07);
  margin: 0; flex-shrink: 0;
}
.qg-progress-fill {
  height: 100%; background: #b5e84a;
  border-radius: 0 99px 99px 0;
  transition: width 0.4s ease; width: 0%;
}

.qg-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 48px 40px 40px;
  max-width: 780px; width: 100%; margin: 0 auto;
}
.qg-question-text {
  font-size: 22px; font-weight: 600; color: #f8fafc;
  text-align: center; line-height: 1.55; margin-bottom: 40px;
  font-family: var(--font-display, 'Outfit', sans-serif);
}
.qg-options-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; width: 100%; margin-bottom: 32px;
}
.qg-option {
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: 12px; padding: 18px 22px;
  color: #e2e8f0; font-size: 15px;
  font-family: 'Inter', sans-serif;
  text-align: left; cursor: pointer;
  transition: all 0.18s; line-height: 1.4;
}
.qg-option:not(:disabled):hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}
.qg-option:disabled { cursor: default; }
.qg-opt-correct {
  background: rgba(34,197,94,0.14) !important;
  border-color: #22c55e !important; color: #86efac !important;
}
.qg-opt-wrong {
  background: rgba(239,68,68,0.12) !important;
  border-color: #ef4444 !important; color: #fca5a5 !important;
}
.qg-feedback {
  width: 100%; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  animation: fadeSlideUp 0.3s ease;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qgf-result { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.qgf-icon { font-size: 24px; }
.qgf-label.correct { color: #22c55e; }
.qgf-label.wrong   { color: #ef4444; }
.qgf-explanation { color: #94a3b8; font-size: 14px; text-align: center; line-height: 1.6; max-width: 600px; }
.qg-next-btn { padding: 12px 36px; font-size: 15px; font-weight: 600; border-radius: 10px; }

.qg-timer-wrap {
  position: relative; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.qg-timer-text {
  font-size: 15px; font-weight: 700; color: #f8fafc; position: absolute;
}
.qg-timer-ring { width: 52px; height: 52px; transform: rotate(-90deg); }
.qg-timer-ring-track { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 3; }
.qg-timer-ring-fill {
  fill: none; stroke: #b5e84a; stroke-width: 3;
  stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.qg-timer-low .qg-timer-ring-fill { stroke: #ef4444; }
.qg-timer-low .qg-timer-text { color: #ef4444; }

/* --------------------------------------
   QUIZ RESULTS VIEW
-------------------------------------- */
.quiz-results-view {
  background: #080f1e;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#view-quiz-results:not(.active) { display: none !important; }
.qr-box {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  max-width: 520px; width: 100%; padding: 40px; text-align: center;
}
.qr-emoji { font-size: 60px; animation: bounceIn 0.5s ease; }
@keyframes bounceIn {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.qr-title {
  font-size: 30px; font-weight: 700; color: #f8fafc; margin: 0;
  font-family: var(--font-display, 'Outfit', sans-serif);
}
.qr-score-wrap { display: flex; align-items: baseline; gap: 12px; }
.qr-score { font-size: 52px; font-weight: 800; color: #b5e84a; font-family: var(--font-display, 'Outfit', sans-serif); }
.qr-pct   { font-size: 22px; color: #64748b; font-weight: 600; }
.qr-subtitle { color: #94a3b8; font-size: 15px; margin: 0; }
.qr-review {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; max-height: 220px; overflow-y: auto; scrollbar-width: none;
}
.qr-review::-webkit-scrollbar { display: none; }
.qr-item { padding: 10px 16px; border-radius: 8px; font-size: 13px; text-align: left; color: #e2e8f0; }
.qr-item-correct { background: rgba(34,197,94,0.08); border-left: 3px solid #22c55e; }
.qr-item-wrong   { background: rgba(239,68,68,0.08); border-left: 3px solid #ef4444; }
.qr-actions { display: flex; gap: 16px; margin-top: 8px; }

/* --------------------------------------
   QUIZ MODES VIEW
-------------------------------------- */
.quiz-modes-view {
  background-color: #0d1222;
  align-items: center;
  justify-content: center;
}

.qm-container {
  width: 100%;
  max-width: 900px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qm-header {
  text-align: center;
  margin-bottom: 48px;
}

.qm-header .qm-title {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 36px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
}

.qm-header .qm-subtitle {
  color: var(--gray-400);
  font-size: 16px;
}

.qm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  margin-bottom: 40px;
}

.qm-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.qm-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}

.qm-card-active, .qm-card:active {
  background: rgba(181, 232, 74, 0.04);
  border-color: var(--lime-500);
}

.qm-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.qm-text {
  display: flex;
  flex-direction: column;
}

.qm-text h3 {
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.qm-text p {
  color: var(--gray-400);
  font-size: 13px;
  margin: 0;
}

.qm-footer {
  width: 100%;
  display: flex;
  justify-content: center;
}

#btn-close-quiz-modes:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

/* --------------------------------------
   FLASHCARDS VIEW
-------------------------------------- */
.fc-view-container {
  background-color: #0b1120;
  display: flex !important;
  flex-direction: column;
  position: relative;
  align-items: center;
  justify-content: flex-start;
  padding-top: 40px;
}

#view-flashcards:not(.active) {
  display: none !important;
}

/* Progress Bar */
.fc-top-bar {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 40px;
}

.fc-progress-wrap {
  width: 400px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
}

.fc-progress-bar {
  height: 100%;
  background: #a3e635; /* lime/green */
  border-radius: 4px;
  transition: width 0.3s ease;
}

.fc-progress-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #a3e635;
  color: #000;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  white-space: nowrap;
}

/* Scene Setup */
.fc-scene {
  width: 600px;
  height: 440px;
  perspective: 1200px;
  position: relative;
  margin-bottom: 30px;
}

.fc-card {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.fc-card.is-flipped {
  transform: rotateY(180deg);
}

.fc-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  background: #1e293b;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.fc-front h2 {
  font-family: var(--font-display, 'Outfit', serif);
  font-size: 32px;
  font-weight: 600;
  color: #f8fafc;
}

.fc-hint-icon {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.1);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.fc-back {
  transform: rotateY(180deg);
}

.fc-def {
  font-size: 24px;
  color: #f8fafc;
  line-height: 1.4;
  margin-bottom: 24px;
  font-family: var(--font-display, 'Outfit', serif);
}

.fc-tip {
  font-size: 15px;
  color: #2dd4bf; /* soft teal */
}

.fc-flip-hint {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 24px;
  color: #94a3b8;
  font-size: 13px;
}

/* Rating Area */
.fc-rating-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}

.fc-rating-area.show {
  opacity: 1;
  pointer-events: auto;
}

.fc-rating-title {
  color: #f8fafc;
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
  margin-bottom: 20px;
}

.fc-rating-buttons {
  display: flex;
  gap: 16px;
}

.fc-rate-btn {
  background: transparent;
  width: 90px;
  height: 52px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid;
  transition: all 0.2s;
  padding: 0;
}

.fc-rate-btn:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.05);
}

.fc-rate-btn .rate-num {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.fc-rate-btn .rate-lbl {
  position: absolute;
  bottom: -22px;
  font-size: 12px;
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.fc-rate-btn:hover .rate-lbl { opacity: 1; }

.rate-1 { border-color: #ef4444; color: #ef4444; }
.rate-2 { border-color: #f59e0b; color: #f59e0b; }
.rate-3 { border-color: #84cc16; color: #84cc16; }
.rate-4 { border-color: #0ea5e9; color: #0ea5e9; }

@media (max-width: 768px) {
  .fc-scene { width: 90%; height: 360px; }
  .fc-rate-btn { width: 70px; height: 44px; }
}

/* --------------------------------------
   MIND MAP VIEW
-------------------------------------- */
.mindmap-view {
  background-color: #0b1120;
  display: flex !important;
  flex-direction: column;
}
#view-mindmap:not(.active) { display: none !important; }

.mm-header {
  padding: 32px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(10,22,40,0.8);
  backdrop-filter: blur(10px);
  z-index: 10;
}
.mm-title-col h1 {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}
.mm-canvas {
  flex: 1;
  overflow: auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px;
}

/* CSS Tree Structure */
.tree {
  transform: scale(0.9);
  transform-origin: center center;
}
.tree ul {
  padding-top: 20px; position: relative;
  display: flex;
  justify-content: center;
  transition: all 0.5s;
}
.tree li {
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 5px 0 5px;
  transition: all 0.5s;
}
/* Connectors */
.tree li::before, .tree li::after{
  content: '';
  position: absolute; top: 0; right: 50%;
  border-top: 2px solid #334155;
  width: 50%; height: 20px;
}
.tree li::after{
  right: auto; left: 50%;
  border-left: 2px solid #334155;
}
.tree li:only-child::after, .tree li:only-child::before {
  display: none;
}
.tree li:only-child{ padding-top: 0;}
.tree li:first-child::before, .tree li:last-child::after{
  border: 0 none;
}
.tree li:last-child::before{
  border-right: 2px solid #334155;
  border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
  border-radius: 5px 0 0 0;
}
.tree ul ul::before{
  content: '';
  position: absolute; top: 0; left: 50%;
  border-left: 2px solid #334155;
  width: 0; height: 20px;
}
/* Node Styling */
.tree li a {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 14px 24px;
  text-decoration: none;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
  background: rgba(14,32,64,0.9);
  border-radius: 8px;
  transition: all 0.3s;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}
.tree li a:hover, .tree li a:hover+ul li a {
  background: rgba(181, 232, 74, 0.1);
  color: #a3e635;
  border: 1px solid #a3e635;
}
.tree li a:hover+ul li::after, 
.tree li a:hover+ul li::before, 
.tree li a:hover+ul::before, 
.tree li a:hover+ul ul::before{
  border-color: #a3e635;
}

/* =========================================================
   AI TUTOR VIEW
   ========================================================= */
.tutor-view { flex-direction: column; }
.tutor-container {
  display: flex; flex-direction: column;
  height: 100%; max-width: 820px;
  margin: 0 auto; width: 100%;
  padding: 0 24px; box-sizing: border-box;
}
.tutor-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.tutor-header-info {
  display: flex; flex-direction: column; gap: 2px;
}
.tutor-badge {
  font-size: 13px; font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.3px;
}
.tutor-course-name {
  font-size: 13px; color: var(--gray-400);
  max-width: 400px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.tutor-messages {
  flex: 1; overflow-y: auto;
  padding: 20px 0; display: flex;
  flex-direction: column; gap: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tutor-messages::-webkit-scrollbar { display: none; }
.tutor-input-area {
  padding: 16px 0 24px; flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.tutor-typing { color: var(--gray-400); font-style: italic; }

/* Upgrade CTA bubble */
.upgrade-cta-bubble {
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(239,68,68,0.08)) !important;
  border: 1px solid rgba(245,158,11,0.3) !important;
}
.btn-chat-upgrade {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity 0.2s;
}
.btn-chat-upgrade:hover { opacity: 0.85; }

/* Practice card — clickable state */
.p-card { cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.p-card:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.15); }
.p-card.pro-locked { opacity: 0.6; }
.p-card.pro-unlocked .pc-lock { display: none; }

/* Single AI Tutor card */
.practice-grid-single { grid-template-columns: 1fr; }
.p-card-tutor { padding: 20px 24px; }
.p-card-tutor .pc-icon { width: 48px; height: 48px; font-size: 22px; }
.p-card-tutor .pc-text strong { font-size: 16px; }
.p-card-tutor .pc-text span { font-size: 13px; }

/* --- MOBILE RESPONSIVENESS (768px and below) --- */

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--navy-950);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 999;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  backdrop-filter: blur(20px);
}

.mobile-menu-toggle {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.mobile-logo img {
  width: 28px;
  height: 28px;
}

.mobile-logo span {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
}

.mobile-logo span span {
  color: var(--lime-400);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  /* Layout Changes */
  .mobile-header { display: flex; }
  
  .dashboard-layout {
    flex-direction: column;
    padding-top: 64px; /* Space for fixed header */
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1001;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
    background: var(--navy-900);
  }

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

  .main-content {
    width: 100%;
    padding: 0;
    height: calc(100vh - 64px);
    overflow-x: hidden;
  }

  /* View Containers */
  .app-view {
    padding: 20px !important;
  }

  /* Home View Responsiveness */
  .new-home-layout {
    padding: 24px 16px !important;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .qs-grid {
    grid-template-columns: 1fr;
  }

  /* QUIZ & FLASHCARDS RESPONSIVENESS */
  .qm-container { padding: 24px 16px; }
  .qm-grid { grid-template-columns: 1fr; gap: 12px; }
  .qm-header .qm-title { font-size: 28px; }
  
  .qg-header { padding: 16px 20px; }
  .qg-body { padding: 24px 20px; }
  .qg-question-text { font-size: 18px; margin-bottom: 24px; }
  .qg-options-grid { grid-template-columns: 1fr; gap: 10px; }
  .qg-option { padding: 14px 18px; font-size: 14px; }
  
  .qr-box { padding: 24px 20px; }
  .qr-title { font-size: 24px; }
  .qr-score { font-size: 40px; }

  .fc-view-container { padding-top: 20px; }
  .fc-top-bar { margin-bottom: 20px; padding: 0 20px; }
  .fc-progress-wrap { width: 100%; }
  .fc-scene { width: 100%; height: 320px; margin-bottom: 20px; }
  .fc-face { padding: 24px; }
  .fc-front h2 { font-size: 24px; }
  .fc-def { font-size: 18px; }
  .fc-rating-buttons { gap: 8px; width: 100%; }
  .fc-rate-btn { flex: 1; width: auto; height: 48px; }
  .fc-rate-btn .rate-lbl { display: none !important; } /* Hide labels on mobile to save space */
  .fc-flip-hint { margin-bottom: 16px; }
  
  .btn-close-fc { right: 20px !important; top: 12px !important; }

  .courses-grid {
    grid-template-columns: 1fr;
  }

  /* Generate View Responsiveness */
  .gen-container {
    padding: 0 !important;
  }

  .source-grid {
    gap: 12px;
  }

  .source-card {
    padding: 16px;
  }

  .source-input-area {
    padding: 20px;
  }

  .upload-box {
    padding: 30px 16px;
  }

  .step-title {
    font-size: 26px;
  }

  /* Chat View Responsiveness */
  .chat-container {
    flex-direction: column;
  }

  .chat-sidebar {
    display: none; /* Hide history on mobile */
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-area {
    padding: 16px;
  }

  .chat-input-wrap {
    padding: 8px 8px 8px 16px;
  }

  /* Library View Responsiveness */
  .library-view {
    padding: 20px !important;
  }

  .library-header h1 {
    font-size: 24px;
  }

  .library-grid {
    grid-template-columns: 1fr;
    padding: 0;
  }

  /* Settings View Responsiveness */
  .settings-container {
    flex-direction: column;
  }

  .settings-sidebar {
    width: 100%;
    padding: 20px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .settings-main {
    padding: 20px;
  }

  /* Modals */
  .notification-modal {
    width: 95%;
  }
}

/* Fix for horizontal scroll on app views */
.app-view {
    width: 100%;
    box-sizing: border-box;
}
