/* ========================================
   CodeNest - Main CSS v2
   Aesthetic: Terminal-noir + glassmorphism
   Font: Outfit + JetBrains Mono
======================================== */

:root {
  --bg-0: #02040a;
  --bg-1: #070d1a;
  --bg-2: #0c1526;
  --bg-3: #111e33;
  --bg-4: #172540;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --accent: #00d4ff;
  --accent-2: #7c3aed;
  --accent-3: #f59e0b;
  --accent-glow: rgba(0, 212, 255, 0.12);
  --green: #00e5a0;
  --red: #ff4d6a;
  --yellow: #f59e0b;
  --text-1: #f0f4ff;
  --text-2: #8b9bb4;
  --text-3: #4a5568;
  --font: 'Outfit', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --r: 14px;
  --r-sm: 8px;
  --r-lg: 20px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 30%, transparent 100%);
}

.bg-glow {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  width: 900px;
  height: 900px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.05) 0%, rgba(124, 58, 237, 0.03) 40%, transparent 70%);
  top: -350px;
  right: -350px;
  animation: bgFloat 9s ease-in-out infinite alternate;
}

@keyframes bgFloat {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(25px, 15px) scale(1.04);
  }
}

/* NAVBAR */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 2.5rem;
  background: rgba(2, 4, 10, 0.85);
  backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.25);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text-1);
  background: var(--glass);
}

/* BUTTONS */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: #000;
  border: none;
  border-radius: var(--r-sm);
  padding: 0.55rem 1.4rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.btn-lg {
  padding: 0.85rem 2.2rem;
  font-size: 0.95rem;
  border-radius: var(--r);
}

.btn-primary.btn-full {
  width: 100%;
  padding: 0.85rem;
  text-align: center;
}

.btn-outline {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.55rem 1.4rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.05);
}

.btn-outline.btn-lg {
  padding: 0.85rem 2.2rem;
  font-size: 0.95rem;
  border-radius: var(--r);
}

.btn-danger {
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  padding: 0.6rem 1.4rem;
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  opacity: 0.85;
}

.btn-logout {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.4rem 0.8rem;
  font-family: var(--font);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  width: 100%;
}

.btn-logout:hover {
  color: var(--red);
  border-color: rgba(255, 77, 106, 0.4);
}

/* AVATAR */
.nav-avatar {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #000;
  flex-shrink: 0;
  border: 2px solid rgba(0, 212, 255, 0.25);
}

.avatar-circle.large {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.avatar-circle.sm {
  width: 30px;
  height: 30px;
  font-size: 0.72rem;
}

.nav-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}

.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  min-width: 170px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.nav-avatar:hover .dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.dropdown a {
  display: block;
  padding: 0.65rem 1rem;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}

.dropdown a:hover {
  background: var(--glass-hover);
  color: var(--text-1);
}

/* HERO */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8rem 2rem 5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 100px;
  padding: 0.4rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2.5rem;
  letter-spacing: 0.5px;
  animation: fadeUp 0.6s ease both;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.5
  }
}

.hero-title {
  font-size: clamp(3.5rem, 9vw, 7rem);
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: -3px;
  margin-bottom: 1.5rem;
  animation: fadeUp 0.7s 0.1s ease both;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradShift 4s ease infinite;
}

@keyframes gradShift {

  0%,
  100% {
    background-position: 0% 50%
  }

  50% {
    background-position: 100% 50%
  }
}

.hero-subtitle {
  font-size: 1.08rem;
  color: var(--text-2);
  max-width: 550px;
  line-height: 1.8;
  margin-bottom: 2.5rem;
  animation: fadeUp 0.7s 0.2s ease both;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 5rem;
  animation: fadeUp 0.7s 0.3s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero Window */
.hero-window {
  width: 100%;
  max-width: 700px;
  background: var(--bg-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 80px rgba(0, 212, 255, 0.07);
  animation: fadeUp 0.8s 0.4s ease both;
  position: relative;
}

.hero-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--glass-border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red {
  background: #ff5f57;
}

.dot.yellow {
  background: #ffbd2e;
}

.dot.green {
  background: #28ca41;
}

.window-title {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--mono);
  margin: 0 auto;
}

.window-body {
  padding: 1.5rem;
  text-align: left;
}

.code-preview {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.9;
}

.code-preview .kw {
  color: #ff79c6;
}

.code-preview .at {
  color: #50fa7b;
}

.code-preview .str {
  color: #f1fa8c;
}

.code-preview .cm {
  color: #6272a4;
}

.window-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 1.1rem;
  background: rgba(0, 212, 255, 0.04);
  border-top: 1px solid var(--glass-border);
  font-size: 0.75rem;
  color: var(--text-2);
  font-family: var(--mono);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.copy-mini {
  margin-left: auto;
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 5px;
  padding: 0.25rem 0.7rem;
  font-size: 0.7rem;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
}

.copy-mini:hover {
  background: rgba(0, 212, 255, 0.2);
}

/* FEATURES */
.features {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 6rem 2rem;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  margin-bottom: 3.5rem;
  line-height: 1.1;
  text-align: center;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5px;
  background: var(--glass-border);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.feature-card {
  background: var(--bg-1);
  padding: 2rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.feature-card:hover {
  background: var(--bg-2);
}

.feature-icon {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-2);
  font-size: 0.855rem;
  line-height: 1.65;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow);
}

.modal.small {
  max-width: 360px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--text-1);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  flex: 1;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-header .logo-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.75rem;
  border-radius: 10px;
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
  letter-spacing: -0.5px;
}

.auth-header p {
  color: var(--text-2);
  font-size: 0.875rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.83rem;
  color: var(--text-2);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

/* FORMS */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 0.45rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.optional {
  color: var(--text-3);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 0.83rem;
  transition: all 0.2s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
  background: var(--bg-2);
}

.form-error {
  background: rgba(255, 77, 106, 0.08);
  border: 1px solid rgba(255, 77, 106, 0.25);
  border-radius: var(--r-sm);
  padding: 0.65rem 0.9rem;
  color: #ff8fa3;
  font-size: 0.83rem;
  margin-bottom: 1rem;
}

.form-error.hidden {
  display: none;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.radio-option:hover {
  border-color: rgba(0, 212, 255, 0.3);
}

.radio-option input {
  accent-color: var(--accent);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  background: var(--bg-3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.8rem 1.25rem;
  color: var(--text-1);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  max-width: 300px;
  box-shadow: var(--shadow-sm);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.success {
  border-color: rgba(0, 229, 160, 0.3);
  color: var(--green);
}

.toast.error {
  border-color: rgba(255, 77, 106, 0.3);
  color: #ff8fa3;
}

.hidden {
  display: none !important;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 100px;
}

::selection {
  background: rgba(0, 212, 255, 0.2);
  color: var(--text-1);
}

/* LOGIN TYPE TABS */
.login-type-tabs {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 0.3rem;
  margin-bottom: 0.75rem;
}

.login-type-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.2s;
}

.login-type-btn.active {
  background: var(--bg-3);
  color: var(--text-1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.login-type-btn:first-child.active {
  color: var(--accent);
}

.login-type-btn:last-child.active {
  color: #f59e0b;
}