/* planning.css - Styles specifiques a la page planning */

body { max-width: 1400px; }

/* === Current week banner === */
.current-week-banner {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.current-week-banner:empty { display: none; }
.current-week-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  padding: 14px 20px;
  text-align: center;
  min-width: 200px;
  flex: 1;
  max-width: 350px;
}
.current-week-card.active {
  border-color: #2d5fa1;
  border-width: 2px;
  box-shadow: 0 2px 8px rgba(45, 95, 161, 0.15);
}
.current-week-card .card-label {
  font-size: 0.75em;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.current-week-card .card-elu {
  font-size: 1.3em;
  font-weight: bold;
}
.current-week-card .card-dates {
  font-size: 0.8em;
  color: #666;
  margin-top: 4px;
}

/* === Info sections === */
.vacances-info {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.vacances-info h3 { font-size: 0.9em; margin-bottom: 8px; color: #1a365d; }
.vacances-info .vac-list { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8em; }
.vacances-info .vac-item { padding: 4px 10px; border-radius: 6px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.vacances-info .ferie-item { padding: 4px 10px; border-radius: 6px; background: #fef9c3; border: 1px solid #fde68a; color: #92400e; }
.vacances-info .pm-item { padding: 4px 10px; border-radius: 6px; background: #ffedd5; border: 1px solid #fed7aa; color: #9a3412; }

/* === Warnings (collapsible) === */
.warnings {
  margin-bottom: 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
}
.warnings h3 {
  font-size: 0.85em;
  margin-bottom: 0;
  color: #92400e;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.warnings h3::before { content: '\25B8'; font-size: 0.8em; transition: transform 0.2s; }
.warnings.open h3::before { transform: rotate(90deg); }
.warnings ul { list-style: none; padding: 0; display: none; margin-top: 8px; column-count: 2; column-gap: 16px; }
.warnings.open ul { display: block; }
.warnings li { font-size: 0.78em; padding: 2px 0; color: #92400e; break-inside: avoid; }
@media (max-width: 600px) { .warnings ul { column-count: 1; } }

/* === Legend === */
.legend {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.legend h3 { font-size: 0.9em; margin-bottom: 8px; color: #1a365d; }
.legend-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.8em; padding: 4px 10px; border-radius: 6px; font-weight: 500; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* === Annual view === */
.annual-container { overflow-x: auto; margin-bottom: 16px; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.annual-table {
  border-collapse: collapse;
  background: white;
  width: 100%;
  min-width: 900px;
  font-size: 0.78em;
}
.annual-table thead { background: #1a365d; color: white; }
.annual-table th {
  padding: 10px 6px;
  font-size: 1em;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.3px;
  min-width: 90px;
}
.annual-table th:first-child { min-width: 36px; width: 36px; background: #0f2847; }
.annual-table td {
  padding: 4px 3px;
  text-align: center;
  border: 1px solid #edf2f7;
  height: 28px;
  white-space: nowrap;
  transition: opacity 0.1s;
}
.annual-table td.day-label {
  font-weight: 800;
  color: #1a365d;
  background: #f1f5f9;
  font-size: 0.95em;
  border-right: 2px solid #cbd5e0;
  position: sticky;
  left: 0;
  z-index: 2;
}
.annual-table td.empty { background: #f8fafc; }
.annual-table td.weekend { font-style: italic; opacity: 0.8; }
.annual-table td.ferie { box-shadow: inset 0 0 0 2px #f59e0b; }
.annual-table td.before-start { background: #f1f5f9; color: #cbd5e0; }
.annual-table td .elu-short { font-weight: 600; display: block; line-height: 1.3; }
.annual-table td .day-info { font-size: 0.8em; color: #94a3b8; display: block; line-height: 1; }
.annual-table td.vacances-cell { position: relative; }
.annual-table td.vacances-cell::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-top: 5px solid #10b981;
  border-left: 5px solid transparent;
}
.annual-table tbody tr:hover td:not(.day-label) { opacity: 0.8; }
/* Sticky header */
.annual-table thead th { position: sticky; top: 0; z-index: 3; }

/* === Coverage column === */
.coverage-header { min-width: 42px !important; font-size: 0.85em !important; }
.coverage-cell {
  font-weight: 800;
  font-size: 0.95em;
  text-align: center;
  min-width: 42px !important;
  border-left: 2px solid #94a3b8 !important;
  border-bottom: none !important;
}
.coverage-week-start { border-top: 2px solid rgba(0,0,0,0.2) !important; }
.coverage-ok { background: #dcfce7; color: #166534; }
.coverage-warn { background: #fef9c3; color: #854d0e; }
.coverage-critical { background: #fee2e2; color: #991b1b; font-weight: 900; }

/* === Weekly table === */
.planning-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.planning-table thead { background: #1a365d; color: white; }
.planning-table th { padding: 10px 8px; font-size: 0.85em; text-align: left; font-weight: 600; }
.planning-table td { padding: 8px; font-size: 0.85em; border-bottom: 1px solid #f1f5f9; }
.planning-table tr:last-child td { border-bottom: none; }
.planning-table tr:hover { background: #f8fafc; }
.planning-table .week-num { font-weight: 800; color: #2d5fa1; text-align: center; width: 50px; }
.planning-table .date-range { white-space: nowrap; color: #475569; }
.planning-table .elu-cell { font-weight: 600; padding: 6px 12px; border-radius: 6px; }
.planning-table .ideal-cell { font-size: 0.8em; color: #94a3b8; }
.planning-table .substituted { background: #fffbeb; }
.planning-table .sub-info { font-size: 0.78em; color: #92400e; margin-left: 4px; }
.planning-table .vacances-row { background: #f0fdf4; }
.planning-table .ferie-note { font-size: 0.75em; color: #94a3b8; display: block; }
.split-indicator { font-size: 0.75em; color: #f59e0b; font-weight: 600; white-space: nowrap; }

/* === Summary === */
.summary {
  margin-top: 16px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.summary h2 { margin-bottom: 10px; font-size: 1em; color: #1a365d; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85em;
}
.summary-item .elu-name { display: flex; align-items: center; gap: 6px; }
.summary-item .elu-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.summary-item .stats { text-align: right; font-weight: 600; }

.equity {
  margin-top: 10px;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.85em;
  color: #475569;
}
.equity strong { color: #1a365d; }

/* === Mon planning view === */
.my-next {
  background: white;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  border-left: 5px solid;
}
.my-stats {
  text-align: center;
  font-size: 0.88em;
  color: #64748b;
  margin-bottom: 16px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
}
.my-weeks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.my-week-card {
  background: white;
  border-radius: 8px;
  padding: 10px 14px;
  border-left: 4px solid;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.1s;
}
.my-week-card:hover { transform: translateX(2px); }
.my-week-card.past { opacity: 0.45; }
.my-week-card .badge {
  font-size: 0.72em;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.my-week-card .badge.upcoming { background: #dcfce7; color: #166534; }
.my-week-card .badge.past { background: #f1f5f9; color: #94a3b8; }
.my-maybe-note {
  text-align: center;
  margin-top: 14px;
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 0.88em;
  color: #92400e;
}
.my-maybe-note a { color: #2d5fa1; font-weight: 600; text-decoration: underline; }

/* === Webcal subscribe section === */
.webcal-subscribe {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  text-align: left;
}
.webcal-subscribe p { margin: 0 0 8px 0; font-size: 0.9em; }
.webcal-url-row { display: flex; gap: 8px; }
.webcal-url-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
}
.btn-copy {
  padding: 6px 14px;
  border: 1px solid #2d5fa1;
  background: #2d5fa1;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}
.webcal-hint { color: #777; font-size: 0.8em; margin-top: 6px; }

/* === Disponibilites view === */
.dispo-section { margin-bottom: 14px; }
.dispo-section h4 {
  font-size: 0.88em;
  margin-bottom: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
}
.dispo-available h4 { background: #dcfce7; color: #166534; }
.dispo-uncertain h4 { background: #fef9c3; color: #854d0e; }
.dispo-unavailable h4 { background: #fee2e2; color: #991b1b; }
.dispo-list { list-style: none; padding: 0; }
.dispo-list li {
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88em;
  border-bottom: 1px solid #f1f5f9;
}
.dispo-list li:last-child { border-bottom: none; }
.dispo-list .elu-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dispo-assigned { font-weight: 700; }
.dispo-assigned::after { content: ' \2605'; font-size: 0.9em; color: #f59e0b; }

/* === Edit mode === */
.planning-editable { cursor: pointer; }
.planning-editable:hover { outline: 2px solid #2d5fa1; outline-offset: -2px; border-radius: 4px; }
.manual-indicator {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  margin-left: 4px;
  vertical-align: middle;
}
.elu-select-popup {
  position: absolute;
  z-index: 20;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  min-width: 160px;
  max-width: 320px;
}
.elu-select-popup button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85em;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.1s;
}
.elu-select-popup button:hover { background: #f1f5f9; }
#btn-edit-planning.active { background: #27ae60; color: white; border-color: #27ae60; }
.swap-source {
  outline: 3px solid #f39c12 !important;
  outline-offset: -2px;
  animation: swap-pulse 1s infinite;
}
@keyframes swap-pulse {
  0%, 100% { outline-color: #f39c12; }
  50% { outline-color: rgba(243, 156, 18, 0.3); }
}
.popup-header { padding: 8px 10px; border-bottom: 1px solid #eee; margin-bottom: 6px; }
.popup-title { font-size: 0.8em; color: #888; }
.popup-subtitle { font-size: 0.9em; margin-top: 2px; }
.popup-elu-list { padding: 0 4px; }
.popup-accordion { border-top: 1px solid #eee; margin-top: 6px; }
.popup-accordion-toggle { padding: 8px 10px; font-size: 0.85em; color: #2d5fa1; cursor: pointer; user-select: none; }
.popup-accordion-toggle::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.2s;
}
.popup-accordion.open .popup-accordion-toggle::before {
  transform: rotate(90deg);
}
.popup-accordion-content { display: none; padding: 4px; }
.popup-accordion.open .popup-accordion-content { display: block; }
.popup-accordion-content button {
  display: block; width: 100%; text-align: left;
  padding: 6px 10px; border: none; background: #f8fafc;
  margin: 2px 0; border-radius: 4px; cursor: pointer; font-size: 0.85em;
}
.popup-accordion-content button:hover { background: #e9ecef; }
.relay-panel, .single-day-panel {
  padding: 8px 4px;
  border-top: 1px solid #eee;
}
.relay-panel label, .single-day-panel label {
  display: block;
  font-size: 0.85em;
  color: #666;
  margin: 8px 0 4px;
}
.popup-back-btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-top: 8px;
  border: none;
  background: #e9ecef;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  font-family: inherit;
}
.popup-back-btn:hover { background: #dee2e6; }
.popup-elu-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

/* === Echanges section === */
.echanges-section {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
  overflow: hidden;
}
.echanges-section h3 {
  padding: 14px 16px;
  font-size: 0.92em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1a365d;
  user-select: none;
  transition: background 0.1s;
}
.echanges-section h3:hover { background: #f8fafc; }
.echanges-section h3::before { content: '\25B8'; transition: transform 0.2s; font-size: 0.8em; }
.echanges-section.open h3::before { transform: rotate(90deg); }
.echanges-content { display: none; padding: 0 16px 16px; }
.echanges-section.open .echanges-content { display: block; }
.echanges-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.echanges-form select {
  padding: 7px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.85em;
  font-family: inherit;
}
.echanges-form button {
  padding: 7px 16px;
  background: #2d5fa1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.echanges-form button:hover { background: #1e4a82; }
.echange-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-left: 4px solid;
  transition: transform 0.1s;
}
.echange-card:hover { transform: translateX(2px); }
.echange-card .echange-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.echange-card .echange-elu { font-weight: 700; color: #1a365d; }
.echange-card .echange-week { font-size: 0.85em; color: #64748b; }
.echange-card .echange-date { font-size: 0.75em; color: #94a3b8; }
.echange-card .echange-reponses { font-size: 0.85em; margin-top: 6px; color: #475569; }
.echange-card .echange-actions { margin-top: 8px; display: flex; gap: 6px; }
.echange-card .echange-actions button {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid;
  background: white;
  cursor: pointer;
  font-size: 0.8em;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}
.echange-card .echange-actions .btn-take { border-color: #22c55e; color: #166534; }
.echange-card .echange-actions .btn-take:hover { background: #22c55e; color: white; }
.echange-card .echange-actions .btn-close { border-color: #cbd5e0; color: #94a3b8; }
.echange-card .echange-actions .btn-close:hover { background: #f1f5f9; }
.echange-card.fermee { opacity: 0.4; border-left-color: #e2e8f0; }
#echanges-count { font-size: 0.78em; color: #ef4444; font-weight: 600; margin-left: 4px; }

/* === Planning status badge === */
.planning-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 8px;
}
.planning-badge.published { background: #d4efdf; color: #1e7e34; }
.planning-badge.draft { background: #fdebd0; color: #b8860b; }
.planning-badge.draft-modified { background: #fdebd0; color: #d35400; }
.planning-badge.not-published { background: #e5e8e8; color: #636e72; }

/* === Responsive === */
@media (max-width: 600px) {
  body { padding: 10px; }
  .planning-table { font-size: 0.8em; }
  .planning-table th, .planning-table td { padding: 6px 4px; }
  .summary-grid { grid-template-columns: 1fr; }
  .annual-table { font-size: 0.65em; }
  .annual-table td { padding: 2px 1px; }
  .annual-table th { font-size: 0.85em; padding: 6px 2px; min-width: 55px; }
  .my-weeks { grid-template-columns: 1fr; }
  .echanges-form { flex-direction: column; }
  .nav { gap: 4px; }
  .nav-sep { display: none; }
  .elu-select-popup {
    left: 10px !important;
    right: 10px;
    width: auto !important;
    max-width: none;
  }
  .popup-accordion-toggle { padding: 12px 10px; }
}
