/* ============================================
   INTRANET LE RADAR LYONNAIS — style.css
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

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

:root {
  --coral:       #D85A30;
  --coral-light: #FAECE7;
  --coral-mid:   #F0997B;
  --coral-dark:  #993C1D;
  --bg:          #F5F4F0;
  --surface:     #FFFFFF;
  --border:      rgba(0,0,0,0.08);
  --border-md:   rgba(0,0,0,0.13);
  --text:        #1A1A18;
  --text-2:      #6B6B67;
  --text-3:      #A0A09C;
  --radius:      10px;
  --radius-lg:   14px;
  --sidebar-w:   220px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 1.5rem;
  text-decoration: none;
}
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--coral);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.logo-text { line-height: 1.25; }
.logo-text strong { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.logo-text span   { font-size: 11px; color: var(--text-2); }

.nav-section { font-size: 10.5px; color: var(--text-3); letter-spacing: .07em; text-transform: uppercase; padding: .75rem 10px .25rem; }

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-2);
  text-decoration: none;
  transition: background .12s, color .12s;
  margin-bottom: 2px;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--coral-light); color: var(--coral); font-weight: 500; }

.sidebar-bottom { margin-top: auto; padding-top: 1rem; border-top: 0.5px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 6px 4px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--coral-light); color: var(--coral);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info strong { font-size: 12.5px; font-weight: 500; display: block; }
.sidebar-user-info span   { font-size: 11px; color: var(--text-3); }

/* ── MAIN ─────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 2rem 2.5rem;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem;
}
.page-title   { font-size: 22px; font-weight: 600; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* ── CARDS ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 1rem;
  color: var(--text);
}
.card-title svg { width:16px; height:16px; color: var(--coral); }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* ── METRICS ──────────────────────────────── */
.metric {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.metric-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.metric-val   { font-size: 26px; font-weight: 600; line-height: 1.1; }
.metric-sub   { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ── BADGES ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.badge-pending  { background: #FAEEDA; color: #8A5200; }
.badge-valid    { background: #EAF3DE; color: #2E6B0A; }
.badge-refused  { background: #FCEBEB; color: #9B2B2B; }
.badge-progress { background: #E6F1FB; color: #0D4E96; }
.badge-paid     { background: #E1F5EE; color: #0A5E40; }

/* ── TABLES ───────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  border-bottom: 0.5px solid var(--border-md);
}
.table td {
  padding: 11px 12px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }

/* ── FORMS ────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-label .req { color: var(--coral); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px;
  background: var(--surface); color: var(--text);
  transition: border .15s, box-shadow .15s;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(216,90,48,.12);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B67' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── BUTTONS ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  border: 0.5px solid var(--border-md);
  background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn-primary:hover { background: var(--coral-dark); border-color: var(--coral-dark); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-danger { background: #FCEBEB; color: #9B2B2B; border-color: #F7C1C1; }
.btn-danger:hover { background: #F7C1C1; }

/* ── ALERTS / FLASH ───────────────────────── */
.alert {
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13.5px; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: #EAF3DE; color: #2E6B0A; border: 0.5px solid #C0DD97; }
.alert-error   { background: #FCEBEB; color: #9B2B2B; border: 0.5px solid #F7C1C1; }
.alert-info    { background: #E6F1FB; color: #0D4E96; border: 0.5px solid #B5D4F4; }
.alert svg     { width: 16px; height: 16px; flex-shrink: 0; }

/* ── LOGIN PAGE ───────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-box {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 2rem;
}
.login-logo .logo-mark { width: 36px; height: 36px; font-size: 14px; }
.login-logo strong { font-size: 15px; }
.login-logo span   { font-size: 12px; }

/* ── MESSAGES ─────────────────────────────── */
.message-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border);
}
.message-item:last-child { border-bottom: none; }
.message-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--coral-light); color: var(--coral);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.message-icon svg { width: 16px; height: 16px; }
.message-title { font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.message-body  { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.message-date  { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* ── PLANNING ─────────────────────────────── */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-head { font-size: 10.5px; text-align: center; color: var(--text-3); padding: 4px 0; text-transform: uppercase; letter-spacing: .05em; }
.cal-day  { aspect-ratio: 1; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12.5px; cursor: pointer; transition: background .1s; position: relative; }
.cal-day:hover    { background: var(--bg); }
.cal-day.today    { background: var(--coral); color: #fff; font-weight: 600; }
.cal-day.has-event { font-weight: 500; color: var(--coral); }
.cal-day.has-event::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--coral); position: absolute; bottom: 4px; }
.cal-day.other    { color: var(--text-3); }

/* ── MATERIEL GRID ────────────────────────── */
.materiel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.materiel-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: box-shadow .15s;
}
.materiel-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.materiel-img {
  height: 120px; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.materiel-img svg { width: 40px; height: 40px; color: var(--text-3); }
.materiel-info { padding: 14px; }
.materiel-name { font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }
.materiel-cat  { font-size: 11.5px; color: var(--text-3); margin-bottom: 10px; }
.dispo-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.dispo-dot.ok  { background: #63992A; }
.dispo-dot.non { background: #E24B4A; }

/* ── MOBILE ───────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    top: auto; bottom: 0; left: 0;
    width: 100%; height: auto;
    flex-direction: row;
    padding: .5rem .75rem;
    padding-bottom: calc(.5rem + env(safe-area-inset-bottom));
    border-right: none; border-top: 0.5px solid var(--border);
    overflow-x: auto; overflow-y: hidden;
    justify-content: space-around;
  }
  .sidebar-logo, .nav-section, .sidebar-bottom, .sidebar-user { display: none; }
  .nav-link { flex-direction: column; gap: 3px; padding: 6px 10px; font-size: 10px; min-width: 54px; text-align: center; }
  .nav-link svg { width: 20px; height: 20px; }
  .main { margin-left: 0; padding: 1.25rem 1rem; padding-bottom: 80px; }
  .page-header { flex-direction: column; gap: .75rem; }
  .form-row { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
}
