/**
 * Code Shapes - Design System
 * Variables, typography, components réutilisables
 */

:root {
  /* Colors */
  --ink: #0B0D10;
  --muted: #5B6673;
  --accent: #00C2FF;
  --ok: #12b886;
  --danger: #fa5252;
  --warning: #FF9800;
  --sep: #E4E9EF;
  --panel: #FFFFFF;
  --bg: #F6F8FB;
  --edf: #0056A3;
  --alpiq: #FF7A00;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(10, 20, 30, 0.04);
  --shadow-md: 0 4px 18px rgba(10, 20, 30, 0.06);
  --shadow-lg: 0 8px 32px rgba(10, 20, 30, 0.1);
  --ring: 0 0 0 3px rgba(0, 194, 255, 0.25);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Typography */
  --font-body: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

h1 { font-size: clamp(28px, 5vw, 42px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: clamp(20px, 3vw, 24px); }
h4 { font-size: 18px; }

p {
  margin: 0 0 var(--space-md);
  color: var(--muted);
}

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

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

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: var(--space-md);
  padding-left: calc(var(--space-md) + env(safe-area-inset-left));
  padding-right: calc(var(--space-md) + env(safe-area-inset-right));
}

.main {
  max-width: 1140px;
  width: 100%;
  display: grid;
  gap: 14px;
}

/* Card */
.card {
  background: var(--panel);
  border: 1px solid var(--sep);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--sep);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn.primary {
  background: var(--accent);
  color: #001018;
  border: 0;
}

.btn.primary:hover {
  background: #00aae6;
}

.btn.success {
  background: var(--ok);
  color: #fff;
  border: 0;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border: 0;
}

/* Form elements */
.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.input, select, textarea {
  appearance: none;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--sep);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.2s;
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 184, 134, 0.1);
}

.input:disabled, select:disabled, textarea:disabled {
  background: #f8f9fa;
  cursor: not-allowed;
  opacity: 0.6;
}

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

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

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

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

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

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--sep);
  color: var(--muted);
}

.badge.success { background: #E6FAF0; color: var(--ok); }
.badge.danger { background: #FFE5E5; color: var(--danger); }
.badge.warning { background: #FFF8E1; color: var(--warning); }

/* Alert */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-left: 4px solid;
}

.alert.info {
  background: #E0F2FE;
  border-color: var(--accent);
  color: #0369A1;
}

.alert.success {
  background: #E6FAF0;
  border-color: var(--ok);
  color: #0F7A56;
}

.alert.warning {
  background: #FFF8E1;
  border-color: var(--warning);
  color: #E65100;
}

.alert.danger {
  background: #FFE5E5;
  border-color: var(--danger);
  color: #C92A2A;
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    font-size: 15px;
  }

  .card {
    padding: var(--space-md);
  }

  .btn {
    padding: 10px 16px;
  }
}
