/* ========================================
   GitPulse — Main Styles
   Layout, theme, typography, input view
   ======================================== */

/* Custom Properties */
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --card: #16161f;
  --card-hover: #1e1e2a;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;

  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

/* Views */
.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: block;
}

/* ========================================
   Input View
   ======================================== */
#input-view {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 50% at 50% 45%, rgba(99,102,241,0.08) 0%, transparent 70%),
    var(--bg);
  position: relative;
}

#input-view.active {
  display: flex;
}

.input-view-content {
  text-align: center;
  max-width: 640px;
  width: 100%;
  padding: 2rem;
}

/* Logo */
.logo-section {
  margin-bottom: 3rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.logo-icon {
  width: 48px;
  height: 28px;
  color: var(--primary);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Search */
.search-section {
  margin-bottom: 2rem;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  gap: 0.75rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.search-bar.loading {
  animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
  50% { box-shadow: 0 0 0 6px rgba(99,102,241,0.25); }
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#username-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: var(--text-primary);
  min-width: 0;
}

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

.search-hint {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

kbd {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-xl);
  font-size: 0.9375rem;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-xl);
  font-size: 0.9375rem;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--card);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

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

.btn-loader {
  display: inline-flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Example Chips */
.examples-section {
  margin-top: 0.5rem;
}

.examples-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.chip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-xl);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: var(--card-hover);
  color: var(--primary-light);
  border-color: var(--primary);
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.loading-overlay[hidden] {
  display: none;
}

.loading-content {
  text-align: center;
}

.loading-ring {
  width: 64px;
  height: 64px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Animations */
.fade-slide-up {
  animation: fadeSlideUp 0.6s ease forwards;
  opacity: 0;
}

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

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.logo-icon-sm {
  width: 32px;
  height: 20px;
  color: var(--primary);
}

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

.top-bar-actions {
  display: flex;
  gap: 0.75rem;
}

/* Profile Content */
.profile-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Toast System */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  animation: toastIn 0.3s ease forwards;
  max-width: 400px;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-error {
  border-left: 3px solid var(--error);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-info {
  border-left: 3px solid var(--primary);
}

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

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

/* Responsive */
@media (max-width: 768px) {
  .input-view-content {
    padding: 1.5rem;
  }

  .logo-text {
    font-size: 2.25rem;
  }

  .search-bar {
    padding: 0.375rem 0.375rem 0.375rem 1rem;
  }

  #username-input {
    font-size: 0.9375rem;
  }

  .btn-primary {
    padding: 0.625rem 1.125rem;
    font-size: 0.875rem;
  }

  .top-bar {
    padding: 0.75rem 1rem;
  }

  .profile-content {
    padding: 1rem;
  }

  .top-bar-actions {
    gap: 0.5rem;
  }

  #toast-container {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    max-width: 100%;
  }
}
