/* ==========================================================================
   HIMAKOM PKKMB Presentation Web Application
   File: css/app.css
   Description: Design tokens, global resets, viewport auto-scaling canvas,
                bottom UI bar, drawer modal, and keyboard shortcuts modal.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Dimensions */
  --canvas-width: 1920px;
  --canvas-height: 1080px;

  /* Background Colors */
  --bg-viewport: #07090d;
  --bg-canvas: #0d1117;
  --bg-card: #161b22;
  --bg-card-header: #1c2128;
  --bg-inner-box: #0e131a;
  --bg-action-box: rgba(46, 160, 67, 0.08);

  /* Border Colors */
  --border-card: #30363d;
  --border-subtle: #21262d;
  --border-action-box: #238636;
  --border-focus: #58a6ff;

  /* Typography Colors */
  --text-primary: #ffffff;
  --text-heading: #f0f6fc;
  --text-body: #c9d1d9;
  --text-muted: #8b949e;
  --text-faint: #484f58;
  --text-dim: #30363d;

  /* Syntax & Accent Colors */
  --syntax-cyan: #58a6ff;
  --syntax-green: #3fb950;
  --syntax-amber: #e3b341;
  --syntax-gold: #d29922;
  --syntax-orange: #f0883e;
  --syntax-red: #f85149;
  --syntax-comment: #8b949e;
  --syntax-blue: #79c0ff;
  --syntax-sky: #38bdf8;

  /* macOS Window Control Dots */
  --dot-red: #ff5f56;
  --dot-yellow: #ffbd2e;
  --dot-green: #27c93f;

  /* Fonts */
  --font-sans: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, Monaco, monospace;

  /* Shadows */
  --shadow-stage: 0 25px 80px rgba(0, 0, 0, 0.85);
  --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 30px 90px rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------------------------
   2. Global Resets & Viewport Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-viewport);
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   3. Viewport & 16:9 Canvas Stage (1920x1080)
   -------------------------------------------------------------------------- */
#app-viewport {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-viewport);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}

/* Fullscreen Interactive Canvas Glitch Matrix Background */
#letter-glitch-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.20;
}

#slide-stage {
  z-index: 10;
  width: 1920px;
  height: 1080px;
  min-width: 1920px;
  min-height: 1080px;
  max-width: 1920px;
  max-height: 1080px;
  position: relative;
  background: transparent;
  overflow: hidden;
  box-shadow: none;
  transform-origin: center center;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}

/* Container for all slide sections */
.slides-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   4. Bottom UI Bar (Glassmorphic Terminal Bar)
   -------------------------------------------------------------------------- */
#bottom-ui-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(48, 54, 61, 0.75);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 44px;
  z-index: 100;
  font-family: var(--font-mono);
}

.bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  min-width: 240px;
}

.prompt-prefix {
  color: var(--syntax-green);
  font-weight: 700;
}

.prompt-cmd {
  color: var(--syntax-cyan);
}

.cursor-blink {
  animation: blinkCursor 1s step-end infinite;
  color: var(--syntax-cyan);
  font-weight: 700;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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

.nav-btn {
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid var(--border-card);
  color: var(--text-body);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-btn svg {
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(56, 139, 253, 0.15);
  border-color: var(--syntax-cyan);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.nav-btn:active:not(:disabled) {
  transform: translateY(0);
  background: rgba(56, 139, 253, 0.25);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--border-subtle);
}

.bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 240px;
}

.slide-indicator {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--syntax-cyan);
  letter-spacing: 0.5px;
  background: rgba(22, 27, 34, 0.7);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   5. Modals Common Base (Drawer & Shortcuts)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 13, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 28px;
  background: var(--bg-card-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--syntax-cyan);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-close-btn {
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn:hover {
  border-color: var(--syntax-red);
  color: var(--syntax-red);
  background: rgba(248, 81, 73, 0.12);
}

/* --------------------------------------------------------------------------
   6. Slide Drawer Modal
   -------------------------------------------------------------------------- */
#slide-drawer-modal .modal-dialog {
  width: 1440px;
  max-width: 92vw;
  max-height: 88vh;
}

.drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 28px 32px;
  overflow-y: auto;
  max-height: calc(88vh - 80px);
}

.drawer-thumb {
  background: var(--bg-canvas);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 20px 22px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  position: relative;
}

.drawer-thumb:hover {
  border-color: var(--syntax-cyan);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  background: rgba(22, 27, 34, 0.95);
}

.drawer-thumb.active-thumb {
  border-color: var(--syntax-green);
  box-shadow: 0 0 0 1px var(--syntax-green), 0 8px 24px rgba(63, 185, 80, 0.2);
  background: rgba(46, 160, 67, 0.08);
}

.thumb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

.thumb-num {
  color: var(--syntax-cyan);
  font-size: 15px;
  font-weight: 700;
}

.thumb-active-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(63, 185, 80, 0.2);
  color: var(--syntax-green);
  font-weight: 700;
  letter-spacing: 0.5px;
  display: none;
}

.drawer-thumb.active-thumb .thumb-active-badge {
  display: inline-block;
}

.thumb-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 14px;
}

.thumb-bottom {
  display: flex;
  justify-content: flex-end;
}

.thumb-key {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(48, 54, 61, 0.5);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   7. Keyboard Shortcuts Modal
   -------------------------------------------------------------------------- */
#shortcuts-modal .modal-dialog {
  width: 820px;
  max-width: 90vw;
}

.shortcuts-body {
  padding: 28px 32px;
  overflow-y: auto;
  max-height: 75vh;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.kbd-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

kbd {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-bottom-width: 2px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--syntax-cyan);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.shortcut-desc {
  font-size: 15px;
  color: var(--text-body);
  font-weight: 500;
}
