/* AlphaCI - Terminal Noir Design System */

/* Google Fonts - JetBrains Mono for code, Manrope for UI */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

/* CSS Variables - Design Tokens */
:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2a;

  /* Borders */
  --border-default: #2a2a3a;
  --border-hover: #3a3a4a;
  --border-accent: #10b981;

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;

  /* Accent Colors */
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.3);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.3);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.3);
  --accent-purple: #a855f7;

  /* Fonts */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Manrope', system-ui, sans-serif;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-green: 0 0 20px var(--accent-green-glow);
  --shadow-glow-cyan: 0 0 20px var(--accent-cyan-glow);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Auth page centering */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* Utility classes (Tailwind fallbacks) */
.flex { display: flex !important; }
.items-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-6 { gap: 1.5rem !important; }
.grid { display: grid !important; }
.block { display: block !important; }
.inline-flex { display: inline-flex !important; }
.hidden { display: none !important; }
.w-full { width: 100% !important; }
.max-w-md { max-width: 28rem !important; }
.max-w-xl { max-width: 36rem !important; }
.max-w-7xl { max-width: 80rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }
.mb-8 { margin-bottom: 2rem !important; }
.mb-10 { margin-bottom: 2.5rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-5 { margin-top: 1.25rem !important; }
.mt-6 { margin-top: 1.5rem !important; }
.mt-8 { margin-top: 2rem !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-6 { padding: 1.5rem !important; }
.p-8 { padding: 2rem !important; }
.p-16 { padding: 4rem !important; }
.px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-8 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-4 { padding-top: 1rem !important; }
.pt-5 { padding-top: 1.25rem !important; }
.pt-6 { padding-top: 1.5rem !important; }
.space-y-2 > * + * { margin-top: 0.5rem !important; }
.space-y-3 > * + * { margin-top: 0.75rem !important; }
.space-y-5 > * + * { margin-top: 1.25rem !important; }
.space-y-6 > * + * { margin-top: 1.5rem !important; }
.text-center { text-align: center !important; }
.text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }
.text-2xl { font-size: 1.5rem !important; }
.text-3xl { font-size: 1.875rem !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.truncate { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.min-w-0 { min-width: 0 !important; }
.p-4 { padding: 1rem !important; }
.ml-4 { margin-left: 1rem !important; }
.mt-4 { margin-top: 1rem !important; }
.items-start { align-items: flex-start !important; }

/* Grid responsive */
@media (min-width: 768px) {
  .md\\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (min-width: 1024px) {
  .lg\\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .lg\\:px-8 { padding-left: 2rem !important; padding-right: 2rem !important; }
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }

/* Position utilities */
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.fixed { position: fixed !important; }
.sticky { position: sticky !important; }
.inset-0 { top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; }
.top-0 { top: 0 !important; }
.z-10 { z-index: 10 !important; }
.z-50 { z-index: 50 !important; }

/* Opacity */
.opacity-10 { opacity: 0.1 !important; }
.opacity-20 { opacity: 0.2 !important; }
.opacity-30 { opacity: 0.3 !important; }
.opacity-60 { opacity: 0.6 !important; }

/* Pointer events */
.pointer-events-none { pointer-events: none !important; }

/* Sizing */
.w-4 { width: 1rem !important; }
.w-5 { width: 1.25rem !important; }
.w-20 { width: 5rem !important; }
.w-80 { width: 20rem !important; }
.w-96 { width: 24rem !important; }
.h-4 { height: 1rem !important; }
.h-5 { height: 1.25rem !important; }
.h-16 { height: 4rem !important; }
.h-80 { height: 20rem !important; }
.h-96 { height: 24rem !important; }
.min-h-screen { min-height: 100vh !important; }

/* Blur */
.blur-3xl { filter: blur(64px) !important; }

/* Border radius */
.rounded { border-radius: 0.25rem !important; }
.rounded-lg { border-radius: 0.5rem !important; }
.rounded-xl { border-radius: 0.75rem !important; }
.rounded-full { border-radius: 9999px !important; }

/* Misc */
.overflow-hidden { overflow: hidden !important; }
.overflow-x-auto { overflow-x: auto !important; }
.cursor-pointer { cursor: pointer !important; }
.cursor-not-allowed { cursor: not-allowed !important; }
.select-none { user-select: none !important; }

/* Flex direction */
.flex-col { flex-direction: column !important; }

/* Items alignment */
.items-start { align-items: flex-start !important; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Card Component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-glow:hover {
  border-color: var(--accent-green);
  box-shadow: var(--shadow-glow-green);
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
  color: #000;
  box-shadow: var(--shadow-sm), 0 0 0 0 var(--accent-green-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow-green);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

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

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

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

.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
}

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

/* Input Components */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

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

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

/* Label */
.label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Status Indicators */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-running {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green-glow);
  animation: pulse-green 2s infinite;
}

.status-building, .status-deploying, .status-pending {
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber-glow);
  animation: pulse-amber 1s infinite;
}

.status-failed {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red-glow);
}

.status-stopped, .status-default {
  background: var(--text-muted);
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes pulse-amber {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Navigation */
.nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  backdrop-filter: blur(10px);
}

.nav-brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent-green);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand::before {
  content: '>';
  color: var(--accent-cyan);
}

/* Logo Animation */
.logo-text {
  background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Page Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn var(--transition-base) ease forwards;
}

.animate-fade-in-up {
  animation: fadeInUp var(--transition-slow) ease forwards;
}

.animate-delay-1 { animation-delay: 100ms; }
.animate-delay-2 { animation-delay: 200ms; }
.animate-delay-3 { animation-delay: 300ms; }
.animate-delay-4 { animation-delay: 400ms; }

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slideUp 0.3s ease forwards;
}

/* Spin animation for loading states */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Gradient Backgrounds */
.bg-gradient-dark {
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.bg-gradient-mesh {
  background:
    radial-gradient(at 20% 30%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(at 80% 70%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
    var(--bg-primary);
}

/* Noise Texture Overlay */
.noise-overlay::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1000;
}

/* Terminal-style code blocks */
.terminal {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}

.terminal-header {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-default);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot-red { background: #ff5f56; }
.terminal-dot-yellow { background: #ffbd2e; }
.terminal-dot-green { background: #27ca40; }

/* Deployment History */
.deployment-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
  transition: background var(--transition-fast);
}

.deployment-item:hover {
  background: var(--bg-tertiary);
}

.deployment-item:last-child {
  border-bottom: none;
}

/* Commit SHA style */
.commit-sha {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-cyan);
  background: var(--bg-tertiary);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

/* Tag/Badge */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-secondary);
}

.tag-green {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.tag-cyan {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

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

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  opacity: 0.3;
}

/* Alert/Flash Messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9375rem;
}

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

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

/* Grid Pattern Background */
.bg-grid {
  background-image:
    linear-gradient(var(--border-default) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-default) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
}

/* Glow Effects */
.glow-green {
  box-shadow: 0 0 30px var(--accent-green-glow);
}

.glow-cyan {
  box-shadow: 0 0 30px var(--accent-cyan-glow);
}

/* Link Styles */
a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Form Error List */
.error-list {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-red);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.error-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.error-list li {
  color: var(--accent-red);
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

.error-list li::before {
  content: '! ';
  font-weight: bold;
}

/* Tag Colors */
.tag-amber {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.tag-red {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Build Log Styles */
.log-line {
  padding: 0.125rem 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

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

.log-info {
  color: var(--accent-cyan);
}

.log-success {
  color: var(--accent-green);
}

.log-warning {
  color: var(--accent-amber);
}

.log-error {
  color: var(--accent-red);
}

.log-command {
  color: var(--accent-purple);
}

.log-step {
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-default);
}

/* Log container */
#build-logs {
  font-family: var(--font-mono);
  line-height: 1.6;
}

#build-logs::-webkit-scrollbar {
  width: 6px;
}

#build-logs::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

#build-logs::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

/* Additional utilities */
.overflow-auto {
  overflow: auto !important;
}

.max-w-4xl {
  max-width: 56rem !important;
}
