/* ============================================
   EVALTECH — Feuille de style principale
   Thème : Terre & Croissance (vert forêt + ocre)
   ============================================ */

:root {
  --green-900: #0d2b1a;
  --green-800: #163d26;
  --green-700: #1f5233;
  --green-600: #2a6e44;
  --green-500: #3a8f5a;
  --green-400: #5aad78;
  --green-300: #84c9a0;
  --green-200: #b8e0c8;
  --green-100: #e8f5ee;
  --green-50:  #f4faf7;

  --ocre-500: #c8853a;
  --ocre-400: #d9973f;
  --ocre-300: #e8b56a;
  --ocre-100: #fdf3e3;

  --red-500:  #e05252;
  --red-100:  #fdeaea;
  --blue-500: #3a7bc8;
  --blue-100: #e8f0fd;

  --ink-900: #111a14;
  --ink-700: #2d3d32;
  --ink-500: #4d6356;
  --ink-300: #8fa89a;
  --ink-200: #b8ccc0;
  --ink-100: #dde9e2;
  --ink-50:  #f0f5f2;

  --white: #ffffff;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 4px rgba(13,43,26,.08);
  --shadow-md: 0 4px 16px rgba(13,43,26,.12);
  --shadow-lg: 0 8px 32px rgba(13,43,26,.16);

  --font-ui: 'Sora', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --transition: .2s cubic-bezier(.4,0,.2,1);
}

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

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

body {
  font-family: var(--font-ui);
  background: var(--ink-50);
  color: var(--ink-700);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--green-900);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon { font-size: 1.5rem; }

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-200);
  letter-spacing: .5px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--ink-300);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255,255,255,.04);
  margin: 12px 12px 0;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green-600);
  color: var(--green-100);
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name { font-size: .85rem; font-weight: 600; color: var(--white); line-height: 1.2; }
.user-role { font-size: .72rem; color: var(--ink-300); margin-top: 2px; }

.nav-menu {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
}

.nav-separator {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-300);
  padding: 16px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-200);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover, .nav-item.active .nav-link {
  background: rgba(58,143,90,.25);
  color: var(--green-200);
}

.nav-item.active .nav-link {
  background: var(--green-600);
  color: var(--white);
}

.nav-icon { font-size: 1rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-logout:hover { background: rgba(224,82,82,.2) !important; color: #f48a8a !important; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin var(--transition);
}

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink-500);
  border-radius: 2px;
  transition: var(--transition);
}

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-900);
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.period-badge {
  background: var(--green-100);
  color: var(--green-700);
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--green-200);
}

.content-body { padding: 24px; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--ink-100);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green-400);
}

.stat-card.ocre::before { background: var(--ocre-400); }
.stat-card.blue::before { background: var(--blue-500); }
.stat-card.red::before  { background: var(--red-500); }

.stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-300); font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--ink-900); line-height: 1.1; margin: 6px 0 2px; font-family: var(--font-mono); }
.stat-sub   { font-size: .8rem; color: var(--ink-300); }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

thead th {
  background: var(--ink-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-500);
  border-bottom: 2px solid var(--ink-100);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink-50);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--green-50); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.badge-green  { background: var(--green-100); color: var(--green-700); }
.badge-ocre   { background: var(--ocre-100);  color: var(--ocre-500); }
.badge-red    { background: var(--red-100);   color: var(--red-500); }
.badge-blue   { background: var(--blue-100);  color: var(--blue-500); }
.badge-gray   { background: var(--ink-100);   color: var(--ink-500); }

/* ── SCORE DISPLAY ── */
.score-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .9rem;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  min-width: 44px;
  text-align: center;
}

.score-high   { background: var(--green-100); color: var(--green-700); }
.score-mid    { background: var(--ocre-100);  color: var(--ocre-500); }
.score-low    { background: var(--red-100);   color: var(--red-500); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green-600);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--ink-100);
  color: var(--ink-700);
}
.btn-secondary:hover { background: var(--ink-200); }

.btn-ocre {
  background: var(--ocre-400);
  color: var(--white);
}
.btn-ocre:hover { background: var(--ocre-500); }

.btn-danger {
  background: var(--red-100);
  color: var(--red-500);
}
.btn-danger:hover { background: var(--red-500); color: var(--white); }

.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: .9rem;
  color: var(--ink-700);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(58,143,90,.12);
}

/* ── RANGE SLIDER FOR NOTES ── */
.note-slider-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.note-display {
  width: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  background: var(--green-100);
  color: var(--green-700);
  border: none;
  outline: none;
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--ink-100);
  outline: none;
  padding: 0;
  border: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-600);
  cursor: pointer;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--green-400);
  transition: transform var(--transition);
}

input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── CRITERE ROW IN EVAL FORM ── */
.critere-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--ink-50);
}

.critere-row:last-child { border-bottom: none; }

.critere-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.critere-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-600);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

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

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--ink-900); }
.modal-close {
  background: var(--ink-100);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--red-100); color: var(--red-500); }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--ink-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--green-400);
  font-size: .88rem;
  font-weight: 500;
  min-width: 240px;
  animation: slideInToast .3s ease forwards;
}

.toast.error { border-color: var(--red-500); }
.toast.warning { border-color: var(--ocre-400); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── OVERLAY (mobile) ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
}

/* ── CHART CONTAINERS ── */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { max-height: 380px; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-300);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ── PAGE ACTIONS ── */
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-900);
  background-image: radial-gradient(ellipse at 30% 60%, rgba(42,110,68,.5) 0%, transparent 60%),
                    radial-gradient(ellipse at 70% 20%, rgba(58,143,90,.25) 0%, transparent 50%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .big-icon { font-size: 2.5rem; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--green-800); margin-top: 8px; }
.login-logo p { font-size: .85rem; color: var(--ink-300); margin-top: 4px; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 16px;
}

.alert-error { background: var(--red-100); color: var(--red-500); border: 1px solid #f8c0c0; }
.alert-success { background: var(--green-100); color: var(--green-700); border: 1px solid var(--green-200); }

/* ── TECH PROFILE HEADER ── */
.tech-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-100);
}

.tech-avatar-lg {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-600), var(--green-400));
  color: var(--white);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close { display: flex; }
  .overlay.show { display: block; }
  .menu-toggle { display: flex; }

  .main-content { margin-left: 0; }

  .content-body { padding: 16px; }

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

  .modal { max-width: 100%; border-radius: var(--radius-md); }

  .page-title { font-size: .95rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .35s ease forwards; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--ink-50); }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }
