:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #12141e;
  --bg-card: rgba(22, 25, 40, 0.7);
  --bg-card-hover: rgba(30, 34, 56, 0.85);
  --bg-input: rgba(18, 20, 32, 0.8);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.5);
  --border-glow: rgba(124, 58, 237, 0.35);

  --accent-purple: #8b5cf6;
  --accent-indigo: #6366f1;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;

  --grad-primary: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
  --grad-primary-hover: linear-gradient(135deg, #9d71f7 0%, #60a5fa 100%);
  --grad-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
  --grad-text: linear-gradient(135deg, #ffffff 30%, #c4b5fd 100%);
  --grad-glow: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.22), transparent 70%);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.18);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Atmospheric Ambient Background */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 650px;
  background: var(--grad-glow);
  pointer-events: none;
  z-index: 0;
}

.ambient-blob-1 {
  position: fixed;
  top: 15%;
  right: -10%;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(60px);
  z-index: 0;
}

.ambient-blob-2 {
  position: fixed;
  bottom: 10%;
  left: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(70px);
  z-index: 0;
}

/* Main Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* Header */
.app-header {
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.logo-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: #fff;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* User Session Badge */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.user-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.btn-icon-subtle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  transition: var(--transition-fast);
}

.btn-icon-subtle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.btn-logout {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fb7185;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fff;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0;
}

/* Authentication View */
.auth-wrapper {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--grad-primary);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-lock-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-subtle);
  border: 1px solid var(--border-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent-purple);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-fast);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 42px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-normal);
}

.form-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.form-input:focus + .input-icon,
.input-container:focus-within .input-icon {
  color: var(--accent-purple);
}

.auth-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: none;
  align-items: center;
  gap: 10px;
}

.auth-alert.show {
  display: flex;
}

.auth-alert-error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.35);
  transition: var(--transition-normal);
}

.btn-primary:hover {
  background: var(--grad-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.45);
}

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

.auth-footer-note {
  margin-top: 20px;
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Dashboard View */
.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.dashboard-hero {
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.dashboard-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dashboard-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Hub Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 10px;
}

.tool-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-subtle);
  opacity: 0;
  transition: var(--transition-normal);
  pointer-events: none;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  background: var(--bg-card-hover);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.tool-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.tool-card:hover .tool-icon-wrapper {
  transform: scale(1.06);
}

.tool-icon-autodub {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
}

.tool-icon-automix {
  background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

.tool-icon-autoversus {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.tool-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: #34d399;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.tool-info {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
}

.tool-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.tool-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.tool-url-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-purple);
  transition: var(--transition-fast);
}

.tool-card:hover .tool-launch-btn {
  color: #c4b5fd;
  transform: translateX(3px);
}

/* Developer Snippet Section / Banner */
.dev-banner {
  background: rgba(18, 21, 34, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.dev-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dev-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dev-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dev-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Modal for Snippet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  padding: 28px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

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

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-close-modal:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.code-box-wrapper {
  background: #08090e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
}

.code-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.code-snippet {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

.btn-copy-code {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-copy-code:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #fff;
}

/* Footer */
.app-footer {
  padding: 32px 0 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

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

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .dev-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .dashboard-title {
    font-size: 1.8rem;
  }
}
