/* Style basé sur 1306data.com */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.7);
  --text-primary: #0a0a0a;
  --text-secondary: #6e6e73;
  --line: rgba(10, 10, 10, 0.08);
  --accent: #0071e3;
  --success: #0a7d2a;
  --error: #b00020;
  --warning: #ff9800;
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 12px;
  --shadow-xl: 0 48px 90px rgba(15, 15, 15, 0.16);
  --shadow-lg: 0 32px 60px rgba(15, 15, 15, 0.14);
  --shadow-md: 0 24px 42px rgba(15, 15, 15, 0.08);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* Layout principal */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar__header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.sidebar__logo {
  height: 44px;
}

.sidebar__nav {
  padding: 1rem 0;
}

.sidebar__nav-item {
  display: block;
  padding: 0.85rem 1.5rem;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.sidebar__nav-item:hover {
  background: var(--bg);
  text-decoration: none;
  border-left-color: var(--accent);
}

.sidebar__nav-item.active {
  background: var(--bg);
  border-left-color: var(--accent);
  color: var(--accent);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 2rem;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--surface);
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--line);
  margin: -2rem -2rem 2rem -2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.header__actions {
  display: flex;
  gap: 1rem;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 2rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.card__title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--bg);
  text-decoration: none;
}

.btn-success {
  background: var(--success);
  color: var(--surface);
}

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

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

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

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 0.95rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* Tableaux */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

thead {
  background: var(--bg);
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--line);
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

tbody tr:hover {
  background: var(--bg);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(10, 125, 42, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 152, 0, 0.1);
  color: var(--warning);
}

.badge-danger {
  background: rgba(176, 0, 32, 0.1);
  color: var(--error);
}

.badge-info {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
}

.badge-secondary {
  background: var(--bg);
  color: var(--text-secondary);
}

/* Alertes */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}

.alert-success {
  background: rgba(10, 125, 42, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.alert-error {
  background: rgba(176, 0, 32, 0.1);
  border-color: var(--error);
  color: var(--error);
}

.alert-warning {
  background: rgba(255, 152, 0, 0.1);
  border-color: var(--warning);
  color: var(--warning);
}

.alert-info {
  background: rgba(0, 113, 227, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

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

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.modal__title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.modal__close:hover {
  background: var(--bg);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .header {
    margin: -1rem -1rem 1rem -1rem;
    padding: 1rem;
  }
  
  .mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* Utilitaires */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
  display: flex;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Loading */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

