/* ============================================
   404 Finder - CSS Design System
   ============================================ */

:root {
  /* Color Palette */
  --bg-dark: #0f0f14;
  --bg-chrome: #1a1a24;
  --bg-tab: #252533;
  --bg-content: #12121a;
  --bg-address: #1e1e2c;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-dim: #55557a;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-orange: #f97316;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --border-color: #2a2a3e;
  --glass-bg: rgba(30, 30, 50, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-glow: 0 0 60px rgba(139, 92, 246, 0.15);
  --shadow-deep: 0 25px 50px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

/* ============================================
   Browser Window
   ============================================ */

.browser-window {
  width: 100%;
  max-width: 1100px;
  min-height: 700px;
  background: var(--bg-chrome);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-deep), var(--shadow-glow);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  animation: windowAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes windowAppear {
  from { 
    opacity: 0; 
    transform: scale(0.95) translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  }
}

/* ============================================
   Title Bar
   ============================================ */

.title-bar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-tab);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  user-select: none;
}

.window-controls {
  display: flex;
  gap: 8px;
  padding-right: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.2s;
}

.dot:hover { opacity: 0.8; }

.dot-close { background: #ff5f57; }
.dot-minimize { background: #febc2e; }
.dot-maximize { background: #28c840; }

.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-chrome);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  max-width: 220px;
  transition: background 0.2s;
}

.tab.active {
  background: var(--bg-address);
  color: var(--text-primary);
}

.tab-icon { font-size: 14px; }

.tab-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-close {
  font-size: 16px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.tab-close:hover { color: var(--text-primary); }

.tab-add {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s, color 0.2s;
}

.tab-add:hover {
  background: var(--bg-tab);
  color: var(--text-secondary);
}

/* ============================================
   Address Bar
   ============================================ */

.address-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border-color);
}

.nav-buttons {
  display: flex;
  gap: 4px;
}

.nav-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--bg-tab);
  color: var(--text-primary);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-address);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0 14px;
  gap: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.url-bar:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.lock-icon {
  font-size: 13px;
  opacity: 0.7;
}

.url-form {
  flex: 1;
  display: flex;
}

.url-input {
  width: 100%;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
}

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

.bookmark-btn {
  font-size: 18px !important;
}

/* ============================================
   Loading Bar
   ============================================ */

.loading-bar {
  height: 3px;
  background: transparent;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}

.loading-bar.active {
  opacity: 1;
}

.loading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink), var(--accent-blue));
  border-radius: 0 3px 3px 0;
  transition: width 0.3s ease;
}

/* ============================================
   Content Area
   ============================================ */

.content-area {
  flex: 1;
  background: var(--bg-content);
  overflow-y: auto;
  position: relative;
  min-height: 500px;
}

/* ============================================
   Welcome Screen
   ============================================ */

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 500px;
  padding: 40px 20px;
  text-align: center;
  animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.welcome-logo {
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 900;
  letter-spacing: -2px;
  margin-bottom: 12px;
  line-height: 1;
}

.logo-4 {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-0 {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: clamp(36px, 6vw, 60px);
}

.logo-space {
  display: inline-block;
  width: 16px;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 18px;
  margin-bottom: 8px;
  font-weight: 300;
}

.welcome-hint {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 40px;
}

.welcome-stats {
  display: flex;
  gap: 48px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   Error Display - Common Styles
   ============================================ */

.error-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  padding: 40px 20px;
  text-align: center;
  animation: errorAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Variant 1: Glitch */
.error-variant-glitch .error-code {
  font-size: clamp(80px, 15vw, 160px);
  font-weight: 900;
  font-family: var(--font-mono);
  position: relative;
  color: var(--text-primary);
  animation: glitch 2s infinite;
}

@keyframes glitch {
  0%, 90%, 100% { 
    text-shadow: none;
    transform: translate(0);
  }
  91% { 
    text-shadow: -4px 0 var(--accent-pink), 4px 0 var(--accent-cyan);
    transform: translate(2px, -1px);
  }
  93% { 
    text-shadow: 4px 0 var(--accent-pink), -4px 0 var(--accent-cyan);
    transform: translate(-2px, 1px);
  }
  95% { 
    text-shadow: -2px 0 var(--accent-pink), 2px 0 var(--accent-cyan);
    transform: translate(1px, 2px);
  }
  97% { 
    text-shadow: 2px 0 var(--accent-pink), -2px 0 var(--accent-cyan);
    transform: translate(-1px, -2px);
  }
}

.error-variant-glitch .error-message {
  font-size: 20px;
  color: var(--text-secondary);
  margin-top: 16px;
  font-weight: 300;
}

.error-variant-glitch .error-detail {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 24px;
  padding: 16px 24px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  max-width: 500px;
}

/* Variant 2: Space / Astronaut */
.error-variant-space {
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0f0f14 100%);
}

.error-variant-space .space-scene {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 24px;
}

.error-variant-space .astronaut {
  font-size: 100px;
  animation: float 6s ease-in-out infinite;
  display: inline-block;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(5deg); }
  50% { transform: translateY(-8px) rotate(-3deg); }
  75% { transform: translateY(-20px) rotate(2deg); }
}

.error-variant-space .stars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.error-variant-space .star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  animation: twinkle 2s ease-in-out infinite;
}

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

.error-variant-space .error-code {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-variant-space .error-message {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.error-variant-space .error-detail {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 16px;
  font-style: italic;
}

/* Variant 3: Terminal / Hacker */
.error-variant-terminal {
  background: #0a0a0a;
  align-items: flex-start;
  padding: 32px;
  font-family: var(--font-mono);
}

.error-variant-terminal .terminal-window {
  width: 100%;
  max-width: 600px;
  background: #111;
  border: 1px solid #333;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.error-variant-terminal .terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  font-size: 12px;
  color: #888;
}

.error-variant-terminal .terminal-body {
  padding: 20px;
  font-size: 13px;
  line-height: 1.8;
  color: #00ff41;
}

.error-variant-terminal .terminal-line {
  opacity: 0;
  animation: typeIn 0.3s forwards;
}

.error-variant-terminal .terminal-line.error-text {
  color: var(--accent-red);
}

.error-variant-terminal .terminal-line.warning-text {
  color: var(--accent-orange);
}

.error-variant-terminal .terminal-line.dim {
  color: #555;
}

.error-variant-terminal .cursor-blink {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: #00ff41;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes typeIn {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* Variant 4: Cute / Kawaii */
.error-variant-cute {
  background: linear-gradient(135deg, #1a1125 0%, #1e1530 50%, #151020 100%);
}

.error-variant-cute .cute-emoji {
  font-size: 120px;
  margin-bottom: 16px;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.error-variant-cute .error-code {
  font-size: 64px;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b9d, #c084fc, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-variant-cute .error-message {
  font-size: 20px;
  color: #c4b5fd;
  margin-top: 12px;
  font-weight: 500;
}

.error-variant-cute .error-detail {
  font-size: 14px;
  color: #7c6c9f;
  margin-top: 12px;
}

.error-variant-cute .cute-faces {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  font-size: 28px;
}

.error-variant-cute .cute-face {
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  cursor: default;
  transition: transform 0.2s, background 0.2s;
}

.error-variant-cute .cute-face:hover {
  transform: scale(1.2) rotate(5deg);
  background: rgba(255,255,255,0.1);
}

/* Variant 5: Retro / Pixel */
.error-variant-retro {
  background: #000;
  image-rendering: pixelated;
}

.error-variant-retro .retro-container {
  border: 4px solid #333;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  background: #0a0a0a;
}

.error-variant-retro .retro-emoji {
  font-size: 80px;
  margin-bottom: 20px;
  animation: retroBlink 1.5s step-end infinite;
}

@keyframes retroBlink {
  0%, 70% { opacity: 1; }
  71%, 85% { opacity: 0; }
  86%, 100% { opacity: 1; }
}

.error-variant-retro .error-code {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 700;
  color: #ff0;
  text-shadow: 3px 3px 0 #880;
  letter-spacing: 8px;
}

.error-variant-retro .error-message {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #0f0;
  margin-top: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.error-variant-retro .error-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #888;
  margin-top: 20px;
  line-height: 1.8;
}

.error-variant-retro .retro-bar {
  width: 100%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #ff0 0px, #ff0 4px,
    #000 4px, #000 8px
  );
  margin-top: 24px;
}

/* Variant 6: Elegant / Minimal */
.error-variant-elegant {
  background: linear-gradient(180deg, #0f0f14 0%, #161620 100%);
}

.error-variant-elegant .elegant-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
  margin-bottom: 32px;
}

.error-variant-elegant .error-code {
  font-size: 120px;
  font-weight: 200;
  letter-spacing: 24px;
  color: var(--text-primary);
  opacity: 0.9;
}

.error-variant-elegant .error-message {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 16px;
  font-weight: 300;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.error-variant-elegant .elegant-line-bottom {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
  margin-top: 32px;
  margin-bottom: 24px;
}

.error-variant-elegant .error-detail {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  max-width: 400px;
  line-height: 1.6;
}

/* Variant 7: Construction / Under Construction */
.error-variant-construction {
  background: repeating-linear-gradient(
    45deg,
    transparent 0px,
    transparent 20px,
    rgba(249, 115, 22, 0.03) 20px,
    rgba(249, 115, 22, 0.03) 40px
  ), var(--bg-content);
}

.error-variant-construction .construction-icon {
  font-size: 80px;
  margin-bottom: 16px;
  animation: shake 3s ease-in-out infinite;
}

@keyframes shake {
  0%, 85%, 100% { transform: rotate(0deg); }
  87% { transform: rotate(-10deg); }
  89% { transform: rotate(10deg); }
  91% { transform: rotate(-8deg); }
  93% { transform: rotate(8deg); }
  95% { transform: rotate(0deg); }
}

.error-variant-construction .error-code {
  font-size: 64px;
  font-weight: 800;
  color: var(--accent-orange);
  text-shadow: 0 0 30px rgba(249, 115, 22, 0.3);
}

.error-variant-construction .error-message {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 12px;
}

.error-variant-construction .caution-tape {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 12px 24px;
  background: repeating-linear-gradient(
    -45deg,
    #f97316 0px, #f97316 10px,
    #000 10px, #000 20px
  );
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Variant 8: Matrix */
.error-variant-matrix {
  background: #000;
  position: relative;
  overflow: hidden;
}

.error-variant-matrix .matrix-rain {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0.15;
}

.error-variant-matrix .matrix-column {
  position: absolute;
  top: -100%;
  font-family: var(--font-mono);
  font-size: 14px;
  color: #00ff41;
  writing-mode: vertical-rl;
  animation: matrixFall linear infinite;
  opacity: 0.7;
}

@keyframes matrixFall {
  from { top: -100%; }
  to { top: 100%; }
}

.error-variant-matrix .matrix-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.error-variant-matrix .error-code {
  font-family: var(--font-mono);
  font-size: 80px;
  font-weight: 700;
  color: #00ff41;
  text-shadow: 0 0 20px rgba(0, 255, 65, 0.5), 0 0 60px rgba(0, 255, 65, 0.2);
}

.error-variant-matrix .error-message {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #00cc33;
  margin-top: 12px;
}

.error-variant-matrix .error-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #008822;
  margin-top: 20px;
  max-width: 500px;
}

/* ============================================
   Error Image
   ============================================ */

.error-image {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  margin-bottom: 24px;
  border: 2px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  opacity: 0;
  animation: imgAppear 0.6s 0.3s forwards;
}

@keyframes imgAppear {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================
   Fun Button
   ============================================ */

.retry-btn {
  margin-top: 28px;
  padding: 12px 32px;
  border: 1px solid var(--border-color);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
}

.retry-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
  transform: translateY(-2px);
}

/* ============================================
   Status Bar
   ============================================ */

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--bg-tab);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-dim);
  user-select: none;
}

/* ============================================
   Scrollbar
   ============================================ */

.content-area::-webkit-scrollbar {
  width: 8px;
}

.content-area::-webkit-scrollbar-track {
  background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

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

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .browser-window {
    border-radius: var(--radius-md);
    min-height: 600px;
  }

  .welcome-stats {
    gap: 24px;
  }

  .stat-number {
    font-size: 24px;
  }

  .address-bar {
    padding: 6px 8px;
  }

  .url-bar {
    padding: 0 10px;
  }

  .nav-buttons {
    gap: 2px;
  }

  .error-variant-terminal {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .welcome-stats {
    flex-direction: column;
    gap: 16px;
  }

  .window-controls {
    display: none;
  }
}
