/* Base Variables for SaaS Dark Mode */
:root {
  /* Colors */
  --bg-primary: #0F0F13;
  --bg-secondary: rgba(255, 255, 255, 0.03);
  --bg-card: rgba(255, 255, 255, 0.05);

  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);

  --accent-primary: hsl(270, 90%, 55%);
  --accent-hover: hsl(270, 90%, 45%);
  --accent-surface: hsla(270, 90%, 55%, 0.1);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-surface: rgba(239, 68, 68, 0.1);

  --success: #10B981;
  --success-surface: rgba(16, 185, 129, 0.1);

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.25s ease-in-out;
}

/* Reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Layout Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

/* Top Navigation */
.top-nav {
  height: 72px;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(15, 15, 19, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, hsl(270, 90%, 55%), hsl(270, 90%, 35%));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(147, 51, 234, 0.3);
}

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

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

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

.avatar-small {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-primary) 0%, #a78bfa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}

.avatar-small:hover {
  border-color: var(--text-primary);
}

/* Dashboard Layout Structure */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  padding-top: calc(80px + 3rem);
  padding-bottom: 5rem;
  min-height: calc(100vh - 80px);
}

/* Sidebar Navigation */
.sidebar {
  position: sticky;
  top: calc(80px + 2rem);
  height: max-content;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-link svg {
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.sidebar-link:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-link.active {
  background-color: var(--accent-surface);
  color: var(--accent-primary);
}

.sidebar-link.active svg {
  opacity: 1;
  color: var(--accent-primary);
}

/* Content Area Base */
.content-area {
  max-width: 800px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Cards (Glassmorphism + Gradients) */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-surface);
}

.form-control:disabled,
.form-control[readonly] {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 6px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background-color: var(--danger-surface);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background-color: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* Toggles / Switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  transition: .4s;
  border-radius: 50%;
}

input:checked+.toggle-slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

input:checked+.toggle-slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    position: static;
  }

  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .sidebar-link {
    white-space: nowrap;
  }
}

:root {
  --text-main: #f4f4f5;
  --brand-500: hsl(270, 90%, 55%);
  --brand-600: hsl(270, 90%, 45%);
  --border-light: rgba(255, 255, 255, 0.08);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  background: rgba(5, 5, 7, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

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

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
  color: white;
}

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

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--text-main);
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* Member Menu */
.member-menu {
  position: relative;
  cursor: pointer;
}

.member-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: all 0.2s;
}

.member-menu:hover .member-avatar {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--brand-500);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.member-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 1rem;
  width: 220px;
  background: #0f0f13;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 0.5rem;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  backdrop-filter: blur(20px);
}

/* Bridge the gap so menu doesn't close on hover */
.member-dropdown::before {
  content: '';
  position: absolute;
  top: -1.5rem;
  left: 0;
  right: 0;
  height: 1.5rem;
}

.member-menu:hover .member-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.member-info {
  padding: 0.75rem 1rem;
}

.member-name {
  display: block;
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9rem;
}

.member-email {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.5rem 0;
}

.dropdown-item {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}