/* assets/css/style.css */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #f9fafb;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --white: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f8fafc;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  background: var(--primary);
  color: var(--white);
  padding: 1rem 0;
  box-shadow: var(--shadow);
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}
header small {
  font-size: 0.75rem;
  opacity: 0.9;
}
header a {
  color: white;
  text-decoration: none;
}

/* Main content */
main {
  padding: 1.5rem 0;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  width: 100%;
  overflow: hidden;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.2s;
  font-family: inherit;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Correction des select trop grands */
select.form-control {
  min-height: 42px !important;
  max-height: 200px !important;
  height: auto !important;
  padding: 0.625rem !important;
}

/* Correction spécifique pour les select multiples */
select[multiple] {
  height: auto !important;
  min-height: 120px !important;
  max-height: 250px !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: white;
}
.btn-success { background: var(--success); }
.btn-success:hover { background: #0da271; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #e28e07; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin: 1rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  min-width: 600px;
  font-size: 0.9rem;
}
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background-color: #f9fafb;
}

/* Alerts */
.alert {
  padding: 0.875rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-left: 4px solid var(--success);
}
.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border-left: 4px solid var(--danger);
}
.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border-left: 4px solid var(--warning);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    padding: 0 1rem;
  }
  
  .sidebar {
    width: 70px !important;
  }
  
  .sidebar .label {
    display: none !important;
  }
  
  .sidebar-menu a {
    justify-content: center !important;
    padding: 0.75rem !important;
  }
  
  .content {
    padding: 1rem !important;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 13px;
  }
  
  .layout-header .container {
    padding: 0 0.75rem !important;
  }
  
  .brand-text h2 {
    font-size: 1rem !important;
  }
  
  .user-info span:not(.user-avatar) {
    display: none !important;
  }
  
  .content {
    padding: 0.75rem !important;
  }
  
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 0.5rem 0.375rem;
    font-size: 0.8rem;
  }
  
  /* Forms responsive */
  .form-group {
    margin-bottom: 0.875rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  
  h1 {
    font-size: 1.5rem !important;
  }
  
  h2 {
    font-size: 1.25rem !important;
  }
  
  h3 {
    font-size: 1.1rem !important;
  }
}

@media (max-width: 480px) {
  .layout-header {
    padding: 0.5rem 0 !important;
  }
  
  .brand-logo {
    width: 32px !important;
    height: 32px !important;
  }
  
  .logout-btn {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
  
  .content {
    padding: 0.5rem !important;
  }
  
  .card {
    padding: 0.75rem;
    border-radius: 6px;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Grid responsive */
  .form-grid,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .table-container {
    font-size: 0.75rem;
  }
  
  th, td {
    padding: 0.375rem 0.25rem;
    font-size: 0.75rem;
  }
}

/* Impression */
@media print {
  .sidebar, .layout-header, footer, .btn:not(.print-btn), .no-print {
    display: none !important;
  }
  .content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }
  table, th, td {
    border: 1px solid black !important;
  }
  th, td {
    padding: 6px !important;
  }
}