/* ═══════════════════════════════════════════════════════
   SEVASTOLINK — Sevastopol Station Personal Terminal
   Visual design inspired by Alien: Isolation (Seegson)
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green: #33ff33;
  --green-dim: #1a991a;
  --green-bright: #66ff66;
  --green-glow: rgba(51, 255, 51, 0.4);
  --green-subtle: rgba(51, 255, 51, 0.08);
  --green-bg: rgba(51, 255, 51, 0.12);
  --bg: #0a0c0a;
  --bg-panel: #0d100d;
  --bg-dark: #060806;
  --border: rgba(51, 255, 51, 0.35);
  --border-bright: rgba(51, 255, 51, 0.6);
  --font: 'Share Tech Mono', 'Courier New', monospace;
  --text-shadow: 0 0 6px rgba(51, 255, 51, 0.6), 0 0 12px rgba(51, 255, 51, 0.3);
  --text-shadow-strong: 0 0 8px rgba(51, 255, 51, 0.8), 0 0 20px rgba(51, 255, 51, 0.5), 0 0 40px rgba(51, 255, 51, 0.2);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--green);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  cursor: default;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--green);
  color: var(--bg);
}

/* ── CRT Overlay ───────────────────────────────────── */
#crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg,
      transparent,
      transparent 1px,
      rgba(0, 0, 0, 0.15) 1px,
      rgba(0, 0, 0, 0.15) 2px);
  animation: scanline-scroll 8s linear infinite;
}

@keyframes scanline-scroll {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(4px);
  }
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
      transparent 50%,
      rgba(0, 0, 0, 0.5) 85%,
      rgba(0, 0, 0, 0.85) 100%);
}

/* Flicker effect on entire body */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  animation: flicker 0.08s infinite alternate;
  background: transparent;
}

@keyframes flicker {
  0% {
    opacity: 1;
  }

  25% {
    opacity: 0.98;
  }

  50% {
    opacity: 1;
  }

  75% {
    opacity: 0.97;
  }

  100% {
    opacity: 1;
  }
}

/* ── START OVERLAY ─────────────────────────────────── */
#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  cursor: pointer;
}

.start-text {
  font-size: 16px;
  letter-spacing: 4px;
  text-align: center;
  color: var(--green);
  text-shadow: var(--text-shadow-strong);
  line-height: 2;
}

/* ── BOOT SCREEN ───────────────────────────────────── */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.3s;
}

#boot-screen.crt-poweron {
  animation: poweron 0.8s forwards;
}

@keyframes poweron {
  0% {
    opacity: 0;
    filter: brightness(0);
  }

  30% {
    opacity: 1;
    filter: brightness(3) saturate(0);
  }

  60% {
    filter: brightness(1.2) saturate(0.5);
  }

  100% {
    opacity: 1;
    filter: brightness(1) saturate(1);
  }
}

#boot-screen.boot-fade-out {
  animation: fadeout 0.8s forwards;
}

@keyframes fadeout {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
    filter: brightness(1.5);
  }

  100% {
    opacity: 0;
  }
}

.boot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 90%;
  max-width: 700px;
}

/* Logo */
.boot-logo {
  font-size: 52px;
  font-weight: normal;
  letter-spacing: 12px;
  text-transform: uppercase;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 1s ease, transform 1s ease;
  text-shadow: var(--text-shadow-strong);
  white-space: nowrap;
}

.boot-logo.logo-visible {
  opacity: 1;
  transform: scale(1);
}

.logo-highlight {
  color: var(--green-bright);
}

/* Subtext */
.boot-subtext {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--green-dim);
  opacity: 0;
  transition: opacity 0.8s ease;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.3);
}

.boot-subtext.subtext-visible {
  opacity: 1;
}

/* Boot log */
.boot-log {
  margin-top: 24px;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  text-align: left;
  font-size: 12px;
  line-height: 1.6;
  color: var(--green-dim);
  scrollbar-width: none;
}

.boot-log::-webkit-scrollbar {
  display: none;
}

.boot-line {
  white-space: pre;
  animation: linein 0.15s ease;
}

.boot-warn {
  color: #ccaa33;
  text-shadow: 0 0 6px rgba(204, 170, 51, 0.5);
}

@keyframes linein {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── TERMINAL SCREEN ───────────────────────────────── */
#terminal-screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding: 8px;
  opacity: 0;
  gap: 0;
}

#terminal-screen.terminal-fade-in {
  animation: termfadein 1s forwards;
}

@keyframes termfadein {
  0% {
    opacity: 0;
    filter: brightness(0.3);
  }

  50% {
    opacity: 0.7;
    filter: brightness(1.2);
  }

  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

/* ── Header Bar ────────────────────────────────────── */
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--green);
  color: var(--bg);
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 2px;
  text-shadow: none;
  border: 1px solid var(--green);
  flex-shrink: 0;
}

.header-label {
  font-size: 15px;
  letter-spacing: 3px;
}

.header-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 1px;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  background: var(--bg);
  border-radius: 50%;
  display: inline-block;
  animation: dotpulse 2s infinite;
}

@keyframes dotpulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ── Terminal Body (3-column) ──────────────────────── */
.terminal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-top: none;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
  width: 180px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-dark);
}

.sidebar-title {
  padding: 10px 14px 6px;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--green-dim);
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.3);
  border-bottom: 1px solid var(--border);
}

.folder-list {
  flex: 1;
  overflow-y: auto;
}

.folder-item {
  padding: 10px 14px;
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  text-shadow: var(--text-shadow);
}

.folder-item:hover {
  background: var(--green-subtle);
  border-left-color: var(--green-dim);
}

.folder-item.active {
  background: var(--green-bg);
  border-left-color: var(--green);
  color: var(--green-bright);
  text-shadow: var(--text-shadow-strong);
}

/* Sidebar Actions */
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--border);
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--green);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 2px;
  padding: 6px 10px;
  cursor: pointer;
  text-shadow: var(--text-shadow);
  transition: all 0.15s;
  text-align: center;
}

.action-btn:hover {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green-bright);
}

.action-btn-danger:hover {
  border-color: #ff4444;
  color: #ff4444;
  text-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
}

.action-btn-confirm {
  border-color: var(--green);
}

.action-btn-confirm:hover {
  background: var(--green);
  color: var(--bg);
  text-shadow: none;
}

/* ── Note List Panel ───────────────────────────────── */
.note-list-panel {
  width: 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
}

.note-list-header {
  padding: 10px 14px;
  font-size: 14px;
  letter-spacing: 2px;
  text-shadow: var(--text-shadow);
  background: var(--green-bg);
  border-bottom: 1px solid var(--border);
}

.note-list-divider {
  height: 1px;
  background: var(--border);
}

.note-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) var(--bg);
}

.note-item {
  padding: 10px 14px;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  border-bottom: 1px solid rgba(51, 255, 51, 0.08);
  transition: all 0.15s;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item:hover {
  background: var(--green-subtle);
}

.note-item.active {
  background: var(--green-bg);
  color: var(--green-bright);
  text-shadow: var(--text-shadow-strong);
  border-left: 2px solid var(--green);
}

.note-item.empty {
  color: var(--green-dim);
  font-style: italic;
  cursor: default;
  text-align: center;
  padding: 20px 14px;
}

/* ── Content Panel ─────────────────────────────────── */
.content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-panel);
}

.note-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.content-title {
  padding: 10px 18px;
  font-size: 18px;
  letter-spacing: 3px;
  text-shadow: var(--text-shadow-strong);
  background: var(--green);
  color: var(--bg);
  text-shadow: none;
  flex-shrink: 0;
}

.content-divider {
  height: 2px;
  background: linear-gradient(90deg, var(--green), transparent);
  flex-shrink: 0;
}

.content-body {
  flex: 1;
  padding: 18px;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.7;
  color: var(--green);
  text-shadow: var(--text-shadow);
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) var(--bg);
}

/* ── Note Editor ───────────────────────────────────── */
.note-editor {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.editor-title {
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 16px;
  letter-spacing: 2px;
  background: var(--bg-dark);
  border: none;
  border-bottom: 2px solid var(--green);
  color: var(--green-bright);
  text-shadow: var(--text-shadow);
  outline: none;
  text-transform: uppercase;
}

.editor-title::placeholder {
  color: var(--green-dim);
}

.editor-title.input-error {
  animation: shake 0.3s;
  border-bottom-color: #ff4444;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.editor-body {
  flex: 1;
  padding: 18px;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.7;
  background: var(--bg-panel);
  border: none;
  color: var(--green);
  text-shadow: var(--text-shadow);
  resize: none;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) var(--bg);
}

.editor-body::placeholder {
  color: var(--green-dim);
}

.editor-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

/* ── Status Bar ────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--green-dim);
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-dark);
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.2);
  flex-shrink: 0;
}

.status-left {
  color: var(--green);
}

.status-right {
  color: var(--green-dim);
}

/* ── Blink Text (delete confirm) ───────────────────── */
.blink-text {
  animation: blink 0.5s steps(1) infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* ── Scrollbar styling (Webkit) ────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--green-dim);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green);
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 120px;
    min-width: 120px;
  }

  .note-list-panel {
    width: 160px;
    min-width: 160px;
  }

  .boot-logo {
    font-size: 32px;
    letter-spacing: 6px;
  }

  .terminal-header {
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .terminal-body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: auto;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .folder-list {
    display: flex;
    overflow-x: auto;
  }

  .folder-item {
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .folder-item.active {
    border-bottom-color: var(--green);
    border-left: none;
  }

  .sidebar-actions {
    flex-direction: row;
    border-top: none;
    border-left: 1px solid var(--border);
  }

  .note-list-panel {
    width: 100%;
    min-width: auto;
    max-height: 150px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}