:root {
  --bg-main: #0a0e17;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.09);
  --bg-input: #131b2e;
  --bg-input-border: #232f48;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;

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

  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.2);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Grids & Glows */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: -2;
}

.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  opacity: 0.25;
  z-index: -1;
}

.bg-glow-1 {
  top: -150px;
  left: -100px;
  background: var(--accent-purple);
}

.bg-glow-2 {
  bottom: -200px;
  right: -150px;
  background: var(--accent-cyan);
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--bg-card-border);
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-highlight {
  color: var(--accent-purple);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-nav {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
  border-color: rgba(139, 92, 246, 0.3);
}

.btn-nav:hover {
  background: rgba(139, 92, 246, 0.22);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* App Main Layout */
.app-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.view {
  width: 100%;
}

.hidden {
  display: none !important;
}

/* Editor & Paste Card Layout */
.editor-card, .paste-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Editor Controls Header */
.editor-header {
  padding: 20px 24px 16px 24px;
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-input-wrap {
  width: 100%;
}

.title-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  outline: none;
  padding: 4px 0;
  transition: border-color 0.2s;
}

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

.title-input:focus {
  border-bottom-color: var(--accent-purple);
}

.controls-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

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

.control-item label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-dropdown {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--bg-input-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.select-dropdown:focus {
  border-color: var(--accent-purple);
}

/* Lock Switch Toggle */
.lock-control {
  margin-left: auto;
}

.lock-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}

.lock-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.lock-slider {
  width: 38px;
  height: 22px;
  background-color: var(--bg-input-border);
  border-radius: 34px;
  position: relative;
  transition: 0.25s ease;
}

.lock-slider:before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: 0.25s ease;
}

.lock-checkbox:checked + .lock-slider {
  background-color: var(--accent-purple);
}

.lock-checkbox:checked + .lock-slider:before {
  transform: translateX(16px);
  background-color: #fff;
}

.lock-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lock-checkbox:checked ~ .lock-text {
  color: var(--accent-purple);
}

/* Password Input Block */
.password-field-wrap {
  background: rgba(139, 92, 246, 0.08);
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease;
}

.password-input-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--accent-purple);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  max-width: 450px;
  color: var(--accent-purple);
}

.password-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.9rem;
  width: 100%;
}

.password-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Text Editor & Line Numbers Gutter */
.editor-wrapper {
  display: flex;
  background: #0d121f;
  min-height: 440px;
  max-height: 70vh;
  position: relative;
}

.editor-gutter {
  padding: 16px 12px;
  min-width: 48px;
  background: #090c15;
  color: #4b5563;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  white-space: pre;
  overflow: hidden;
}

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

.editor-textarea::placeholder {
  color: #4b5563;
}

/* Editor Footer Toolbar */
.editor-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--bg-card-border);
  background: rgba(10, 14, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.stat-sep {
  color: var(--text-dim);
}

/* Paste View Header */
.paste-header {
  padding: 24px;
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.view-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.paste-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-lang {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
  text-transform: lowercase;
}

.badge-lock-locked {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-lock-unlocked {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-subtle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.paste-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Share & Quick Code Bar */
.share-bar {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--bg-card-border);
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.share-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 240px;
}

.share-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.share-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.share-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.share-code-input {
  color: var(--accent-purple);
  font-weight: 600;
  letter-spacing: 0.05em;
  max-width: 150px;
}

/* Code Display Block */
.code-container {
  display: flex;
  background: #0d121f;
  min-height: 350px;
  max-height: 75vh;
  overflow: auto;
}

.view-gutter {
  padding: 16px 12px;
  min-width: 48px;
  background: #090c15;
  color: #4b5563;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  white-space: pre;
}

.code-pre {
  margin: 0;
  padding: 16px 20px;
  flex: 1;
  overflow: visible;
  background: transparent !important;
}

.code-pre code {
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
  background: transparent !important;
  padding: 0 !important;
}

/* Password Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #111827;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lock-modal-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.quick-open-modal-icon {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-input-wrap {
  width: 100%;
}

.modal-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

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

.modal-error {
  font-size: 0.82rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-purple);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 200;
  animation: slideUp 0.25s ease;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--bg-card-border);
  padding: 20px 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: auto;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-main {
    padding: 16px;
  }

  .editor-header, .paste-header {
    padding: 16px;
  }

  .controls-group {
    flex-direction: column;
    align-items: stretch;
  }

  .lock-control {
    margin-left: 0;
  }

  .paste-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
