/* Reset et variables CSS */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #6366f1;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #1e293b;
  --light: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 0.5rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
}

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

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

/* Page de connexion */
.login-page {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-box {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header .logo {
  color: var(--primary);
  margin-bottom: 1rem;
}

.login-header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--gray-600);
}

/* Formulaires */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.form-group input:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-help {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: 0.25rem;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Navigation */
.navbar {
  background: white;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.125rem;
}

.logo-small {
  color: var(--primary);
}

.nav-menu {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s ease;
  font-size: 0.875rem;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary-light);
  color: white;
}

.nav-link-danger:hover {
  background: var(--danger);
  color: white;
}

/* Layout principal */
.main-content {
  min-height: calc(100vh - 4rem);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.container-small {
  max-width: 768px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--gray-600);
  font-size: 1.125rem;
}

/* Statistiques */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
}

.stat-icon-green {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.stat-icon-orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.stat-icon-red {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.stat-content h3 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-content p {
  color: var(--gray-600);
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--gray-50);
  font-size: 0.875rem;
  white-space: nowrap;
}

.data-table td {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.875rem;
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

/* License keys */
.license-key {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--gray-100);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.license-key-large {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  background: var(--gray-100);
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  display: inline-block;
  margin: 0.5rem 0;
}

.btn-copy {
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--gray-500);
  transition: color 0.15s ease;
}

.btn-copy:hover {
  color: var(--primary);
}

.btn-copy-large {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  margin-left: 0.5rem;
}

.btn-copy-large:hover {
  background: var(--primary-dark);
}

/* Tags et badges */
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Actions */
.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.inline-form {
  display: inline;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert svg {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

/* Checkbox personnalisé */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.checkbox-label:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.checkbox-label:has(input:checked) {
  background: rgba(79, 70, 229, 0.05);
  border-color: var(--primary);
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--gray-400);
  border-radius: 0.25rem;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.checkbox-label:has(input:checked) .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label:has(input:checked) .checkbox-custom::after {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.375rem;
  width: 0.375rem;
  height: 0.625rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-text strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.checkbox-text small {
  display: block;
  color: var(--gray-600);
  font-size: 0.8125rem;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
}

/* Notifications */
.notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(calc(100% + 2rem));
  transition: transform 0.3s ease;
  z-index: 1000;
}

.notification-show {
  transform: translateX(0);
}

.notification-success {
  border-left: 4px solid var(--success);
}

.notification-success svg {
  color: var(--success);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-box,
.card,
.stat-card {
  animation: fadeIn 0.5s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-menu {
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.5rem 0.75rem;
  }

  .nav-link span {
    display: none;
  }

  .nav-link svg {
    width: 24px;
    height: 24px;
  }

  .container {
    padding: 1rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }

  .table-responsive {
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  .data-table {
    font-size: 0.8125rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem;
  }

  .license-key {
    font-size: 0.75rem;
  }

  .notification {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
  }

  body {
    background: #0f172a;
    color: #e2e8f0;
  }

  .login-box,
  .navbar,
  .card,
  .stat-card {
    background: #1e293b;
  }

  .form-group input,
  .form-control {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
  }

  .btn-secondary {
    background: #334155;
    color: #e2e8f0;
  }

  .btn-secondary:hover {
    background: #475569;
  }

  .license-key,
  .license-key-large {
    background: #0f172a;
    color: #e2e8f0;
  }

  .checkbox-label {
    background: #0f172a;
    border-color: #334155;
  }

  .notification {
    background: #1e293b;
    color: #f1f5f9;
  }
}
