/* ============================================================
   IAMSHIBA – Calendrier de saisie des temps (vue mensuelle)
   ============================================================ */

.iamshiba-timesheet {
  margin-top: 16px;
  padding: 18px 20px 16px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  font-size: 12px;
}

/* -------- Toolbar -------- */

.iamshiba-timesheet__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.iamshiba-timesheet__title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.ts-total-label {
  font-weight: 500;
  color: #6b7280;
  font-size: 11px;
}

.iamshiba-timesheet__toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* -------- Toolbar LEFT (user select) -------- */

.iamshiba-timesheet__toolbar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #4b5563;
}

.iamshiba-timesheet__user-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.iamshiba-ts-user-select {
  min-width: 160px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #ffffff;
  font-size: 11px;
  color: #111827;
}

.iamshiba-ts-user-select:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.25);
  border-color: #0071e3;
}

.iamshiba-timesheet__current-user {
  font-size: 11px;
  font-weight: 500;
  color: #4b5563;
}

.iamshiba-timesheet__readonly-badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #f9fafb;
  font-size: 10px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}

/* -------- Badge statut -------- */

.iamshiba-timesheet__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.ts-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
  white-space: nowrap;
}

.ts-status--submitted {
  background: #eef2ff;
  color: #4338ca;
}

.ts-status--validated {
  background: #dcfce7;
  color: #166534;
}

/* =====================================
   NAVIGATION MOIS – EPURÉE
   ===================================== */

.iamshiba-timesheet__nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eeeff4;
}

.iamshiba-ts-nav-btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  color: #111827;
  transition: background 0.15s ease, color 0.15s ease;
}

.iamshiba-ts-nav-btn:focus {
  outline: none;
}

.iamshiba-ts-nav-btn:hover {
  background: rgba(17, 24, 39, 0.12);
}

.iamshiba-ts-nav-btn--active {
  font-weight: 600;
  color: #111827;
}

/* =====================================
   BOUTON TOGGLE "PASSER EN SAISIE"
   ===================================== */

.iamshiba-ts-edit-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #ffffff;
  color: #111827;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.iamshiba-ts-edit-toggle:hover {
  background: #f3f4f6;
}

.iamshiba-ts-edit-toggle.is-on {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.28);
}

/* =====================================
   GROUPE D’ACTIONS – STYLE APPLE
   ===================================== */

.iamshiba-timesheet__actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: #eeeff4;
  gap: 4px;
}

.iamshiba-ts-action {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #111827;
  white-space: nowrap;
  z-index: 1;
  transition: color 0.18s ease;
}

.iamshiba-ts-action::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  z-index: -1;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.iamshiba-ts-action.is-default {
  color: #ffffff;
}

.iamshiba-ts-action.is-default::before {
  background: #111827;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.28);
}

.iamshiba-timesheet__actions:hover .iamshiba-ts-action.is-default {
  color: #111827;
}

.iamshiba-timesheet__actions:hover .iamshiba-ts-action.is-default::before {
  background: transparent;
  box-shadow: none;
}

.iamshiba-ts-action:hover {
  color: #ffffff;
}

.iamshiba-ts-action:hover::before {
  background: #111827;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.28);
}

/* -------- Loading -------- */

.iamshiba-timesheet__loading {
  padding: 10px 0 4px;
  font-size: 12px;
  color: #6b7280;
}

/* -------- Grille + scroll -------- */

.iamshiba-timesheet__grid-wrapper {
  width: 100%;
  overflow-x: auto;
}

.iamshiba-timesheet__grid {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Première colonne sticky */

.iamshiba-timesheet__grid .sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #f9fafb !important;
  background-clip: padding-box;
  box-shadow: 4px 0 8px rgba(15, 23, 42, 0.06);
}

/* -------- En-tête -------- */

.iamshiba-timesheet__col-type {
  width: 160px;
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  color: #4b5563;
  border-bottom: 1px solid rgba(148, 163, 184, 0.7);
  background: #f9fafb;
}

.iamshiba-timesheet__col-day {
  width: 60px;
  text-align: center;
  padding: 4px 0 3px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.7);
  border-right: 1px solid #f3f4f6;
}

.ts-day-dow {
  font-size: 9px;
  color: #9ca3af;
  line-height: 1.1;
}

.ts-day-date {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  line-height: 1.2;
}

/* -------- Corps -------- */

.iamshiba-timesheet__cell-type {
  padding: 5px 10px;
  font-size: 12px;
  color: #374151;
  border-bottom: 1px solid rgba(229, 231, 235, 0.95);
  background: #f9fafb;
  white-space: normal;
}

.iamshiba-timesheet__col-type,
.iamshiba-timesheet__cell-type,
.ts-total-label.sticky-col {
  max-width: 180px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.iamshiba-timesheet__cell {
  padding: 5px 0;
  text-align: center;
  border-bottom: 1px solid rgba(229, 231, 235, 0.95);
  border-right: 1px solid #f3f4f6;
  background: #ffffff;
  vertical-align: middle;
}

/* -------- Inputs -------- */

.ts-input {
  box-sizing: border-box;
  width: 44px;
  max-width: 44px;
  height: 28px;
  margin: 0 auto;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 300;
  text-align: center;
  border-radius: 5px;
  border: 1px dashed rgba(209, 213, 219, 0.9);
  background: #ffffff;
  outline: none;
}

.ts-input[readonly] {
  background: #f9fafb;
  cursor: default;
}

.ts-input:not([readonly]):focus {
  border-style: solid;
  border-color: #0071e3;
  box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.25);
}

/* -------- Week-end / fériés -------- */

.iamshiba-timesheet__col-day.is-weekend,
.iamshiba-timesheet__cell.is-weekend {
  background-color: #f3f4f6 !important;
}

.iamshiba-timesheet__col-day.is-holiday,
.iamshiba-timesheet__cell.is-holiday {
  background-color: #fef3f2 !important;
}

.iamshiba-timesheet__cell.is-weekend .ts-input,
.iamshiba-timesheet__cell.is-holiday .ts-input {
  color: #9ca3af !important;
  background: #f3f4f6;
}

/* -------- Totaux -------- */

.ts-total-cell {
  padding: 4px 0 6px;
  text-align: center;
  background: #ffffff;
  border-right: 1px solid #f3f4f6;
}

.ts-hours--total {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.9);
  background: rgba(224, 242, 254, 0.85);
  font-size: 11px;
  color: #0f172a;
  white-space: nowrap;
}

.ts-total-cell.is-weekend .ts-hours--total,
.ts-total-cell.is-holiday .ts-hours--total {
  background-color: #e5e7eb !important;
  border-color: rgba(148, 163, 184, 0.9) !important;
  color: #9ca3af !important;
}

.iamshiba-timesheet__col-day,
.iamshiba-timesheet__cell,
.ts-total-cell {
  text-align: center !important;
  vertical-align: middle !important;
}

/* ====== Libellé de ligne + infobulle ====== */

.ts-row-label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.ts-row-label-main {
  display: block;
  max-width: 140px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.25;
}

.ts-row-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: #111827;
  color: #f9fafb;
  cursor: help;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12);
}

/* Bouton "8h" */

.ts-row-fill {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #ffffff;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  color: #111827;
  line-height: 1.4;
}

.ts-row-fill:hover {
  background: #111827;
  color: #ffffff;
}

/* Bouton supprimer ligne */

.ts-row-delete {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 4px;
  color: #9ca3af;
}

.ts-row-delete:hover {
  color: #ef4444;
}

/* Select type */

.ts-row-type-select {
  width: 100%;
  max-width: 160px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #ffffff;
}

.ts-row-type-select:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.25);
  border-color: #0071e3;
}

/* Wrapper input + bouton max */

.ts-cell-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ts-fill-max-btn {
  position: absolute;
  left: 2px;
  bottom: 2px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  border: none;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.06);
  color: #4b5563;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.ts-fill-max-btn.is-hidden {
  display: none !important;
}

.iamshiba-timesheet__cell:hover .ts-fill-max-btn:not(.is-hidden) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-1px);
}

.ts-fill-max-btn:hover {
  background: rgba(15, 23, 42, 0.12);
}

/* ====== Légende week-end / jours fériés ====== */

.iamshiba-timesheet__legend {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  font-size: 10px;
  color: #6b7280;
}

.ts-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ts-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(148, 163, 184, 0.9);
}

.ts-legend-color--weekend {
  background-color: #f3f4f6;
}

.ts-legend-color--holiday {
  background-color: #fef3f2;
}

/* ============================
   Responsive toolbar
   ============================ */

@media (max-width: 1100px) {
  .iamshiba-timesheet__toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .iamshiba-timesheet__toolbar-left,
  .iamshiba-timesheet__toolbar-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .iamshiba-ts-edit-toggle,
  .iamshiba-ts-action {
    padding: 6px 12px;
  }
}

/* Mode compact : icônes type favicon */

@media (max-width: 900px) {

  .iamshiba-ts-edit-toggle,
  .iamshiba-ts-action {
    padding: 6px;
    min-width: 30px;
    font-size: 0;
    border-radius: 999px;
  }

  .iamshiba-ts-edit-toggle::before,
  .iamshiba-timesheet__actions .iamshiba-ts-action::before {
    font-size: 13px;
    line-height: 1;
    display: inline-block;
  }

  /* Toggle : crayon */
  .iamshiba-ts-edit-toggle::before {
    content: "✏️";
  }

  /* Actions:
     1 = Ajouter (+)
     2 = Sauvegarder (💾)
     3 = Soumettre (✓)
  */
  .iamshiba-timesheet__actions .iamshiba-ts-action:nth-child(1)::before {
    content: "+";
  }

  .iamshiba-timesheet__actions .iamshiba-ts-action:nth-child(2)::before {
    content: "💾";
  }

  .iamshiba-timesheet__actions .iamshiba-ts-action:nth-child(3)::before {
    content: "✓";
  }
}
