:root {
  --bg-dark: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #162032;
  --bg-input: #1a2336;
  --border-color: #243048;
  --border-focus: #3b82f6;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-yellow: #f59e0b;
  --accent-yellow-bg: rgba(245, 158, 11, 0.12);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: #60a5fa;
}

.hidden {
  display: none !important;
}

/* Navbar */
.navbar {
  background-color: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.15rem;
}

.logo-badge {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
}

.domain-tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

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

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  transition: color 0.15s;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-email {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Main Layout */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* Hero & Portal */
.hero {
  text-align: center;
  max-width: 650px;
  margin: 1.5rem auto 3rem;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  background: linear-gradient(180deg, #ffffff 0%, #9ca3af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.search-bar {
  margin-top: 1.75rem;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.project-slug {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-all;
}

.project-url {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  display: block;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.project-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-public {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-private {
  background: var(--accent-yellow-bg);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #4b5563;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: #4b5563;
}

.btn-danger {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-block {
  width: 100%;
}

/* Auth View */
.auth-card {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
}

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

.auth-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

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

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: var(--accent-red-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
  background: var(--accent-green-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Admin Dashboard */
.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 0.25rem;
}

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

/* Card & Tables */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.95rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.font-mono {
  font-family: var(--font-mono);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374151;
  transition: 0.2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

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

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Inline Form */
.inline-form {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}

.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-row input {
  flex: 1;
  min-width: 200px;
  padding: 0.45rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.mt-8 { margin-top: 2rem; }
.mt-2 { margin-top: 0.5rem; }

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  z-index: 101;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.1);
}

.user-access-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-access-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 150;
}

.toast {
  background: #1f2937;
  color: var(--text-primary);
  border: 1px solid #374151;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

.toast-success { border-left: 4px solid var(--accent-green); }
.toast-error { border-left: 4px solid var(--accent-red); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }
  .nav-container { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  .nav-links { width: 100%; justify-content: space-between; }
  .projects-grid { grid-template-columns: 1fr; }
}
