/* ==========================================================================
   ВІДКРИВАЧ ПРЕЗЕНТАЦІЙ 9-А КЛАСУ • ВІННИЦЬКИЙ ЛІЦЕЙ №21
   Чистий, блискавичний та адаптивний плеєр презентацій
   ========================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Темна тема за замовчуванням */
  --bg-app: #080b11;
  --bg-sidebar: #0f1523;
  --bg-sidebar-hover: #172033;
  --bg-sidebar-active: #1e293b;
  --bg-stage: #05070a;
  --bg-bar: rgba(15, 21, 35, 0.85);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --gradient-brand: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f8fafc;
  --bg-sidebar-active: #e2e8f0;
  --bg-stage: #e2e8f0;
  --bg-bar: rgba(255, 255, 255, 0.9);

  --border-color: rgba(0, 0, 0, 0.08);
  --border-active: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
}

/* ==========================================================================
   APP LAYOUT (SIDEBAR + MAIN VIEWER)
   ========================================================================== */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   SIDEBAR (СПИСОК УЧНІВ ТА ПРЕЗЕНТАЦІЙ)
   ========================================================================== */
.sidebar {
  width: 340px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.3s ease, var(--transition);
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.sidebar-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.sidebar-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
}

.pres-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  text-align: left;
  user-select: none;
}

.pres-item:hover {
  background: var(--bg-sidebar-hover);
}

.pres-item.active {
  background: var(--bg-sidebar-active);
  border-color: var(--border-active);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pres-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.pres-item.active .pres-item-icon {
  background: var(--accent-blue);
  color: white;
}

.pres-item-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.pres-item-author {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pres-item-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pres-item-count {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-zip-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--gradient-brand);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: var(--transition);
}

.btn-zip-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN VIEWER (САМ ВІДКРИВАЧ)
   ========================================================================== */
.main-viewer {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-stage);
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Верхня панель інструментів */
.viewer-topbar {
  height: 60px;
  flex-shrink: 0;
  background: var(--bg-bar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
}

.viewer-info {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.viewer-titles {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-active-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-active-author {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.slide-counter-badge {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: #e2e8f0;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-action.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

/* Сцена відображення слайда (Stage) */
.viewer-stage {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 70px;
  overflow: hidden;
}

.slide-display-frame {
  width: 100%;
  height: 100%;
  max-width: 1500px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-color);
}

.slide-img-current {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.15s ease;
}

/* Стрілки переходу */
.stage-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.stage-nav-btn:hover {
  background: var(--gradient-brand);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
}

.stage-nav-btn.prev { left: 14px; }
.stage-nav-btn.next { right: 14px; }

/* Нижня смужка мініатюр */
.viewer-filmstrip {
  height: 76px;
  flex-shrink: 0;
  background: var(--bg-bar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  z-index: 20;
}

.thumb-card {
  height: 56px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #1e293b;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  transition: var(--transition);
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-card.active {
  border-color: var(--accent-blue);
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

.thumb-number {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ==========================================================================
   АДАПТИВНІСТЬ ДЛЯ СМАРТФОНІВ ТА ПЛАНШЕТІВ
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle-btn {
    display: flex;
  }

  .viewer-stage {
    padding: 10px 10px;
  }

  .stage-nav-btn {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }

  .stage-nav-btn.prev { left: 8px; }
  .stage-nav-btn.next { right: 8px; }

  .hide-sm {
    display: none !important;
  }
}
