/* ============================================================
   personalLMS - AdminLTE Custom Styling & Student Viewer Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #6366f1;
  --accent-green: #10b981;
  --accent-green-hover: #059669;
  --bg-dark: #0f172a;
  --sidebar-bg: #f8fafc;
  --sidebar-border: #e2e8f0;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background-color: #f1f5f9;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, .brand-text {
  font-family: 'Outfit', sans-serif;
}

/* --- Layout Structure --- */
.app-header {
  height: 60px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--shadow-sm);
}

.app-wrapper {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* --- Sidebar (Syllabus Tree Diagram) --- */
.app-sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1010;
}

.app-sidebar.collapsed {
  margin-left: -320px;
}

.sidebar-header {
  padding: 1.25rem 1rem 1rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.progress-banner {
  margin-top: 0.75rem;
}

.progress-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #10b981);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* --- Tree View Accordion Menu --- */
.syllabus-tree {
  list-style: none;
  padding: 0.75rem 0.5rem;
  margin: 0;
  overflow-y: auto;
  flex-grow: 1;
}

.module-group {
  margin-bottom: 0.5rem;
}

.module-title-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 0.92rem;
  color: #1e293b;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s;
}

.module-title-btn:hover {
  background: #e2e8f0;
}

.topic-list {
  list-style: none;
  padding-left: 0.5rem;
  margin: 0.25rem 0 0.5rem 0;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  margin-bottom: 0.15rem;
  position: relative;
}

.topic-item:hover {
  background: #f1f5f9;
  color: var(--primary-color);
}

.topic-item.active {
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 600;
  border-left: 3px solid var(--primary-color);
}

.topic-icon {
  font-size: 1rem;
  color: #64748b;
  min-width: 18px;
  text-align: center;
}

.topic-item.completed .topic-check {
  color: var(--accent-green);
  font-size: 1.05rem;
  opacity: 1;
}

.topic-check {
  color: #cbd5e1;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.topic-check.checked {
  color: var(--accent-green);
}

.topic-title-text {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Main Content Workspace --- */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow-y: auto;
}

.content-wrapper {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* --- PDF Viewer Bar (Matching Reference Image) --- */
.pdf-control-bar {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  font-size: 0.88rem;
  color: #475569;
}

.page-input-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.page-num-input {
  width: 45px;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.2rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.pdf-viewer-frame {
  width: 100%;
  height: calc(100vh - 170px);
  min-height: 550px;
  border: 1px solid var(--border-color);
  background: #334155;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pdf-canvas-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.video-player-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.video-player-container video, 
.video-player-container iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
}

/* --- Top Header Navigation & Buttons --- */
.header-left-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.btn-complete-topic {
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-complete-topic:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-complete-topic.is-done {
  background: var(--accent-green);
}

.btn-complete-topic.is-done:hover {
  background: var(--accent-green-hover);
}

/* --- Admin Portal Cards & Tables --- */
.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: #e0e7ff;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* --- Utilities --- */
.cursor-pointer { cursor: pointer; }
.badge-pdf { background-color: #fee2e2; color: #dc2626; font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 4px; }
.badge-video { background-color: #e0e7ff; color: #4338ca; font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 4px; }
