/* ==========================================================================
   CodeNest - Global Design Tokens & Base Styles (Light Modern Theme)
   ========================================================================== */

:root {
  /* Brand Primary Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.15);

  /* Complementary & Accent Colors */
  --cyan: #0ea5e9;
  --cyan-light: #f0f9ff;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  /* Surfaces & Backgrounds (Bright, Clean, Crisp) */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;

  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Borders & Shadows */
  --border-subtle: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #3b82f6;

  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-soft: 0 12px 32px rgba(37, 99, 235, 0.06);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button, input, select, textarea {
  font-family: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header & Sticky Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 20px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px var(--primary-glow);
}

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

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

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  padding: 6px 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  background-color: var(--primary);
  border-radius: var(--radius-full);
}

/* Header Right / User Section */
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-search-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.header-search-btn:hover {
  background: var(--bg-surface-alt);
  color: var(--primary);
  border-color: var(--primary);
}

/* Notification Button & Dropdown */
.notif-wrapper {
  position: relative;
}

.notif-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.notif-btn:hover {
  background: var(--bg-surface-alt);
  color: var(--primary);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: none;
  z-index: 1001;
  animation: fadeInDown 0.2s ease-out;
}

.notif-dropdown.show {
  display: block;
}

.notif-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.notif-clear {
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 600;
}

.notif-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover {
  background: var(--bg-surface-alt);
}

.notif-item.unread {
  background: var(--primary-light);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.notif-item-content h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.notif-item-content p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notif-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* User Profile Menu */
.user-menu-wrapper {
  position: relative;
}

.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-full);
}

.user-avatar-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: none;
  z-index: 1001;
  padding: 8px 0;
  animation: fadeInDown 0.2s ease-out;
}

.user-menu-dropdown.show {
  display: block;
}

.user-menu-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.user-menu-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.user-menu-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}

.user-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.user-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  padding: 70px 0 30px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.2fr;
  gap: 40px;
  margin-bottom: 50px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 16px;
  max-width: 320px;
  line-height: 1.6;
}

.footer-heading {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links-list a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-links-list a:hover {
  color: var(--primary);
  padding-left: 4px;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-xl);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error { border-left-color: var(--danger); }

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

/* Responsive Navigation Breakpoints */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: #ffffff;
    flex-direction: column;
    padding: 24px;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    gap: 16px;
  }

  .main-nav.open {
    display: flex;
  }

  .mobile-toggle {
    display: block;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}
