/* ==========================================================================
   EduLMS - Core Theme
   Color palette derived from the reference dashboard mockup (purple/indigo)
   ========================================================================== */

:root{
  --primary: #6C5DD3;
  --primary-dark: #5b4bc4;
  --primary-light: #efeafe;
  --accent-teal: #00C2CB;
  --accent-orange: #FF9F43;
  --accent-red: #FF6B6B;
  --accent-green: #2ED47A;
  --accent-blue: #3F8CFF;

  --sidebar-bg: #211C4D;
  --sidebar-bg-active: #6C5DD3;
  --sidebar-text: #B7B3D9;
  --sidebar-text-active: #ffffff;

  --body-bg: #F5F6FA;
  --card-bg: #ffffff;
  --text-dark: #1E1B39;
  --text-muted: #8A8AA3;
  --border-color: #EDEDF5;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 4px 24px rgba(33, 28, 77, 0.06);

  --sidebar-width: 260px;
}

*{ box-sizing: border-box; }

body{
  background: var(--body-bg);
  color: var(--text-dark);
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
}

a{ text-decoration: none; }

/* ==========================================================================
   Layout shell
   ========================================================================== */

.app-shell{
  display: flex;
  min-height: 100vh;
}

.main-content{
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

.content-body{
  padding: 24px clamp(16px, 3vw, 32px) 48px;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar{
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}

.sidebar-brand{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
}

.sidebar-brand .brand-icon{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-user{
  margin: 4px 18px 18px;
  padding: 14px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user img{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.sidebar-user .name{
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.2;
}

.sidebar-user .role{
  font-size: .74rem;
  color: var(--sidebar-text);
}

.sidebar-nav{
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 14px;
}

.sidebar-nav .nav-section-title{
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(183,179,217,.6);
  padding: 14px 10px 6px;
}

.sidebar-nav .nav-link{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.sidebar-nav .nav-link i{
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

.sidebar-nav .nav-link:hover{
  background: rgba(255,255,255,.06);
  color: #fff;
}

.sidebar-nav .nav-link.active{
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 6px 16px rgba(108, 93, 211, .45);
}

.sidebar-nav .nav-link .badge{
  margin-left: auto;
  font-size: .68rem;
  font-weight: 600;
}

.sidebar-footer{
  padding: 14px 18px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer .nav-link{
  color: var(--sidebar-text);
}
.sidebar-footer .nav-link:hover{
  color: #fff;
}

.sidebar-backdrop{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 41, .5);
  z-index: 1030;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar{
  position: sticky;
  top: 0;
  z-index: 1020;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 14px clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle{
  display: none;
  background: var(--body-bg);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-dark);
  flex-shrink: 0;
}

.topbar-search{
  flex: 1;
  max-width: 380px;
  position: relative;
}

.topbar-search input{
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--body-bg);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 40px;
  font-size: .85rem;
}

.topbar-search input:focus{
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.topbar-search i{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.topbar-actions{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn{
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  font-size: 1.1rem;
  border: none;
}

.icon-btn .dot{
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid #fff;
}

.topbar-profile{
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-profile img{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-profile .name{
  font-weight: 600;
  font-size: .85rem;
  line-height: 1.2;
}

.topbar-profile .role{
  font-size: .72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Welcome banner
   ========================================================================== */

.welcome-banner{
  background: linear-gradient(120deg, var(--primary) 0%, #8B7CF0 100%);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  overflow: hidden;
  position: relative;
}

.welcome-banner::after{
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  right: -60px;
  top: -80px;
}

.welcome-banner h2{
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-banner p{
  margin: 0;
  font-size: .88rem;
  opacity: .9;
  max-width: 480px;
}

.welcome-banner .btn-light-pill{
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
}

/* ==========================================================================
   Stat cards
   ========================================================================== */

.stat-card{
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
}

.stat-card .stat-icon{
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card .stat-value{
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label{
  font-size: .78rem;
  color: var(--text-muted);
}

.bg-tint-purple{ background: var(--primary-light); color: var(--primary); }
.bg-tint-orange{ background: #FFF2E5; color: var(--accent-orange); }
.bg-tint-green{ background: #E6FBF1; color: var(--accent-green); }
.bg-tint-blue{ background: #E9F2FF; color: var(--accent-blue); }

/* ==========================================================================
   Generic card
   ========================================================================== */

.card-panel{
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
}

.card-panel-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-panel-header h3{
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.card-panel-header .link-more{
  font-size: .78rem;
  color: var(--primary);
  font-weight: 600;
}

/* ==========================================================================
   Course list item
   ========================================================================== */

.course-item{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.course-item:last-child{ border-bottom: none; padding-bottom: 0; }
.course-item:first-child{ padding-top: 0; }

.course-thumb{
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  color: #fff;
}

.course-item .course-title{
  font-weight: 600;
  font-size: .85rem;
  margin-bottom: 2px;
}

.course-item .course-meta{
  font-size: .72rem;
  color: var(--text-muted);
}

.course-item .progress{
  height: 6px;
  border-radius: 4px;
  background: var(--border-color);
  width: 120px;
}

.course-item .progress-bar{
  border-radius: 4px;
  background: var(--primary);
}

/* ==========================================================================
   Assignment / announcement list item
   ========================================================================== */

.list-item{
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.list-item:last-child{ border-bottom: none; padding-bottom: 0; }
.list-item:first-child{ padding-top: 0; }

.list-item .item-icon{
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.list-item .item-title{
  font-weight: 600;
  font-size: .82rem;
  margin-bottom: 2px;
}

.list-item .item-meta{
  font-size: .72rem;
  color: var(--text-muted);
}

.list-item .item-time{
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* badge pills */
.pill{
  font-size: .68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
}
.pill-green{ background:#E6FBF1; color: var(--accent-green); }
.pill-orange{ background:#FFF2E5; color: var(--accent-orange); }
.pill-red{ background:#FFEAEA; color: var(--accent-red); }
.pill-blue{ background:#E9F2FF; color: var(--accent-blue); }

/* ==========================================================================
   Chart legend helper
   ========================================================================== */

.legend-row{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.legend-dot{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-row .val{
  margin-left: auto;
  font-weight: 600;
  color: var(--text-dark);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991.98px){
  .main-content{ margin-left: 0; }
  .sidebar{ transform: translateX(-100%); }
  .sidebar.show{ transform: translateX(0); }
  .sidebar-backdrop.show{ display: block; }
  .sidebar-toggle{ display: flex; }
  .topbar-search{ display: none; }
}

@media (max-width: 575.98px){
  .welcome-banner{ flex-direction: column; align-items: flex-start; }
  .welcome-banner .btn-light-pill{ align-self: flex-start; }
  .content-body{ padding: 16px 14px 36px; }
}

/* ==========================================================================
   Drill-down pages: upload dropzone, quiz options, exam navigator
   (Assignment submission, exam taking / results)
   ========================================================================== */

.upload-dropzone{
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  background: var(--body-bg);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.upload-dropzone:hover{
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-dropzone i{
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.quiz-option{
  display: block;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: .88rem;
  transition: border-color .2s ease, background .2s ease;
}

.quiz-option:hover{
  border-color: var(--primary);
  background: var(--primary-light);
}

.quiz-option input[type="radio"]{
  margin-right: 10px;
}

.quiz-option input[type="radio"]:checked ~ span,
.quiz-option:has(input[type="radio"]:checked){
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.qnav-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

/* ==========================================================================
   Chart canvas wrapper
   Chart.js needs a sized, positioned parent or its canvas grows
   unbounded inside flex/grid cards. Pair with maintainAspectRatio:false.
   ========================================================================== */

.chart-box{
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-box canvas{
  width: 100% !important;
  height: 100% !important;
}

/* ==========================================================================
   Teacher panel: red stat-icon tint (e.g. "Students At Risk")
   Follows the same bg-tint-* pattern as purple/orange/green/blue above.
   ========================================================================== */

.bg-tint-red{ background: #FFEAEA; color: var(--accent-red); }
