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

:root {
  --bg-primary: #09090b;
  --bg-secondary: rgba(24, 24, 27, 0.5);
  --bg-card: rgba(15, 15, 17, 0.7);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.2);
  
  --text-primary: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent-primary: #fafafa;
  --accent-hover: #e4e4e7;
  --accent-primary-text: #09090b;

  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: radial-gradient(circle at 50% -20%, rgba(30,30,35,1) 0%, rgba(9,9,11,1) 80%);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--text-secondary);
}

/* ── Layout ── */
main.app-main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.direct-instructions {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg);
}
.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

/* ── Drop Zone ── */
.drop-zone {
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--border-focus);
  background: rgba(255,255,255,0.02);
}
.drop-zone__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.drop-zone__text {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}
.drop-zone__subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── File Info ── */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 1.5rem;
}
.file-info__details {
  display: flex;
  flex-direction: column;
}
.file-info__name {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.file-info__size {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.file-info__remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.file-info__remove:hover {
  color: var(--error);
}

/* ── Progress ── */
.progress-container {
  margin-top: 1.5rem;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-fast);
}

/* ── Buttons ── */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-primary {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  border: 1px solid var(--accent-primary);
  margin-top: 1.5rem;
  box-shadow: 0 4px 14px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(255,255,255,0.15);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}
.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

/* ── Code Display ── */
.success-header {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.code-display-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0;
}
.session-code {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}
.meta-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ── Join Session ── */
.join-session-box {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.75rem;
}
.input-code {
  flex: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  outline: none;
  transition: all var(--transition-fast);
}
.input-code:focus {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
}

/* ── Toasts ── */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 300px;
  padding: 1.25rem;
  background: rgba(24, 24, 27, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast__title { font-weight: 500; font-size: 0.95rem; color: var(--text-primary); }
.toast__msg { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.35rem; }

/* ==========================================================================
   SLIDE VIEWER PAGE
   ========================================================================== */
.viewer-body {
  background: #000;
  color: #fff;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#slide-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#slide-canvas {
  display: block;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
}
.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 96px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.4);
  font-size: 2rem;
  cursor: pointer;
  z-index: 500;
  backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
}
.nav-arrow:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.nav-arrow--left { left: 1.5rem; }
.nav-arrow--right { right: 1.5rem; }

.slide-counter {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 600;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}
.connection-status {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 600;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.connection-dot--connected { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.connection-dot--disconnected { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }

.toolbar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(24, 24, 27, 0.7);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toolbar--hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}
.toolbar__code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-right: 0.5rem;
}
.toolbar .btn-secondary {
  border-radius: var(--radius-full);
  border-color: rgba(255,255,255,0.15);
}

.loading-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 9000;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   CONTROLLER PAGE
   ========================================================================== */
.controller-card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border: none;
  box-shadow: none;
  padding: 2rem;
  background: transparent;
  backdrop-filter: none;
}
.controller-card h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.status {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}
.controls {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}
.ctrl-btn {
  flex: 1;
  padding: 1.75rem;
  font-size: 1.15rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ctrl-btn:active {
  background: rgba(255,255,255,0.05);
  transform: scale(0.98);
}
.volume-instruction {
  margin-top: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
