:root {
  /* Core Colors */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  --primary-950: #172554;

  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;
  --neutral-950: #020617;

  /* Semantic Colors - Light Mode (Default) */
  --bg-body: var(--neutral-50);
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: var(--neutral-50);
  --bg-hover: var(--neutral-100);

  --text-primary: var(--neutral-900);
  --text-secondary: var(--neutral-500);
  --text-muted: var(--neutral-400);

  --border-color: var(--neutral-200);
  --border-hover: var(--neutral-300);

  --accent-primary: var(--primary-600);
  --accent-hover: var(--primary-700);
  --accent-text: #ffffff;

  --danger-bg: #fef2f2;
  --danger-text: #ef4444;
  --danger-border: #fee2e2;

  --success-bg: #f0fdf4;
  --success-text: #22c55e;
  --success-border: #dcfce7;
}

/* Alert Styles */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid;
  margin-bottom: 1rem;
}

.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert-warning {
  background-color: #fffbeb;
  color: #f59e0b;
  border-color: #fed7aa;
}

.alert-info {
  background-color: #eff6ff;
  color: #3b82f6;
  border-color: #dbeafe;
}

/* Shadow and Radius Variables */
:root {

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

[data-theme="dark"] {
  /* Semantic Colors - Dark Mode */
  --bg-body: #0B0E14;
  --bg-card: #151A23;
  --bg-sidebar: #151A23;
  --bg-input: #0B0E14;
  --bg-hover: #1E2532;

  --text-primary: var(--neutral-50);
  --text-secondary: var(--neutral-400);
  --text-muted: var(--neutral-500);

  --border-color: #2D3748;
  --border-hover: #4A5568;

  --accent-primary: var(--primary-500);
  --accent-hover: var(--primary-400);
  --accent-text: #ffffff;

  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-text: #f87171;
  --danger-border: rgba(239, 68, 68, 0.2);

  --success-bg: rgba(34, 197, 94, 0.1);
  --success-text: #4ade80;
  --success-border: rgba(34, 197, 94, 0.2);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  color: var(--text-primary);
  font-weight: 600;
}

h1 {
  font-size: 1.875rem;
  line-height: 2.25rem;
}

h2 {
  font-size: 1.5rem;
  line-height: 2rem;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

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

a:hover {
  color: var(--accent-hover);
}

.text-muted {
  color: var(--text-secondary);
}

.text-sm {
  font-size: 0.875rem;
}

/* Navigation */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-decoration: none;
}

.nav-brand svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s;
}

.nav-item a:hover,
.nav-item a.active {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item a.active {
  background-color: var(--primary-50);
  color: var(--primary-700);
}

[data-theme="dark"] .nav-item a.active {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--primary-400);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

/* User Profile & Theme Toggle */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
}

.theme-toggle:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Components */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

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

.btn-primary {
  background-color: var(--accent-primary);
  color: var(--accent-text);
  border-color: transparent;
}

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

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

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

.btn-disabled {
  background-color: var(--neutral-300);
  color: var(--neutral-500);
  border-color: var(--neutral-300);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-disabled:hover {
  background-color: var(--neutral-300);
  color: var(--neutral-500);
  border-color: var(--neutral-300);
}

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

.btn-danger:hover {
  background-color: var(--danger-text);
  color: #fff;
}

.btn-icon {
  padding: 0.5rem;
}

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

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.925rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
}

[data-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-400);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-primary {
  background: var(--accent-primary);
  color: #ffffff;
}

.badge-neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: inherit;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .3;
    transform: scale(3);
  }
}

.current-row {
  border-left: 4px solid var(--accent-primary) !important;
  background: rgba(59, 130, 246, 0.03) !important;
}

[data-theme="dark"] .current-row {
  background: rgba(59, 130, 246, 0.08) !important;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Mobile Responsive */
.mobile-header {
  display: none;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 0.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    transform: translateX(-100%);
    width: 280px;
    height: 100vh;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-menu-toggle {
    display: block;
  }

  .main-content {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Utilities */
.w-full {
  width: 100%;
}

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

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.text-right {
  text-align: right;
}

.flex-grow {
  flex-grow: 1;
}

.hidden {
  display: none;
}

.text-danger {
  color: var(--danger-text);
}

/* Form Components */
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.form-value {
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-hover);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.code-textarea {
  min-height: 150px;
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
}

.domain-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.domain-input-group {
  display: flex;
  gap: 0.5rem;
}

.domain-input-group input {
  flex: 1;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  z-index: 1001;
}

/* Modern Deployment Notifications */
#notification-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 320px;
  max-width: 400px;
  pointer-events: none;
}

.deployment-notification {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateX(40px);
}

.deployment-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.deployment-notification.exit {
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.4s ease-in;
}

.deployment-notification::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--accent-color);
}

.notification-content {
  padding: 16px 20px 16px 24px;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.notification-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.notification-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  margin: -4px;
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.2s;
}

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

.notification-body {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.notification-status-text {
  font-weight: 600;
  color: var(--text-primary);
}

.notification-old-status {
  opacity: 0.6;
}

/* Notification Themes */
.notification-theme-success {
  --accent-color: #10b981;
  background: var(--success-bg);
}

.notification-theme-error {
  --accent-color: #ef4444;
  background: var(--danger-bg);
}

.notification-theme-warning {
  --accent-color: #f59e0b;
  background: #fef3c7;
}

.notification-theme-info {
  --accent-color: #3b82f6;
  background: var(--primary-50);
}

/* Dark Mode Support */
[data-theme="dark"] .deployment-notification {
  background: var(--bg-card);
}

[data-theme="dark"] .deployment-notification.notification-theme-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .deployment-notification.notification-theme-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .deployment-notification.notification-theme-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .deployment-notification.notification-theme-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

/* Modal Content styles are now included in .modal */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  margin: 0;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* App Cards */
.apps-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.app-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.app-card-header .font-medium {
  font-weight: 600;
}

.app-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.app-card-hidden {
  display: none;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--danger-text);
}

.btn-ghost:hover {
  background: var(--danger-bg);
}

.font-medium {
  font-weight: 500;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}