/* 
  1) Reset base margins/padding.
  2) Force HTML and Body to occupy the full viewport.
*/
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: Arial, sans-serif;
  }
  
  /* 
    #initialView is our container that:
     - displays the kraken image (with a BF3-style overlay).
     - uses an animation to slowly shift background-position for a "drifting" effect.
  */
  #initialView {
    background:
      linear-gradient(
        to bottom right, 
        rgba(10, 40, 60, 0.6),    /* teal-ish corner */
        rgba(150, 70, 0, 0.4)    /* orange-ish corner */
      ),
      url("/frontend/ancillary/images/kraken-terminal.webp") 
        center center 
        no-repeat;
  
    background-size: 100% 150%;
    background-blend-mode: multiply; /* merges gradient + image colors */
    animation: krakenDrift 30s ease-in-out infinite;
  
    /* Center the button vertically & horizontally */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }
  
  /*
    Keyframe animation to move background-position up/down 
    so the image "drifts" subtly.
  */
  @keyframes krakenDrift {
    0% {
      background-position: 50% 0%;
    }
    50% {
      background-position: 50% 10%; 
    }
    100% {
      background-position: 50% 0%;
    }
  }
  
  /*
    Button styling:
    - Dark gradient background
    - Subtle glow/box-shadow
    - “Pulsing” hover effect
  */
  #enterButton {
    padding: 16px 32px;
    font-size: 18px;
    color: #fff;
    cursor: pointer;
    outline: none;
    border: none;
    border-radius: 4px;
  
    /* Gradient background reminiscent of BF3's neon blues */
    background: linear-gradient(
      to right,
      rgba(0, 20, 40, 0.8),
      rgba(20, 60, 120, 0.8)
    );
  
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    transition: 
      transform 0.3s ease,
      box-shadow 0.3s ease;
  }
  
  /*
    Hover effect:
    - Slight scale (pulsing)
    - Brighter neon glow
  */
  #enterButton:hover {
    box-shadow: 
      0 0 20px rgba(0, 255, 255, 0.6),  /* neon glow */
      0 4px 8px rgba(0, 0, 0, 0.5);
  }
  
  /* Fade-out utility for #initialView */
  .fade-out {
    opacity: 0;
    transition: opacity 0.8s ease-out; /* 0.8s fade-out duration */
  }
  
  /* 
    Three-column container (hidden by default). 
    We'll reveal it after the fade-out in the JS.
  */
  #mainColumns {
    display: none;
    width: 100%;
    min-height: 100vh; /* optional, so it at least fills the screen */
    background: #001020;     /* a darker underwater background */
    color: #fff;             /* text color for columns */
    
    /* lay out columns side by side */
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: flex-start;
  
    /* spacing between columns */
    gap: 2rem;
    padding: 2rem; /* top/bottom/left/right padding around container */
    box-sizing: border-box;
  }
  
  /* 
    Individual column styling:
    - Slight border or shadow can help separate columns
  */
  .column {
    flex: 1 1 0px;
    padding: 1rem;
    overflow-y: auto;        /* scroll if content is taller than the viewport */
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.2); /* optional subtle border */
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  }
  
  /* Column headers (e.g. h2 for each column) */
  .column h2 {
    font-size: 1.4rem;
    margin: 0 0 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.5rem;
    color: #0ff; /* subtle neon color; adjust as desired */
  }
  
  /*
    Example styling for item blocks in the first column 
    (or anywhere you want to display multiple items).
  */
  .item-block {
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    border-radius: 6px;
    padding: 1rem;
    transition: transform 0.2s ease;
  }
  .item-block:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
  }
  
  .item-block h4 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #fff;
  }
  .item-block p {
    margin: 0;
    color: #ccc;
  }

  .proceed-button {
    margin-top: 1rem;
    padding: 8px 16px;
    border-radius: 4px;
    background-color: #ffd700; /* Bright, eye-catching gold */
    color: #000; /* Strong contrast for readability */
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.proceed-button:hover {
    background-color: #ffcc00; /* Slightly deeper gold for hover effect */
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.8); /* Subtle glow for emphasis */
}

/* Folder tree styling (to mimic VS Code explorer with connecting lines) */
.folder-tree,
.folder-tree ul {
  list-style-type: none;
  margin: 0;
  padding-left: 20px;
  position: relative;
}

.folder-tree li {
  position: relative;
  padding: 2px 0;
}

.folder-tree li::before {
  content: "";
  position: absolute;
  top: 0;
  left: -10px;
  border-left: 1px solid #ccc;
  bottom: 0;
}

.folder-tree li::after {
  content: "";
  position: absolute;
  top: 10px;
  left: -10px;
  width: 10px;
  border-top: 1px solid #ccc;
}

/* Code box styling (scrollable, similar to ChatGPT code blocks) */
.code-box {
  max-height: 400px;
  overflow-y: auto;
  background: #1e1e1e;
  color: #dcdcdc;
  padding: 10px;
  border-radius: 4px;
  font-family: Consolas, Monaco, monospace;
  margin-top: 1rem;
}

/* Styling for the code snippet container and copy button */
.code-snippet-container {
  margin-top: 1rem;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
}

/* Reset button styling */
button {
  cursor: pointer;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  background-color: #c9302c; /* Bootstrap-style danger red */
  color: #fff;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  background-color: #b71a15; /* Darker red for hover */
  box-shadow: 0 0 8px rgba(201, 48, 44, 0.8);
}

.copy-button {
  margin-top: 0.5rem;
  padding: 4px 8px;
  font-size: 0.9rem;
  background: #444;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.copy-button:hover {
  background: #666;
}

.sub-column {
  margin-bottom: 1.5rem;               /* space between these "boxes" */
  padding: 1rem;                       /* internal padding */
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* For line numbering inside pre/code snippets */
pre {
  counter-reset: lineNumbering;
}

.line {
  display: block;
  position: relative;
  padding-left: 3em; /* space for line numbers on the left */
  white-space: pre;  /* preserve text spacing/indentation */
}

.line::before {
  counter-increment: lineNumbering;
  content: counter(lineNumbering);
  position: absolute;
  left: 0;
  width: 2em;
  text-align: right;
  color: #999;
}

/* Highlighted line in the code snippet */
.line.highlighted {
  background-color: rgba(255, 215, 0, 0.2);
}

/* The small boxes in the third column for line-range notes */
.highlight-box {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 1rem;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
}
.highlight-box:hover {
  background: rgba(255,255,255,0.1);
}

/* Lazy-loaded YouTube placeholder */
.yt-placeholder {
  position: relative;
  width: 100%;
  height: 315px;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.yt-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
}
.yt-placeholder:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -4px rgba(0,0,0,0.75);
}
.yt-play-button {
  width: 72px;
  height: 52px;
  background: rgba(0,0,0,0.55);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 12px -2px rgba(0,255,255,0.65), 0 0 0 1px rgba(255,255,255,0.15) inset;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.yt-play-button::before {
  content: '';
  margin-left: 4px;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 20px solid #0ff;
  filter: drop-shadow(0 0 6px rgba(0,255,255,0.8));
}
.yt-placeholder:focus .yt-play-button, .yt-placeholder:hover .yt-play-button {
  background: rgba(0,0,0,0.75);
  box-shadow: 0 0 18px -2px rgba(0,255,255,0.85), 0 0 0 1px rgba(0,255,255,0.5) inset;
}
@media (prefers-reduced-motion: reduce) {
  .yt-placeholder { transition: none; }
  .yt-play-button { transition: none; }
}

/* ===================== LOCKED (SUBSCRIPTION GATE) STYLES ===================== */
.kt-locked-container { position: relative; max-width: 720px; width: 100%; padding: 0 12px; box-sizing: border-box; animation: ktContainerFade 0.6s ease; }
@keyframes ktContainerFade { from { opacity:0; transform: translateY(10px);} to {opacity:1; transform:translateY(0);} }
.kt-locked-frame { position: relative; padding: 46px 38px 38px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.1); border-radius: 18px; -webkit-backdrop-filter: blur(6px) saturate(140%); backdrop-filter: blur(6px) saturate(140%); overflow: hidden; box-shadow: 0 0 22px -6px rgba(0,255,255,0.35), 0 0 0 1px rgba(255,255,255,0.08) inset; }
.kt-scanlines::before, .kt-scanlines::after { content: ""; position: absolute; left:0; right:0; top:0; bottom:0; pointer-events:none; }
.kt-scanlines::before { background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(0,255,255,0.04) 50%, rgba(255,255,255,0) 100%); animation: ktScanMove 3.8s linear infinite; mix-blend-mode: screen; }
.kt-scanlines::after { background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.06) 0 1px, rgba(0,0,0,0) 1px 3px); opacity: 0.25; }
@keyframes ktScanMove { 0% { transform: translateY(-100%);} 100% { transform: translateY(100%);} }
.kt-glow-ring { position:absolute; inset:-2px; pointer-events:none; border-radius:18px; background: radial-gradient(circle at 30% 20%, rgba(0,255,255,0.18), rgba(0,0,0,0) 60%), radial-gradient(circle at 80% 70%, rgba(255,215,0,0.15), rgba(0,0,0,0) 65%); mix-blend-mode: screen; animation: ktGlowPulse 6s ease-in-out infinite; }
@keyframes ktGlowPulse { 0%,100% { opacity:0.55;} 50% { opacity:0.85;} }
.kt-locked-title { margin:0 0 18px; display:flex; flex-wrap:wrap; justify-content:center; font-size:clamp(1.9rem,4vw,2.4rem); font-weight:700; letter-spacing:2px; text-transform:uppercase; color:#ff2e2e; text-shadow:0 0 4px rgba(255,0,0,0.6), 0 0 18px rgba(255,70,70,0.35); position:relative; }
.kt-locked-title .gap { width:1ch; }
.kt-locked-title span { position:relative; animation: ktLetterFlicker 4s linear infinite; }
.kt-locked-title span:nth-child(odd) { animation-duration:5.2s; }
.kt-locked-title span:nth-child(3n) { animation-duration:4.3s; }
@keyframes ktLetterFlicker { 0%,92%,100% { opacity:1; filter:none; } 93% { opacity:0.4; filter: blur(1px);} 95% { opacity:0.8;} 97% { opacity:0.2; filter: blur(2px);} 99% { opacity:1; filter:none;} }
.kt-locked-text { margin:24px 0; line-height:1.5; color:#d6d6d6; font-size:0.98rem; font-weight:400; animation: ktTextReveal 0.7s ease; text-align:center; }
@keyframes ktTextReveal { from { opacity:0; transform: translateY(6px);} to {opacity:1; transform:translateY(0);} }
.kt-locked-actions { display:flex; gap:14px; justify-content:center; flex-wrap:wrap; }
.kt-btn { position:relative; padding:11px 20px; font-size:0.9rem; border-radius:6px; font-weight:600; cursor:pointer; border:1px solid transparent; letter-spacing:0.5px; }
.kt-btn.primary { background: linear-gradient(135deg,#0b3d66,#0f5c9a); color:#e4fbff; border-color:#0ff; box-shadow:0 0 0 0 rgba(0,255,255,0.4); animation: ktBtnPulse 3.2s ease-in-out infinite; }
.kt-btn.upgrade { background: linear-gradient(135deg,#ffbf00,#ffdd55); color:#000; border-color:#e2b300; }
.kt-btn.ghost { background: rgba(255,255,255,0.08); color:#eee; border-color:#555; }
.kt-btn.primary:hover { box-shadow:0 0 14px -2px rgba(0,255,255,0.65); }
.kt-btn.upgrade:hover { box-shadow:0 0 14px -2px rgba(255,215,0,0.75); }
.kt-btn.ghost:hover { background: rgba(255,255,255,0.16); }
@keyframes ktBtnPulse { 0%,100% { box-shadow:0 0 0 0 rgba(0,255,255,0.0);} 50% { box-shadow:0 0 18px -4px rgba(0,255,255,0.55);} }
.kt-particles { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.kt-particle { position:absolute; bottom:-8px; width:4px; height:4px; background:#0ff; border-radius:50%; opacity:0.7; animation: ktParticleFloat linear infinite; box-shadow:0 0 6px 2px rgba(0,255,255,0.4); }
@keyframes ktParticleFloat { 0% { transform:translateY(0) scale(0.6); opacity:0;} 10% { opacity:1;} 90% { opacity:0.9;} 100% { transform:translateY(-120vh) scale(1.1); opacity:0;} }
@media (prefers-reduced-motion: reduce) { .kt-locked-title span, .kt-glow-ring, .kt-scanlines::before, .kt-particle, .kt-btn.primary { animation: none !important; } }

/* Preview image fallback (when no video) */
.kt-preview-image {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0,0,0,0.6);
  display: block;
  margin: 0 0 1rem 0;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.kt-preview-image.loaded, .kt-preview-image:not([data-src]) { opacity: 1; }
.kt-preview-image:hover { box-shadow: 0 0 14px rgba(0,0,0,0.75); }

/* ===================== ADDED: CONTROLS + PROGRESS + COLLAPSIBLE TREE ===================== */
.kt-controls-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
  padding: 0.6rem 0.9rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
}

.kt-controls-bar label { font-size: 0.85rem; letter-spacing: 0.5px; color: #9fd; text-transform: uppercase; }
.kt-controls-bar select {
  background: #0c2233;
  color: #fff;
  border: 1px solid #0ff;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.kt-controls-bar select:focus { outline: 2px solid #0ff; outline-offset: 1px; }

.kt-progress-wrapper { display:flex; align-items:center; gap:0.5rem; min-width:160px; }
.kt-progress-bar { position:relative; flex:1; height:10px; background:rgba(255,255,255,0.15); border-radius:6px; overflow:hidden; }
.kt-progress-fill { position:absolute; left:0; top:0; bottom:0; width:0%; background:linear-gradient(90deg, #0ff, #37fda8); box-shadow:0 0 6px 1px rgba(0,255,255,0.6); transition: width 0.35s ease; }
.kt-progress-text { font-size:0.7rem; letter-spacing:0.5px; color:#aff; min-width:34px; text-align:right; }

/* Pulse effect for line highlight hover */
@keyframes ktPulseFade {
  0% { box-shadow:0 0 0 0 rgba(255,215,0,0.9); background-color:rgba(255,215,0,0.28);} 
  55% { box-shadow:0 0 6px 3px rgba(255,215,0,0.4);} 
  100% { box-shadow:0 0 0 0 rgba(255,215,0,0); background-color:rgba(255,215,0,0.12);} 
}
.line.pulse { animation: ktPulseFade 0.8s ease; }

/* Collapsible folder tree states */
.folder-tree li { cursor: default; }
.folder-tree li:has(> ul) { cursor: pointer; }
.folder-tree li.collapsed > ul { display: none; }
.folder-tree li.collapsed { opacity:0.8; }

/* Folder vs file visuals */
.folder-tree span[role="treeitem"] { position:relative; padding-left:14px; display:inline-block; }
.folder-tree span[role="treeitem"]::before { content:"▾"; position:absolute; left:0; top:0; font-size:0.7rem; transform:translateY(2px); color:#0ff; transition: transform 0.25s ease; }
.folder-tree li.collapsed > span[role="treeitem"]::before { transform: rotate(-90deg) translateX(-2px); }
.folder-tree .kt-file-leaf { padding-left:14px; position:relative; display:inline-block; cursor:pointer; }
.folder-tree .kt-file-leaf::before { content:"•"; position:absolute; left:0; top:0; font-size:0.7rem; color:#37fda8; transform:translateY(2px); }

/* Active file path highlight */
.folder-tree li.active-file { background: rgba(0,255,255,0.15); border-radius:4px; padding-left:4px; position:relative; }
.folder-tree li.active-file::after { content:""; position:absolute; left:-6px; top:0; bottom:0; width:3px; background:#0ff; border-radius:2px; box-shadow:0 0 6px -1px #0ff; }

/* Notes export button tweak (uses existing .kt-btn if applied) */
#exportNotesBtn { background:#0b3d66; border:1px solid #0ff; color:#e4fbff; font-size:0.75rem; padding:6px 10px; border-radius:4px; letter-spacing:0.5px; }
#exportNotesBtn:hover { background:#0f5c9a; }

/* Improve highlight-box readability */
.highlight-box { transition: background 0.2s ease, border-color 0.2s ease; }
.highlight-box:focus { outline:2px solid #0ff; outline-offset:2px; }

/* Provide visible focus for interactive LI (collapsible) */
.folder-tree li:focus { outline:2px solid #0ff; outline-offset:1px; }

/* Reduce motion preference respects transitions */
@media (prefers-reduced-motion: reduce) {
  .kt-progress-fill { transition: none; }
  .line.pulse { animation: none; }
}

/* ===================== LOADING INDICATORS ===================== */
.kt-inline-loader {
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:0.85rem;
  letter-spacing:0.5px;
  color:#9fd;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(0,255,255,0.25);
  padding:6px 10px;
  border-radius:20px;
  box-shadow:0 0 6px -2px rgba(0,255,255,0.5) inset;
}
.kt-inline-loader .kt-spinner {
  width:16px;
  height:16px;
  border:3px solid rgba(255,255,255,0.18);
  border-top-color:#0ff;
  border-radius:50%;
  animation: ktSpin 0.8s linear infinite;
}
@keyframes ktSpin { to { transform: rotate(360deg);} }

/* Overlay loader for blueprint/instructions */
.kt-overlay-loader {
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.55);
  -webkit-backdrop-filter:blur(3px);
  backdrop-filter:blur(3px);
  z-index:50;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.3s ease;
  border-radius:8px;
}
.kt-overlay-loader.visible { opacity:1; pointer-events:auto; }
.kt-overlay-loader .kt-loader-box { text-align:center; padding:22px 28px; background:rgba(10,30,46,0.85); border:1px solid rgba(0,255,255,0.25); border-radius:12px; box-shadow:0 0 18px -4px rgba(0,255,255,0.6); }
.kt-overlay-loader .kt-loader-box .kt-spinner { width:46px; height:46px; border:4px solid rgba(255,255,255,0.2); border-top-color:#37fda8; border-radius:50%; animation: ktSpin 0.9s linear infinite; margin:0 auto 14px; }
.kt-overlay-loader .kt-loader-text { color:#d6faff; font-size:0.8rem; letter-spacing:0.5px; }

/* Fancy accent ring */
.kt-overlay-loader .kt-spinner::after { content:""; position:absolute; inset:-6px; border:2px dashed rgba(0,255,255,0.35); border-radius:50%; animation: ktSpin 5s linear infinite reverse; }
