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

:root {
  --bg-color: #080a0f;
  --panel-bg: rgba(13, 17, 28, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(124, 58, 237, 0.2);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --primary: #7c3aed;
  --primary-hover: #8b5cf6;
  --primary-glow: rgba(124, 58, 237, 0.4);
  
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --sidebar-width: 320px;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Glassmorphism Panel Template */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-panel:hover {
  border-color: rgba(124, 58, 237, 0.2);
  box-shadow: 0 8px 32px 0 rgba(124, 58, 237, 0.05);
}

/* Authenticated Screen Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Auth Portal Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, #0f121d 0%, #05060a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(transparent, transparent, var(--primary), transparent);
  animation: rotate 6s linear infinite;
  z-index: -1;
  opacity: 0.3;
}

.auth-card-inner {
  background: rgba(13, 17, 28, 0.95);
  border-radius: 12px;
  padding: 30px;
  border: 1px solid var(--border-color);
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

.logo-container {
  margin-bottom: 30px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 35px;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  outline: none;
}

.btn-google {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}
.btn-google:hover {
  background: #f9fafb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--primary-glow);
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: rgba(8, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.course-selector-container {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.custom-select-wrapper {
  position: relative;
}

.custom-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
}

.custom-select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 70%;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--primary);
  object-fit: cover;
}

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

.user-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Sidebar List Architecture */
.cycle-group {
  margin-bottom: 20px;
}

.cycle-header {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 2px solid var(--primary);
}

.chapter-container {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
}

.chapter-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background 0.2s ease;
}

.chapter-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chapter-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chapter-arrow {
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.chapter-container.open .chapter-arrow {
  transform: rotate(90deg);
}

.lessons-list {
  display: none;
  padding: 4px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.chapter-container.open .lessons-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lesson-item {
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.lesson-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.lesson-item.active {
  background: var(--primary-glow);
  color: white;
  border-left: 3px solid var(--primary);
  font-weight: 500;
}

/* Content Area Layout */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
  margin-left: 0;
}

/* Transparent shield over the video to block right clicks on YouTube iframe */
.plyr__video-wrapper {
  position: relative;
}
.plyr__video-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: transparent;
}

.app-header {
  height: var(--header-height);
  padding: 0 40px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 10, 15, 0.6);
  backdrop-filter: blur(10px);
}

.lesson-header-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.content-body {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Media Viewport Panel */
.viewport-panel {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.plyr {
  border-radius: 12px;
  overflow: hidden;
}

/* Customize Plyr theme colors to match purple branding */
.plyr--video {
  --plyr-color-main: var(--primary);
}

/* Empty State / Welcome viewport */
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: radial-gradient(circle at center, #111524 0%, #07090f 100%);
  padding: 40px;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--primary);
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

.empty-state-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 400px;
}

/* Resource Drawer styling */
.resources-panel {
  padding: 24px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.resource-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.resource-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
  transform: translateX(4px);
}

.resource-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resource-icon {
  font-size: 1.4rem;
  color: var(--primary);
}

.resource-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.resource-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-download {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid var(--primary);
  color: var(--text-primary);
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-download:hover {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Loading Overlay Spinner */
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Rules */
@media (max-width: 900px) {
  .sidebar {
    width: 290px !important;
    transform: translateX(0);
    z-index: 1000;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.8);
  }
  .sidebar.collapsed {
    transform: translateX(-100%) !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
  
  .app-header {
    padding: 0 20px;
  }
  
  .content-body {
    padding: 16px;
    gap: 16px;
  }
  
  .logo-text, .sidebar-footer, .course-selector-container, .chapter-title span, .chapter-arrow, .cycle-header, .lesson-item span {
    display: flex !important;
  }
  
  .chapter-header {
    display: flex !important;
    justify-content: space-between !important;
  }
  
  .lesson-item {
    display: flex !important;
  }
}

/* Fix white-on-white text in select option dropdowns */
select option {
  background-color: #0c0f16 !important;
  color: #f3f4f6 !important;
}

/* Crop YouTube bottom watermark slightly and keep it centered */
.plyr__video-embed {
  overflow: hidden;
  position: relative;
}
.plyr__video-embed iframe {
  transform: scale(1.02) !important;
  transform-origin: center center !important;
}

/* Premium Custom Dropdown styling */
.custom-dropdown {
  position: relative;
  width: 100%;
  user-select: none;
}

.dropdown-trigger {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
}

.custom-dropdown.open .dropdown-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.dropdown-arrow {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
  color: var(--primary-hover);
}

.dropdown-options {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: rgba(13, 17, 28, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 500;
  max-height: 250px;
  overflow-y: auto;
}

.custom-dropdown.open .dropdown-options {
  display: block;
  animation: dropdownSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-option {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-option:hover {
  background: var(--primary-glow);
  color: #fff;
}

.dropdown-option.selected {
  background: var(--primary);
  color: #fff;
}

/* Abstract Background Blobs */
.bg-blob {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.08;
  z-index: -10;
  pointer-events: none;
  animation: floatBlob 25s infinite alternate ease-in-out;
}
.blob-1 {
  background: var(--primary);
  top: -10%;
  left: -15%;
}
.blob-2 {
  background: #3b82f6; /* Premium cyan/blue */
  bottom: -15%;
  right: -15%;
  animation-delay: -8s;
}
@keyframes floatBlob {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 90px) scale(1.15); }
  100% { transform: translate(-40px, -60px) scale(0.9); }
}

/* Sidebar Overlay Backdrop on Mobile */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 10, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 95;
  transition: opacity 0.3s ease;
}

/* Premium Video Header Title overlay inside Plyr (to hide channel details in both normal and fullscreen modes) */
.plyr .video-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background: linear-gradient(to bottom, rgba(8, 10, 15, 0.98) 0%, rgba(8, 10, 15, 0.8) 45%, transparent 100%);
  color: var(--text-primary);
  z-index: 3; /* Behind plyr controls but on top of video iframe */
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  pointer-events: none; /* Mouse events pass through to video */
  letter-spacing: 0.5px;
}

/* Bento Grid Dashboard View Styling */
.course-grid-container {
  min-height: 100vh;
  padding: 50px 30px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  z-index: 15;
  position: relative;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}

.grid-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.grid-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.grid-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-top: -10px;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.bento-card {
  background: rgba(13, 17, 28, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 30px;
  height: 220px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.bento-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-glow) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.bento-card:hover {
  border-color: var(--primary-hover);
  box-shadow: 0 15px 35px rgba(124, 58, 237, 0.18);
}

.bento-card:hover::before {
  opacity: 0.15;
}

.bento-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
}

.bento-card-badge {
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-hover);
  border: 1px solid rgba(139, 92, 246, 0.25);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bento-card-icon {
  font-size: 1.6rem;
  color: var(--primary-hover);
  opacity: 0.85;
}

.bento-card-body {
  z-index: 2;
}

.bento-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 8px;
  transform: translateZ(25px);
}

.bento-card-code {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transform: translateZ(15px);
}

.bento-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  color: var(--primary-hover);
  font-weight: 600;
  font-size: 0.88rem;
  gap: 5px;
  opacity: 0.75;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 2;
}

.bento-card:hover .bento-card-footer {
  transform: translateX(4px);
  opacity: 1;
}

/* Premium Button Overrides */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%) !important;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #7c3aed 100%) !important;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.45) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.04) !important;
}

@media (max-width: 900px) {
  #btn-close-sidebar {
    display: flex !important;
  }
}

/* High-Tech Grid Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center center;
  z-index: -9;
  pointer-events: none;
}
