/* ============================================
   nodrift.ch - Neo-Brutalism Design System
   ============================================ */

:root {
  /* Primary Colors - Cyan Terminal Theme */
  --primary: #00d4ff;
  --primary-dark: #00a8cc;
  --primary-glow: rgba(0, 212, 255, 0.3);
  --primary-subtle: rgba(0, 212, 255, 0.08);
  --secondary: #ff6b6b;

  /* Background Colors - GitHub Dark */
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-card-elevated: #1c2128;
  --bg-input: #0d1117;
  --bg-hover: #21262d;

  /* Text Colors */
  --text-light: #ffffff;
  --text-muted: #8b949e;
  --text-dark: #000000;
  --text-secondary: #c9d1d9;

  /* Border Colors */
  --border-light: #30363d;
  --border-primary: #00d4ff;

  /* State Colors */
  --success: #00d4ff;
  --success-glow: rgba(0, 212, 255, 0.2);
  --warning: #ffaa00;
  --warning-glow: rgba(255, 170, 0, 0.2);
  --error: #ff4444;
  --error-glow: rgba(255, 68, 68, 0.2);
  --info: #58a6ff;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border */
  --border-width: 2px;
  --shadow-offset: 4px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--primary-glow);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans, 'IBM Plex Sans'), system-ui, -apple-system, sans-serif;
  background: var(--bg-primary, var(--bg-dark));
  color: var(--text-primary, var(--text-light));
  line-height: 1.5;
  min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.5rem;
}
h4 {
  font-size: 1.25rem;
}

code,
.mono {
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Grid */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Flex */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-center {
  justify-content: center;
}
.gap-sm {
  gap: var(--space-sm);
}
.gap-md {
  gap: var(--space-md);
}
.gap-lg {
  gap: var(--space-lg);
}

/* ============================================
   BRUTALIST COMPONENTS
   ============================================ */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.875rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: var(--border-width) solid var(--text-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.4s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-dark);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--text-dark);
}

.btn-primary:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--text-dark), 0 0 20px var(--primary-glow);
  background: #00e5ff;
}

.btn-primary:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--text-dark);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-light);
  border-color: var(--border-light);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 rgba(48, 54, 61, 0.5);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-elevated);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--primary), 0 0 15px var(--primary-glow);
}

.btn-danger {
  background: var(--error);
  color: var(--text-light);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--text-dark);
}

.btn-danger:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--text-dark), 0 0 15px var(--error-glow);
  background: #ff5555;
}

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

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

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

.btn-ghost:hover {
  color: var(--primary);
  background: var(--primary-subtle);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-light);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-subtle) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 30px var(--primary-glow), 4px 4px 0 var(--primary);
  transform: translateY(-2px);
}

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

.card-elevated {
  background: var(--bg-card-elevated);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--border-light);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Inputs */
.input {
  background: var(--bg-input);
  border: var(--border-width) solid var(--border-light);
  color: var(--text-light);
  padding: var(--space-md);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
  transition: all 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.input-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Select */
.select {
  appearance: none;
  background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  background-size: 20px;
  border: var(--border-width) solid var(--border-light);
  color: var(--text-light);
  padding: var(--space-md);
  padding-right: 40px;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
  cursor: pointer;
  transition: all 0.15s ease;
}

.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px solid;
}

.badge-success {
  background: var(--success);
  color: var(--text-dark);
  border-color: var(--text-dark);
}

.badge-warning {
  background: var(--warning);
  color: var(--text-dark);
  border-color: var(--text-dark);
}

.badge-error {
  background: var(--error);
  color: var(--text-light);
  border-color: var(--text-dark);
}

.badge-info {
  background: var(--info);
  color: var(--text-dark);
  border-color: var(--text-dark);
}

/* Progress Bar */
.progress {
  height: 24px;
  background: var(--bg-input);
  border: var(--border-width) solid var(--border-light);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 2px solid var(--border-light);
}

.table th {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-card);
}

.table tr:hover td {
  background: var(--bg-hover);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
  padding: var(--space-xl);
  overflow-y: auto;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: var(--border-width) solid var(--primary);
  box-shadow: 8px 8px 0 var(--primary);
  padding: var(--space-xl);
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - var(--space-3xl) * 2);
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform 0.15s ease;
  margin: auto;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.1s;
}

.modal-close:hover {
  color: var(--text-light);
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Utilities */
.text-muted {
  color: var(--text-muted);
}
.text-primary {
  color: var(--primary);
}
.text-error {
  color: var(--error);
}
.text-success {
  color: var(--success);
}

.mt-sm {
  margin-top: var(--space-sm);
}
.mt-md {
  margin-top: var(--space-md);
}
.mt-lg {
  margin-top: var(--space-lg);
}
.mb-sm {
  margin-bottom: var(--space-sm);
}
.mb-md {
  margin-bottom: var(--space-md);
}
.mb-lg {
  margin-bottom: var(--space-lg);
}

.hidden {
  display: none !important;
}
