/* ============================================================
   calendrier.css — Styles du calendrier interactif
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────── */
:root {
  --color-martin:     #a8cfe0;
  --color-martin-f:   #7db8d4;
  --color-nath:       #e8bfc4;
  --color-nath-f:     #d4959d;
  --color-marc:       #b8d9a8;
  --color-marc-f:     #90c275;
  --color-releveg:    #f5e07a;
  --color-relevev:    #f0cc40;

  --bg:               #f2f4f8;
  --surface:          #ffffff;
  --surface-2:        #f8f9fb;
  --border:           #d8dce6;
  --border-strong:    #b0b8cc;
  --text:             #1a1f2e;
  --text-muted:       #6b7491;
  --accent:           #3a5fd9;
  --accent-hover:     #2e4db8;
  --danger:           #c0392b;
  --radius:           10px;
  --shadow:           0 4px 20px rgba(0,0,0,0.10);
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.07);
}

/* ── Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px 60px;
}

/* ── Wrapper ───────────────────────────────────────────── */
.app-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Barre navigation mois (remplace le header) ────────── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  box-shadow: var(--shadow-sm);
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.month-label {
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 200px;
  text-align: center;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

/* ── Tableau principal ─────────────────────────────────── */
.calendar-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 620px;
}

/* En-têtes */
.calendar-table thead th {
  background: #1a1f2e;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 6px;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.calendar-table thead th:first-child {
  border-radius: var(--radius) 0 0 0;
  text-align: left;
  padding-left: 14px;
}
.calendar-table thead th:last-child {
  border-radius: 0 var(--radius) 0 0;
}

/* Colonne noms */
.col-name {
  width: 80px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  white-space: nowrap;
  border-right: 2px solid var(--border-strong);
  background: var(--surface-2);
}
.emp-name {
  font-weight: 600;
  color: var(--text);
}

/* Ligne numéros de jours */
.row-days td.day-number {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 4px 2px;
  border-top: 2px solid var(--border-strong);
  background: var(--surface-2);
}
.row-days td.week-separator {
  border-top: 2px solid var(--border-strong);
}

/* Cellules employés */
.day-cell {
  height: 34px;
  text-align: center;
  vertical-align: middle;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  cursor: default;
  transition: filter 0.12s, outline 0.08s;
  position: relative;
  letter-spacing: 0.02em;
  color: rgba(0,0,0,0.55);
  user-select: none;
}

/* Hover seulement quand déverrouillé (pas readonly) */
.day-cell:not(.cell-readonly):not(.cell-empty-day):hover {
  filter: brightness(0.92);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 2;
  cursor: pointer;
}
.day-cell:not(.cell-readonly):not(.cell-empty-day):active {
  transform: scale(0.96);
}

.cell-empty-day {
  background: var(--bg);
  cursor: default;
}

/* ── Couleurs des statuts ─────────────────────────────── */
.cell-martin    { background: var(--color-martin); }
.cell-martin-f  { background: var(--color-martin-f); }
.cell-nath      { background: var(--color-nath); }
.cell-nath-f    { background: var(--color-nath-f); }
.cell-marc      { background: var(--color-marc); }
.cell-marc-f    { background: var(--color-marc-f); }
.cell-releveg   { background: var(--color-releveg); }
.cell-relevev   { background: var(--color-relevev); }

/* ── Select flottant ───────────────────────────────────── */
.floating-select {
  display: none;
  position: absolute;
  z-index: 1000;
  width: 220px;
  padding: 6px 8px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  cursor: pointer;
  outline: none;
  appearance: auto;
}

/* ── Footer ────────────────────────────────────────────── */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 10px;
}

/* Bouton cadenas */
.lock-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lock-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Bouton réinitialiser */
.reset-btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid #e0b0ae;
  background: #fdf0ef;
  color: var(--danger);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.reset-btn:hover {
  background: #fad7d5;
  border-color: var(--danger);
}

/* ── Modal login ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 14, 30, 0.55);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.30);
  width: 340px;
  max-width: 95vw;
  overflow: hidden;
  animation: slideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.modal-header {
  background: #1a1f2e;
  color: #fff;
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-body {
  padding: 22px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-group label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.field-group input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58,95,217,0.15);
}

.modal-error {
  font-size: 0.82rem;
  color: var(--danger);
  min-height: 18px;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 10px;
  padding: 14px 24px 20px;
}
.modal-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-cancel {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border) !important;
}
.btn-cancel:hover { background: var(--border); }
.btn-login {
  background: var(--accent);
  color: #fff;
}
.btn-login:hover { background: var(--accent-hover); }

/* Animation shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}
.modal-box.shake { animation: shake 0.45s ease; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .month-label { min-width: 130px; font-size: 0.95rem; }
  .col-name    { width: 60px; font-size: 0.74rem; padding: 3px 6px; }
  .day-cell    { height: 28px; font-size: 0.72rem; }
}

/* ── Barre de chargement ───────────────────────────────── */
#loadingBar {
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #7aa4ff, var(--accent));
  background-size: 200% 100%;
  animation: loadingSlide 1.2s linear infinite;
  border-radius: 2px;
}

@keyframes loadingSlide {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
