:root {
  --bg-dark: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #1f293d;
  --bg-sidebar: #0d121f;
  --bg-header: #0f172a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(59, 130, 246, 0.4);
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --accent: #6366f1;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --sidebar-width: 380px;
  --notes-width: 360px;
  --header-height: 64px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: block;
}

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

/* ========================================================
   LOGIN MODAL OVERLAY
   ======================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at 50% 20%, rgba(30, 58, 138, 0.35) 0%, rgba(9, 13, 22, 0.95) 75%);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  animation: fadeInModal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.brand-icon svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
  fill: #fff;
}

.login-brand h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-brand p {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition-fast);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f92ff 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

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

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-weight: 500;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.credentials-hint {
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.hint-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 8px;
}

.hint-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint-pill {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.hint-pill:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary);
  color: #93c5fd;
}

/* ========================================================
   MAIN APPLICATION LAYOUT
   ======================================================== */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* HEADER */
.app-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.notes-toggle-btn svg {
  width: 16px;
  height: 16px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  text-transform: uppercase;
}

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

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
}

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

.logout-btn {
  width: 30px;
  height: 30px;
  color: #f87171;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.logout-btn svg {
  width: 16px;
  height: 16px;
}

/* APP BODY */
.app-body {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  overflow: hidden;
  position: relative;
}

/* ========================================================
   LEFT SIDEBAR: SECTION NAVIGATION
   ======================================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  transition: width var(--transition-normal), transform var(--transition-normal);
  z-index: 50;
}

.sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
  border-right: none;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 18px 12px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-drawer-btn {
  width: 32px;
  height: 32px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
}

.close-drawer-btn:hover {
  color: #fff;
}

.section-title {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 30px 8px 34px;
  color: #fff;
  font-size: 0.84rem;
  font-family: inherit;
  transition: var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.07);
}

.clear-btn {
  position: absolute;
  right: 8px;
  color: var(--text-dim);
  font-size: 1.1rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clear-btn:hover {
  color: #fff;
}

/* SECTION LIST */
.section-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* CHAPTER SEPARATORS IN SIDEBAR */
.chapter-separator {
  margin-top: 14px;
  margin-bottom: 4px;
  padding: 8px 10px;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.25) 0%, rgba(15, 23, 42, 0.4) 100%);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.chapter-separator:first-child {
  margin-top: 2px;
}

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

.chapter-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  white-space: nowrap;
}

.chapter-title-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-desc-text {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section-chapter-tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
}

.section-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-align: left;
  user-select: none;
}

.section-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.08);
}

.section-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--border-accent);
  box-shadow: inset 3px 0 0 var(--primary);
}

.section-thumb-wrapper {
  position: relative;
  width: 96px;
  height: 54px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.section-item:hover .section-thumb {
  transform: scale(1.05);
}

.thumb-slide-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.75);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}

.thumb-active-overlay {
  position: absolute;
  inset: 0;
  background: rgba(59, 130, 246, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
}

.section-item.active .thumb-active-overlay {
  display: flex;
}

.playing-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.playing-bars span {
  width: 3px;
  background: #fff;
  border-radius: 1px;
  animation: bounceBar 0.8s ease infinite alternate;
}
.playing-bars span:nth-child(2) { animation-delay: 0.2s; }
.playing-bars span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounceBar {
  0% { height: 3px; }
  100% { height: 14px; }
}

.section-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.section-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.section-item.active .section-item-title {
  color: #60a5fa;
  font-weight: 700;
}

.section-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.section-time {
  color: var(--text-muted);
}

.section-duration {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.user-progress-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

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

/* ========================================================
   MAIN CONTENT AREA
   ======================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow-y: auto;
  position: relative;
}

/* RESUME PROMPT BANNER */
.resume-banner {
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border-accent);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: slideDown 0.3s ease;
  z-index: 40;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.resume-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: #93c5fd;
}

.resume-info svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.resume-actions {
  display: flex;
  gap: 8px;
}

/* DRAWER BACKDROP (MOBILE) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 85;
  transition: opacity var(--transition-normal);
  opacity: 1;
}

.drawer-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

/* VIDEO WRAPPER & PLAYER */
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(100vh - var(--header-height) - 100px);
  min-height: 480px;
  overflow: hidden;
  cursor: pointer;
}

.video-wrapper video,
.video-wrapper iframe,
.youtube-player-frame,
#youtubePlayer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: #000;
}

/* FULLSCREEN OVERRIDES */
.video-wrapper:fullscreen,
.video-wrapper:-webkit-full-screen,
.video-wrapper:-moz-full-screen,
.video-wrapper:-ms-fullscreen,
.video-wrapper.is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  inset: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
  z-index: 99999 !important;
}

.video-wrapper:fullscreen video,
.video-wrapper:-webkit-full-screen video,
.video-wrapper:-moz-full-screen video,
.video-wrapper:-ms-fullscreen video,
.video-wrapper.is-fullscreen video,
.video-wrapper:fullscreen iframe,
.video-wrapper:-webkit-full-screen iframe,
.video-wrapper:-moz-full-screen iframe,
.video-wrapper:-ms-fullscreen iframe,
.video-wrapper.is-fullscreen iframe,
.video-wrapper:fullscreen .youtube-player-frame,
.video-wrapper:-webkit-full-screen .youtube-player-frame,
.video-wrapper:-moz-full-screen .youtube-player-frame,
.video-wrapper:-ms-fullscreen .youtube-player-frame,
.video-wrapper.is-fullscreen .youtube-player-frame,
.video-wrapper:fullscreen #youtubePlayer,
.video-wrapper:-webkit-full-screen #youtubePlayer,
.video-wrapper.is-fullscreen #youtubePlayer {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
  outline: none !important;
  background: #000 !important;
}

.video-wrapper:fullscreen .video-click-overlay,
.video-wrapper:-webkit-full-screen .video-click-overlay,
.video-wrapper:-moz-full-screen .video-click-overlay,
.video-wrapper:-ms-fullscreen .video-click-overlay,
.video-wrapper.is-fullscreen .video-click-overlay {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.video-wrapper:fullscreen .slide-transition-img,
.video-wrapper:-webkit-full-screen .slide-transition-img,
.video-wrapper:-moz-full-screen .slide-transition-img,
.video-wrapper:-ms-fullscreen .slide-transition-img,
.video-wrapper.is-fullscreen .slide-transition-img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.video-wrapper:fullscreen .video-controls,
.video-wrapper:-webkit-full-screen .video-controls,
.video-wrapper:-moz-full-screen .video-controls,
.video-wrapper:-ms-fullscreen .video-controls,
.video-wrapper.is-fullscreen .video-controls {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}

.video-click-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  background: transparent;
  cursor: pointer;
}

/* INSTANT SLIDE VISUAL TRANSITION OVERLAY */
.player-status {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.75);
  cursor: default;
}

.player-status a {
  color: #93c5fd;
}

.slide-transition-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  pointer-events: none;
  z-index: 6;
  opacity: 1;
  transition: opacity 0.1s ease-out;
}

.slide-transition-img.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* DOUBLE TAP SKIP FEEDBACK (MOBILE) */
.double-tap-feedback {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.double-tap-feedback.left-feedback {
  left: 0;
  background: radial-gradient(circle at 35% 50%, rgba(59, 130, 246, 0.28) 0%, transparent 70%);
}

.double-tap-feedback.right-feedback {
  right: 0;
  background: radial-gradient(circle at 65% 50%, rgba(59, 130, 246, 0.28) 0%, transparent 70%);
}

.double-tap-feedback.active {
  opacity: 1;
  animation: doubleTapPulse 0.55s ease forwards;
}

.feedback-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 10px 16px;
  border-radius: 50%;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.feedback-circle svg {
  width: 22px;
  height: 22px;
}

@keyframes doubleTapPulse {
  0% { transform: scale(0.7); opacity: 0.2; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}


/* CUSTOM CONTROLS OVERLAY */
.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
  padding: 24px 20px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.video-wrapper.hide-controls .video-controls {
  opacity: 0;
  pointer-events: none;
}

/* TIMELINE SCRUBBER */
.timeline-container {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  transition: height 0.15s ease;
}

.timeline-container:hover .timeline-track {
  height: 8px;
}

.timeline-loaded {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  width: 0%;
}

.timeline-current {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--primary);
  border-radius: 999px;
  width: 0%;
}

.timeline-current::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  transition: transform 0.15s ease;
}

.timeline-container:hover .timeline-current::after {
  transform: translateY(-50%) scale(1);
}

.timeline-hover {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  width: 0%;
  pointer-events: none;
}

.timeline-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chapter-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2;
}

.timeline-tooltip {
  position: absolute;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

/* CONTROLS ROW */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}

.ctrl-btn * {
  pointer-events: none;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.06);
}

.ctrl-btn svg {
  width: 20px;
  height: 20px;
}

.skip-label {
  position: absolute;
  font-size: 0.65rem;
  font-weight: 800;
  top: 10px;
  pointer-events: none;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 4px;
}

#volumeSlider {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: width 0.2s ease;
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}

.time-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

#currentTime {
  color: #fff;
  font-weight: 600;
}

.speed-selector {
  position: relative;
}

.speed-btn {
  width: auto;
  padding: 0 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
}

.dropdown-menu {
  position: absolute;
  bottom: 42px;
  right: 0;
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  min-width: 120px;
}

.menu-item {
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.menu-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-weight: 700;
}

/* SUBTITLE (CC) BUTTON */
.subtitle-btn {
  width: auto;
  min-width: 34px;
  height: 32px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.subtitle-btn .cc-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.subtitle-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.45);
}

.subtitle-btn:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.45);
}

/* ON-SCREEN SUBTITLE OVERLAY */
.subtitle-overlay {
  position: absolute;
  bottom: 76px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 15;
  padding: 0 32px;
  transition: bottom 0.2s ease, opacity 0.1s ease;
}

.video-wrapper.hide-controls .subtitle-overlay {
  bottom: 24px;
}

.subtitle-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.subtitle-box {
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 9px 20px;
  max-width: 85%;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.subtitle-text {
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Hide default browser cues to prevent duplicate rendering */
::cue {
  display: none;
}

:fullscreen .subtitle-text,
:-webkit-full-screen .subtitle-text,
:-moz-full-screen .subtitle-text,
:-ms-fullscreen .subtitle-text,
.is-fullscreen .subtitle-text {
  font-size: 1.48rem;
  line-height: 1.5;
}

:fullscreen .subtitle-box,
:-webkit-full-screen .subtitle-box,
:-moz-full-screen .subtitle-box,
:-ms-fullscreen .subtitle-box,
.is-fullscreen .subtitle-box {
  padding: 12px 28px;
  max-width: 80%;
  border-radius: 10px;
}

/* CURRENT SLIDE CARD */
.current-slide-card {
  padding: 20px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slide-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.slide-badge-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.chapter-pill {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  text-align: center;
  white-space: nowrap;
}

.slide-num-pill {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.slide-dur-pill {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.slide-main-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.slide-quick-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-nav-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.quick-nav-hint strong {
  color: var(--text-muted);
}

/* MOBILE QUICK ACTION BAR */
.mobile-action-bar {
  display: none;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
}

.mobile-action-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.mobile-action-tab:active {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--primary);
  color: #93c5fd;
  transform: scale(0.98);
}

.mobile-action-tab svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.mobile-action-nav-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mobile-icon-tab {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.mobile-icon-tab:active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  transform: scale(0.95);
}

.mobile-icon-tab svg {
  width: 18px;
  height: 18px;
}

/* ========================================================
   HIDE SPEAKER NOTES (BAŞKAN & MİSAFİR) - BERKE ONLY
   ======================================================== */
.hide-notes #toggleNotesBtn,
.hide-notes #mobileOpenNotesBtn,
.hide-notes #notesDrawer,
body.hide-notes #toggleNotesBtn,
body.hide-notes #mobileOpenNotesBtn,
body.hide-notes #notesDrawer,
.user-baskan #toggleNotesBtn,
.user-baskan #mobileOpenNotesBtn,
.user-baskan #notesDrawer,
body.user-baskan #toggleNotesBtn,
body.user-baskan #mobileOpenNotesBtn,
body.user-baskan #notesDrawer,
.user-misafir #toggleNotesBtn,
.user-misafir #mobileOpenNotesBtn,
.user-misafir #notesDrawer,
body.user-misafir #toggleNotesBtn,
body.user-misafir #mobileOpenNotesBtn,
body.user-misafir #notesDrawer {
  display: none !important;
}

/* ========================================================
   SPEAKER NOTES DRAWER
   ======================================================== */
.notes-drawer {
  width: var(--notes-width);
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  transition: width var(--transition-normal), transform var(--transition-normal);
  z-index: 50;
}

.notes-drawer.closed {
  width: 0;
  transform: translateX(100%);
  border-left: none;
  overflow: hidden;
}

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

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

.notes-header-title svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.notes-header-title h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.close-notes-btn {
  font-size: 1.3rem;
  line-height: 1;
}

.notes-sub {
  padding: 8px 20px;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.notes-sub span {
  font-weight: 700;
  color: var(--primary);
}

.notes-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notes-content p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #cbd5e1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.notes-content p:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.notes-content p.active-para {
  background: rgba(59, 130, 246, 0.15);
  border-left-color: var(--primary);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* ========================================================
   RESPONSIVE DESIGN
   ======================================================== */

/* Large Tablets & Small Desktops (<= 1100px) */
@media (max-width: 1100px) {
  :root {
    --sidebar-width: 320px;
    --notes-width: 320px;
  }
}

/* Medium Tablets & Below (<= 860px) */
@media (max-width: 860px) {
  :root {
    --header-height: 56px;
    --sidebar-width: min(340px, 86vw);
    --notes-width: min(360px, 90vw);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    z-index: 95;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.85);
  }

  .notes-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    z-index: 95;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.85);
  }

  .header-subtitle {
    display: none !important;
  }

  .btn-text {
    display: none !important;
  }

  .user-role {
    display: none !important;
  }

  .video-wrapper:not(:fullscreen):not(:-webkit-full-screen):not(.is-fullscreen) {
    min-height: auto;
    max-height: 50vh;
  }

  .video-wrapper:not(:fullscreen):not(:-webkit-full-screen):not(.is-fullscreen) video {
    max-height: 50vh;
  }
}

/* Tablets & Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }
  .mobile-only.mobile-action-bar {
    display: flex !important;
  }
  .mobile-only.close-drawer-btn {
    display: inline-flex !important;
  }
  .desktop-only {
    display: none !important;
  }

  /* Header adjustments */
  .app-header {
    padding: 0 12px;
  }

  .header-left {
    gap: 10px;
    min-width: 0;
  }

  .header-title {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }

  .header-right {
    gap: 6px;
  }

  .header-right .btn-secondary {
    padding: 6px 10px;
  }

  .user-profile {
    padding: 2px 4px;
    gap: 6px;
  }

  .user-info {
    display: none;
  }

  /* Video wrapper & player */
  .video-wrapper:not(:fullscreen):not(:-webkit-full-screen):not(.is-fullscreen) {
    min-height: auto;
    max-height: 45vh;
    aspect-ratio: 16 / 9;
  }

  .video-wrapper:not(:fullscreen):not(:-webkit-full-screen):not(.is-fullscreen) video {
    max-height: 45vh;
  }

  /* Video controls layout */
  .video-controls {
    padding: 16px 12px 10px 12px;
    gap: 6px;
  }

  .ctrl-btn {
    width: 34px;
    height: 34px;
  }

  .ctrl-btn svg {
    width: 18px;
    height: 18px;
  }

  /* On mobile touch devices, hide volume slider since hardware keys control volume */
  .volume-container #volumeSlider {
    display: none;
  }

  .time-display {
    font-size: 0.74rem;
    gap: 3px;
    margin-left: 2px;
  }

  /* Subtitle overlay on tablet & mobile */
  .subtitle-overlay {
    bottom: 46px;
    padding: 0 10px;
  }

  .video-wrapper.hide-controls .subtitle-overlay {
    bottom: 10px;
  }

  .subtitle-box {
    padding: 4px 10px;
    max-width: 90%;
    border-radius: 6px;
    background: rgba(10, 15, 29, 0.92);
  }

  .subtitle-text {
    font-size: 0.78rem;
    line-height: 1.32;
    font-weight: 500;
  }

  :fullscreen .subtitle-text,
  :-webkit-full-screen .subtitle-text {
    font-size: 1.02rem;
    line-height: 1.38;
  }

  /* Current Slide Card */
  .current-slide-card {
    padding: 14px 16px;
    gap: 8px;
  }

  .slide-card-header {
    gap: 10px;
  }

  .slide-main-title {
    font-size: 1.05rem;
    line-height: 1.35;
  }

  .touch-hint {
    color: var(--primary);
    font-weight: 500;
  }

  /* Modals */
  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    max-height: 90vh;
    max-width: 96vw;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 14px;
    gap: 12px;
  }

  /* Resume banner */
  .resume-banner {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .resume-actions {
    justify-content: flex-end;
  }

  .resume-actions button {
    flex: 1;
  }
}

/* Small Smartphone Screens (<= 480px) */
@media (max-width: 480px) {
  :root {
    --header-height: 52px;
    --sidebar-width: 88vw;
    --notes-width: 92vw;
  }

  .header-title {
    font-size: 0.85rem;
    max-width: 140px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Video controls on small mobile */
  .controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .controls-left {
    gap: 4px;
  }

  /* Prev/Next buttons on video controls are hidden on narrow mobile; available in Mobile Action Bar! */
  #prevSlideBtn, #nextSlideBtn {
    display: none;
  }

  .ctrl-btn {
    width: 34px;
    height: 34px;
    touch-action: manipulation;
  }

  .controls-right {
    gap: 4px;
  }

  .speed-btn {
    padding: 0 4px;
    font-size: 0.75rem;
  }

  .subtitle-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 4px;
  }

  .subtitle-btn .cc-badge {
    font-size: 0.7rem;
  }

  .time-display {
    font-size: 0.7rem;
  }

  /* Subtitle overlay on small mobile screens */
  .subtitle-overlay {
    bottom: 38px;
    padding: 0 6px;
  }

  .video-wrapper.hide-controls .subtitle-overlay {
    bottom: 6px;
  }

  .subtitle-box {
    padding: 2px 8px;
    max-width: 92%;
    border-radius: 5px;
    background: rgba(8, 12, 22, 0.94);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  }

  .subtitle-text {
    font-size: 0.70rem;
    line-height: 1.25;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  }

  :fullscreen .subtitle-text,
  :-webkit-full-screen .subtitle-text {
    font-size: 0.88rem;
    line-height: 1.3;
  }

  :fullscreen .subtitle-box,
  :-webkit-full-screen .subtitle-box {
    padding: 5px 12px;
    max-width: 88%;
  }

  /* Current slide card */
  .current-slide-card {
    padding: 12px 14px;
  }

  .slide-main-title {
    font-size: 0.95rem;
  }

  .slide-num-pill {
    font-size: 0.72rem;
    padding: 3px 7px;
  }

  .slide-dur-pill {
    font-size: 0.68rem;
    padding: 2px 4px;
  }

  /* Section Item in Sidebar */
  .section-item {
    padding: 8px;
    gap: 10px;
  }

  .section-thumb-wrapper {
    width: 76px;
    height: 43px;
  }

  .section-item-title {
    font-size: 0.78rem;
  }

  .section-item-meta {
    font-size: 0.7rem;
  }

  /* Login card */
  .login-card {
    padding: 24px 18px;
    border-radius: var(--radius-md);
  }

  .login-brand {
    margin-bottom: 20px;
  }

  .login-brand h2 {
    font-size: 1.2rem;
  }

  .login-brand p {
    font-size: 0.8rem;
  }

  /* Share modal input wrap */
  .share-input-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .share-input-wrap button {
    width: 100%;
  }

  /* Filter chips in logs */
  .logs-filter-bar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .filter-chip {
    padding: 4px 8px;
    font-size: 0.72rem;
  }
}

/* Mobile Landscape Orientation */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --header-height: 46px;
  }

  .video-wrapper:not(:fullscreen):not(:-webkit-full-screen):not(.is-fullscreen) {
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
  }

  .video-wrapper:not(:fullscreen):not(:-webkit-full-screen):not(.is-fullscreen) video {
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
  }

  .video-controls {
    padding: 10px 16px 8px 16px;
  }

  .subtitle-overlay {
    bottom: 40px;
    padding: 0 10px;
  }

  .video-wrapper.hide-controls .subtitle-overlay {
    bottom: 8px;
  }

  .subtitle-box {
    padding: 3px 10px;
    max-width: 85%;
    border-radius: 5px;
  }

  .subtitle-text {
    font-size: 0.76rem;
    line-height: 1.28;
  }
}

/* Very Small Mobile Screens (<= 360px) */
@media (max-width: 360px) {
  .subtitle-overlay {
    bottom: 36px;
    padding: 0 4px;
  }

  .video-wrapper.hide-controls .subtitle-overlay {
    bottom: 4px;
  }

  .subtitle-box {
    padding: 2px 6px;
    max-width: 96%;
  }

  .subtitle-text {
    font-size: 0.66rem;
    line-height: 1.22;
  }
}

/* ========================================================
   MODAL & ACCESS LOGS STYLES
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInModal 0.25s ease;
}

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

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.modal-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.close-modal-btn {
  font-size: 1.4rem;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.logs-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.routine-logs-toggle { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-muted); }
.session-summary h4 { margin: 0 0 10px; font-size: .9rem; }
.viewing-sessions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.viewing-session { display: flex; flex-direction: column; gap: 7px; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: rgba(255,255,255,.025); overflow-wrap: anywhere; }
.viewing-session strong, .viewing-session span { font-size: .8rem; }
.viewing-session small, .log-context { font-size: .72rem; color: var(--text-muted); line-height: 1.5; }
.log-context { display: block; margin-top: 6px; overflow-wrap: anywhere; }

.logs-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.logs-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.logs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

.logs-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.user-badge-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.75rem;
}

.user-badge-pill.baskan {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.user-badge-pill.berke {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.user-badge-pill.misafir {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.action-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-dim);
}

.action-badge.login {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

.action-badge.logout {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.12);
}

.action-badge.slide_completed {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.action-badge.slide_skipped,
.action-badge.slide_skipped_next {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.action-badge.slide_path {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.action-badge.progress_watching {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
}

.action-badge.progress_pause,
.action-badge.progress_leave,
.action-badge.progress_tab_hidden {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
}

.action-badge.rewind {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.action-badge.pause_dwell {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.15);
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.action-badge.search {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.action-badge.notes_toggle {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.action-badge.speed_change,
.action-badge.audio_change,
.action-badge.fullscreen_toggle,
.action-badge.subtitle_toggle {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.1);
}

.action-badge.tab_focus_loss {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.action-badge.device_change {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.18);
  border: 1px solid rgba(192, 132, 252, 0.45);
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.2);
}

.timestamp-cell {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.detail-cell {
  font-size: 0.78rem;
  color: #cbd5e1;
  max-width: 280px;
  word-break: break-word;
  line-height: 1.35;
}

.ip-cell {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* LOGS FILTER BAR & ANALYTICS SUMMARY */
.logs-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 10px 0;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
}

.filter-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.filter-chip.active {
  background: #3b82f6;
  border-color: #60a5fa;
  color: #fff;
  font-weight: 600;
}

.filter-chip.baskan.active {
  background: #ef4444;
  border-color: #f87171;
}

.filter-chip.berke.active {
  background: #2563eb;
  border-color: #60a5fa;
}

.filter-chip.misafir.active {
  background: #059669;
  border-color: #34d399;
}

.analytics-summary-card {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.06) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.analytics-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.analytics-badge-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.analytics-stat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.analytics-metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-pill {
  flex: 1 1 calc(25% - 8px);
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.76rem;
}

.metric-icon {
  font-size: 1rem;
}

.metric-label {
  color: var(--text-muted);
}

.metric-pill strong {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  color: #f1f5f9;
}

.analytics-sub-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.search-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.search-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  font-size: 0.74rem;
  color: #bae6fd;
}

.search-tag-matches {
  font-size: 0.68rem;
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
}

.heatmap-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.heatmap-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
}

.heatmap-card.high-attention {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(0, 0, 0, 0.3) 100%);
}

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

.heatmap-card-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.heatmap-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.heatmap-score.high {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.heatmap-score.medium {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.heatmap-score.normal {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.heatmap-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 6px 0;
}

.heatmap-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.heatmap-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.heatmap-tag {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

.analytics-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.analytics-box-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.slide-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 90px;
  overflow-y: auto;
}

.slide-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.73rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.slide-chip.completed {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.slide-chip.skipped {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.analytics-path-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.path-route-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #38bdf8;
  padding: 4px 0;
  max-height: 90px;
  overflow-y: auto;
}

.path-step-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  font-weight: 700;
  color: #e0f2fe;
}

.path-arrow {
  color: #64748b;
  font-weight: bold;
}

.empty-state {
  color: var(--text-dim);
  font-size: 0.74rem;
  font-style: italic;
}

/* SHARE DIRECT LINKS STYLES */
.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.share-links-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-link-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition-fast);
}

.share-link-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.share-link-card.baskan {
  border-left: 3px solid #ef4444;
}

.share-link-card.berke {
  border-left: 3px solid #3b82f6;
}

.share-link-card.misafir {
  border-left: 3px solid #10b981;
}

.share-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.share-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-input-wrap input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #93c5fd;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  user-select: all;
}

.share-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
}

.copy-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.8rem;
}

/* TOAST NOTIFICATION */
.toast-notification {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px var(--primary-glow);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

@keyframes slideDownToast {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
