/* =============================================================================
   BREVV - CUSTOM STYLES
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ----------------------------------------------------------------------------- */
:root {
  /* Colors */
  --color-primary: #008cff;
  --color-primary-hover: #0077dd;
  --color-primary-foreground: #ffffff;
  
  --color-background: #ffffff;
  --color-surface: #ffffff;
  --color-surface-foreground: #0F172A;
  
  --color-muted: #F8FAFC;
  --color-muted-foreground: #64748B;
  
  --color-slate-50: #F8FAFC;
  --color-slate-100: #F1F5F9;
  --color-slate-200: #E2E8F0;
  --color-slate-300: #CBD5E1;
  --color-slate-400: #94A3B8;
  --color-slate-500: #64748B;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1E293B;
  --color-slate-900: #0F172A;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  
  /* Spacing */
  --header-height: 64px;
  --sidebar-width: 256px;
  --sidebar-collapsed: 64px;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* -----------------------------------------------------------------------------
   GLOBAL RESET & BASE STYLES
   ----------------------------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-background);
  color: var(--color-surface-foreground);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* -----------------------------------------------------------------------------
   LAYOUT STRUCTURE
   ----------------------------------------------------------------------------- */
.lms-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.lms-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--color-slate-200);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.lms-main {
  display: flex;
  flex: 1;
  position: relative;
}

.lms-sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--color-slate-200);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.lms-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.lms-content {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* -----------------------------------------------------------------------------
   HEADER COMPONENTS
   ----------------------------------------------------------------------------- */
.header-logo-section {
  width: var(--sidebar-width);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-right: 1px solid var(--color-slate-200);
  height: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.header-logo span {
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  text-transform: uppercase;
}

.header-search {
  flex: 1;
  padding: 0 1.5rem;
  max-width: 600px;
}

.header-search-input {
  width: 100%;
  height: 40px;
  padding: 0 1rem 0 2.75rem;
  background: var(--color-slate-50);
  border: none;
  border-radius: 9999px;
  font-size: 0.875rem;
  color: var(--color-slate-600);
  transition: all 0.2s;
}

.header-search-input:focus {
  outline: none;
  background: white;
  box-shadow: 0 0 0 1px var(--color-slate-200);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-right: 1.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-slate-500);
  transition: all 0.2s;
  position: relative;
}

.icon-button:hover {
  color: var(--color-slate-700);
  background: var(--color-slate-50);
}

/* Notification Bell Dot */
.notification-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  background-color: #008cff;
  border-radius: 50%;
  border: 2px solid white;
}

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: 384px;
  max-width: 90vw;
  background: white;
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 50;
}

.notification-dropdown-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notification-dropdown-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-slate-900);
}

.notification-dropdown-content {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: start;
  gap: 0.75rem;
  transition: background-color 0.2s;
  cursor: pointer;
  border-bottom: 1px solid var(--color-slate-100);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background-color: var(--color-slate-50);
}

.notification-item.unread {
  background-color: white;
}

.notification-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-item.unread .notification-icon {
  background-color: rgba(0, 140, 255, 0.1);
  color: #008cff;
}

.notification-item:not(.unread) .notification-icon {
  background-color: var(--color-slate-100);
  color: var(--color-slate-400);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 0.875rem;
  color: var(--color-slate-600);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.notification-item.unread .notification-title {
  font-weight: 600;
  color: var(--color-slate-900);
}

.notification-message {
  font-size: 0.75rem;
  color: var(--color-slate-500);
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--color-slate-400);
}

.unread-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #008cff;
  border-radius: 50%;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.notification-dropdown-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-slate-100);
  background-color: var(--color-slate-50);
  text-align: center;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.2s;
}

.avatar:hover {
  border-color: var(--color-slate-200);
}

/* -----------------------------------------------------------------------------
   SIDEBAR NAVIGATION
   ----------------------------------------------------------------------------- */
.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.sidebar-welcome h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-slate-900);
  margin-bottom: 0.25rem;
}

.sidebar-welcome p {
  font-size: 0.75rem;
  color: var(--color-slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.sidebar-cta {
  padding: 0 1.5rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.btn-complete-profile {
  width: 100%;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid var(--color-slate-300);
  color: var(--color-primary);
  font-weight: 500;
  font-size: 0.75rem;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.btn-complete-profile:hover {
  background: white;
  border-color: var(--color-slate-300);
}

.sidebar-cta-hint {
  font-size: 0.625rem;
  color: var(--color-slate-500);
  margin-top: 0.5rem;
  line-height: 1.4;
}

.sidebar-nav {
  flex: 1;
  padding: 0 1rem;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 2rem;
}

.nav-group-label {
  padding: 0 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-slate-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-slate-500);
  transition: all 0.2s;
  position: relative;
}

.nav-item:hover {
  background: var(--color-slate-50);
  color: var(--color-slate-900);
}

.nav-item.active {
  background: var(--color-slate-100);
  color: var(--color-primary);
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  color: var(--color-slate-400);
}

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

.nav-notification-dot {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
}

/* -----------------------------------------------------------------------------
   BUTTONS
   ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(0, 140, 255, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--color-slate-700);
  border: 1px solid var(--color-slate-200);
}

.btn-secondary:hover {
  background: #EFF6FF;
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 140, 255, 0.15);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-slate-700);
}

.btn-ghost:hover {
  background: var(--color-slate-50);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

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

input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background-color: #F1F5F9;
  color: #94A3B8;
}

/* -----------------------------------------------------------------------------
   CARDS
   ----------------------------------------------------------------------------- */
.card {
  background: white;
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-xl);
  box-shadow: none;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--color-slate-300);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--color-slate-100);
}

/* Course Card Variants */
.course-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.course-card-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-slate-100);
  overflow: hidden;
  position: relative;
}

.course-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.course-card:hover .course-card-thumbnail img {
  transform: scale(1.05);
}

.course-card-content {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.course-card-instructor {
  font-size: 0.75rem;
  color: var(--color-slate-500);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.course-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-slate-900);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.course-card:hover .course-card-title {
  color: var(--color-primary);
}

.course-card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--color-slate-100);
  color: var(--color-slate-600);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-slate-100);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s;
}

.progress-text {
  font-size: 0.6875rem;
  color: var(--color-slate-400);
  font-weight: 500;
}

/* -----------------------------------------------------------------------------
   COURSE LESSON VIEWER
   ----------------------------------------------------------------------------- */
.lesson-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
}

.lesson-sidebar {
  width: 320px;
  background: white;
  border-right: 1px solid var(--color-slate-200);
  overflow-y: auto;
}

.lesson-content {
  flex: 1;
  overflow-y: auto;
  background: white;
}

.lesson-assistant {
  width: 320px;
  background: white;
  border-left: 1px solid var(--color-slate-200);
  display: flex;
  flex-direction: column;
}

/* Module/Section List */
.module-list {
  padding: 1rem;
}

.module-item {
  margin-bottom: 1rem;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--color-slate-50);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-slate-900);
}

.lesson-list {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8125rem;
  color: var(--color-slate-700);
}

.lesson-item:hover {
  background: var(--color-slate-50);
}

.lesson-item.active {
  background: var(--color-slate-100);
  color: var(--color-primary);
  font-weight: 600;
}

.lesson-item.completed {
  color: var(--color-slate-500);
}

.lesson-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.lesson-icon {
  width: 16px;
  height: 16px;
  color: var(--color-slate-400);
}

.lesson-item.active .lesson-icon {
  color: var(--color-primary);
}

/* Video Player */
.video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Tabs */
.tabs {
  border-bottom: 1px solid var(--color-slate-200);
  display: flex;
  gap: 0;
}

.tab {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-slate-500);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--color-slate-900);
}

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Chat/Assistant */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(180deg, var(--color-slate-50) 0%, white 100%);
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: fadeInUp 0.3s ease-out;
}

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

.chat-message.user {
  align-items: flex-end;
}

.chat-message.assistant {
  align-items: flex-start;
}

.chat-bubble {
  max-width: 88%;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-bubble.assistant {
  background: white;
  color: var(--color-slate-800);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--color-slate-100);
}

.chat-bubble.user {
  background: linear-gradient(135deg, var(--color-primary) 0%, #0062b8 100%);
  color: white;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 2px 4px rgba(0, 140, 255, 0.2);
}

/* Chat bubble content styling */
.chat-bubble p {
  margin: 0;
}

.chat-bubble p + p {
  margin-top: 0.5rem;
}

.chat-bubble h3,
.chat-bubble h4 {
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.375rem;
}

.chat-bubble h3:first-child,
.chat-bubble h4:first-child {
  margin-top: 0;
}

.chat-bubble ul {
  margin: 0.5rem 0;
  padding-left: 0;
}

.chat-bubble li {
  margin-left: 1rem;
  padding-left: 0.25rem;
  margin-bottom: 0.25rem;
}

.chat-bubble code {
  background: var(--color-slate-100);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
}

.chat-bubble.user code {
  background: rgba(255, 255, 255, 0.2);
}

.chat-bubble a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-bubble.user a {
  color: white;
}

/* Chat source references */
.chat-sources {
  max-width: 88%;
}

.chat-input-container {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-slate-200);
  display: flex;
  gap: 0.5rem;
  background: white;
}

.chat-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--color-slate-200);
  border-radius: 20px;
  font-size: 0.8125rem;
  background: var(--color-slate-50);
  transition: all 0.2s;
}

.chat-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(0, 140, 255, 0.1);
}

.chat-input::placeholder {
  color: var(--color-slate-400);
}

/* -----------------------------------------------------------------------------
   UTILITY CLASSES
   ----------------------------------------------------------------------------- */
.text-primary {
  color: var(--color-primary);
}

.text-slate-900 {
  color: var(--color-slate-900);
}

.text-slate-600 {
  color: var(--color-slate-600);
}

.text-slate-500 {
  color: var(--color-slate-500);
}

.text-slate-400 {
  color: var(--color-slate-400);
}

.bg-primary {
  background: var(--color-primary);
}

.bg-slate-50 {
  background: var(--color-slate-50);
}

.hidden {
  display: none;
}

/* -----------------------------------------------------------------------------
   RESPONSIVE
   ----------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .lms-sidebar {
    position: fixed;
    left: -256px;
    z-index: 40;
    transition: left 0.3s;
  }
  
  .lms-sidebar.open {
    left: 0;
  }
  
  .header-logo-section {
    width: auto;
    border-right: none;
  }
  
  .lesson-sidebar,
  .lesson-assistant {
    position: fixed;
    z-index: 30;
    transition: transform 0.3s;
  }
  
  .lesson-sidebar {
    left: 0;
    transform: translateX(-100%);
  }
  
  .lesson-sidebar.open {
    transform: translateX(0);
  }
  
  .lesson-assistant {
    right: 0;
    transform: translateX(100%);
  }
  
  .lesson-assistant.open {
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  .lms-content {
    padding: 1.5rem;
  }
  
  .header-search {
    display: none;
  }
}

/* -----------------------------------------------------------------------------
   SCROLLBAR STYLING (Optional)
   ----------------------------------------------------------------------------- */
.lms-sidebar::-webkit-scrollbar,
.lesson-sidebar::-webkit-scrollbar,
.lesson-content::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.lms-sidebar::-webkit-scrollbar-track,
.lesson-sidebar::-webkit-scrollbar-track,
.lesson-content::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.lms-sidebar::-webkit-scrollbar-thumb,
.lesson-sidebar::-webkit-scrollbar-thumb,
.lesson-content::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-slate-200);
  border-radius: 3px;
}

.lms-sidebar::-webkit-scrollbar-thumb:hover,
.lesson-sidebar::-webkit-scrollbar-thumb:hover,
.lesson-content::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--color-slate-300);
}

/* -----------------------------------------------------------------------------
   ANIMATIONS
   ----------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
  animation: slideInFromBottom 0.3s ease-out;
}