/* ============================================================
   TOKENS & RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0f14;
  --bg-card: #131720;
  --bg-hover: #1a1f2e;
  --border: #1e2436;
  --border-hi: #2a334d;
  --accent: #6c8cff;
  --accent-lo: rgba(108, 140, 255, 0.12);
  --accent-glow: rgba(108, 140, 255, 0.35);
  --green: #3ecf8e;
  --red: #ff5e6c;
  --yellow: #f6c90e;
  --text: #e2e8f0;
  --text-muted: #6b7a99;
  --text-dim: #3d4a63;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 99px;
}

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

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
  transition: color 0.2s;
}

.logo:hover {
  color: var(--accent);
}

.logo-bracket {
  color: var(--accent);
}

.logo-dot {
  color: var(--text-muted);
}

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

.nav-user-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
  background: rgba(62, 207, 142, 0.1);
  border: 1px solid rgba(62, 207, 142, 0.25);
  padding: 4px 10px;
  border-radius: 99px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s;
}

.nav-user-badge:hover {
  background: rgba(62, 207, 142, 0.18);
  border-color: rgba(62, 207, 142, 0.45);
}

.nav-logout {
  background: none;
  cursor: pointer;
  color: var(--text-dim) !important;
  border-color: transparent !important;
  font-size: 11px;
}

.nav-logout:hover {
  color: var(--red) !important;
  background: rgba(255, 94, 108, 0.08) !important;
  border-color: rgba(255, 94, 108, 0.2) !important;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.18s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  border-color: var(--border-hi);
  background: var(--accent-lo);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ============================================================
   EDITOR CARD
   ============================================================ */
.editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.editor-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

/* toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar-left {
  flex: 1;
  min-width: 160px;
}

.toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.title-input {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  width: 100%;
}

.title-input::placeholder {
  color: var(--text-dim);
}

.lang-select {
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s, color 0.18s;
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--accent);
  color: var(--text);
}

/* editor body */
.editor-wrapper {
  display: flex;
  min-height: 400px;
  position: relative;
}

.line-numbers {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 22px;
  color: var(--text-dim);
  padding: 16px 12px 16px 16px;
  text-align: right;
  user-select: none;
  border-right: 1px solid var(--border);
  min-width: 48px;
  background: rgba(0, 0, 0, 0.15);
  white-space: pre;
}

.editor {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 22px;
  color: var(--text);
  padding: 16px;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
}

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

/* view mode */
.view-mode {
  min-height: 200px;
}

.view-content {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 22px;
  color: var(--text);
  padding: 16px;
  white-space: pre;
  overflow-x: auto;
  background: transparent;
}

/* editor footer */
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}

.char-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.footer-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #849aff;
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-hi);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-danger:hover {
  background: #ff7582;
  transform: translateY(-1px);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
  border-color: rgba(255, 94, 108, 0.3);
}

.btn-danger-ghost:hover {
  background: rgba(255, 94, 108, 0.1);
  border-color: var(--red);
}

/* ============================================================
   BADGES & LABELS
   ============================================================ */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-lo);
  color: var(--accent);
  border: 1px solid rgba(108, 140, 255, 0.25);
}

/* ============================================================
   PASTES LIST
   ============================================================ */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.list-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.list-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 14px;
  outline: none;
  width: 220px;
  transition: border-color 0.18s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.pastes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.paste-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}

.paste-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.paste-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.paste-card:hover::before {
  opacity: 1;
}

.paste-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paste-card-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
  word-break: break-all;
}

.paste-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.paste-card-date {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.paste-card-delete {
  font-size: 11px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: var(--font-mono);
}

.paste-card-delete:hover {
  color: var(--red);
  background: rgba(255, 94, 108, 0.1);
}

/* ============================================================
   VIEW PAGE
   ============================================================ */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.view-meta {
  flex: 1;
}

.view-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.view-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.view-date,
.view-expiry {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.view-expiry.warning {
  color: var(--yellow);
}

.view-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.view-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 15px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 99px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   EXPIRY INDICATOR
   ============================================================ */
.expired-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 15, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
  border-radius: var(--radius);
}

.expired-msg {
  text-align: center;
  color: var(--text-muted);
}

.expired-msg h2 {
  font-size: 18px;
  color: var(--red);
  margin-bottom: 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .editor-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-right {
    width: 100%;
  }

  .lang-select {
    flex: 1;
  }

  .view-header {
    flex-direction: column;
  }

  .view-actions {
    width: 100%;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-input {
    width: 100%;
  }
}