:root {
  --afdm-pers1: #E8B4C5;
  --afdm-pers2: #9EBFEA;
  --afdm-pers3: #EFC49A;
  --afdm-pers4: #A8D5B5;
  --afdm-pers5: #C9B6E4;
  --afdm-event: #E06A6A;
  --afdm-note: #000000; /*DDE3E8*/
}

.afdm-planning-wrapper {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.afdm-planning-header,
.afdm-planning-nav {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.afdm-planning-nav {
  gap: 14px;
  white-space: nowrap;
  text-align: center;
}

.afdm-planning-week-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.afdm-planning-week-title {
  font-size: 18px;
  white-space: nowrap;
}

.afdm-planning-week-period {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 3px;
  white-space: nowrap;
}

.afdm-planning-table {
  width: 80%;
  margin: 18px auto 0;
  border-collapse: collapse;
  text-align: center;
  table-layout: fixed;
}

.afdm-planning-table th,
.afdm-planning-table td {
  border: 1px solid #ddd;
  padding: 10px 6px;
  box-sizing: border-box;
}

.afdm-planning-table th span:not(.afdm-day-slot) {
  display: block;
  font-size: 13px;
  font-weight: 400;
}

.afdm-day-indicators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.afdm-day-slot {
  display: inline-block !important;
  width: 10px !important;
  height: 10px !important;
  min-height: 10px !important;
  border-radius: 50% !important;
  background: #ddd;
  flex: 0 0 10px;
}

.afdm-planning-table th strong {
  display: block;
  font-size: 15px;
}

.afdm-day-select {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.afdm-planning-day-view {
  width: 80%;
  margin: 22px auto 0;
  border: 1px solid #ddd;
  border-radius: 0;
  overflow: hidden;
}

.afdm-day-view-header {
  padding: 12px 14px;
  background: #f7f7f7;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.afdm-day-hours {
  width: 100%;
}

.afdm-hour-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  min-height: 36px;
  border-top: 1px solid #eee;
}

.afdm-hour-label {
  padding: 8px;
  font-size: 13px;
  border-right: 1px solid #eee;
  background: #fafafa;
}

.afdm-hour-content {
  padding: 8px;
}

.afdm-selected-day {
  background: #f5e4e4;
  border-bottom: 2px solid #d91818;
}

.afdm-selected-day .afdm-day-select {
  font-weight: 600;
}

.afdm-planning-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #ddd;
  background: #fafafa;
}

.afdm-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.afdm-form-row label {
  font-size: 12px;
  font-weight: 600;
}

.afdm-form-row input,
.afdm-form-row select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}

.afdm-form-row-full {
  grid-column: span 3;
}

.afdm-planning-submit {
  align-self: end;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: #d91818;
  color: white;
  cursor: pointer;
}

.afdm-planning-submit:hover{
  background: #000;
}

.afdm-planning-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 14px;
  border-top: 1px solid #ddd;
  background: #fff;
  font-size: 12px;
}

.afdm-planning-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.afdm-planning-legend i {
  display: inline-block;
  width: 16px;
  height: 8px;
  border-radius: 3px;
}

.afdm-hour-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.afdm-hour-slot {
  min-height: 36px;
  border-right: 1px solid #eee;
}

.afdm-hour-slot:last-child {
  border-right: none;
}

.afdm-hour-slot {
  min-height: 36px;
  border-right: 1px solid #eee;
  transition: background 0.2s ease;
}

.afdm-hour-slot:not(:empty) {
  color: #fff;
}

.afdm-day-entries {
  border-top: 1px solid #ddd;
  background: #fff;
}

.afdm-day-no-entry {
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  color: #777;
}

.afdm-day-entry {
  display: grid;
  grid-template-columns: 18px 1fr auto 18px;
  column-gap: 8px;
  row-gap: 0;
  align-items: center;
  padding: 6px 14px;
  border-top: 1px solid #eee;
  font-size: 12px;
}

.afdm-day-entry-color {
  grid-column: 1;
  grid-row: 1 / 3;
  justify-self: center;
  align-self: start;
  margin-top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.afdm-day-entry strong {
  grid-column: 2;
  grid-row: 1;
  line-height: 1.2;
}

.afdm-day-entry span:not(.afdm-day-entry-color) {
  grid-column: 3;
  grid-row: 1;
  line-height: 1.2;
}

.afdm-day-entry em {
  grid-column: 2 / 4;
  grid-row: 2;
  margin: 0;
  padding: 0;
  font-style: normal;
  color: #666;
  font-size: 11px;
  line-height: 1.2;
}

.afdm-entry-delete {
  grid-column: 4;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  margin: 0;
}

.afdm-entry-delete:hover {
  color: #d9534f;
}

.afdm-day-entry:first-child {
  border-top: none;
}


.afdm-planning-list-box,
.afdm-planning-form-box {
  margin-bottom: 40px;
  padding: 30px 10px 30px 20px;
  box-shadow: 6px 6px 18px 0 rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  background: #fff;
}

.afdm-planning-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.afdm-planning-list-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.afdm-planning-list-actions a,
.afdm-planning-list-actions button {
  border: none;
  background: none;
  color: #474747;
  cursor: pointer;
  font-size: 15px;
}

.afdm-planning-list-actions a:hover,
.afdm-planning-list-actions button:hover {
  color: #d91818;
}

/* FORMULAIRE PLANNING */
#afdm-planning-config-form {
  width: 100%;
}

#afdm-planning-config-form label,
.afdm-planning-day-select-row span {
  display: block;
  font-size: 0.85em;
  color: #ff9999;
  font-weight: normal;
}

#afdm-planning-config-form input[type="text"],
#afdm-planning-config-form input[type="time"],
#afdm-planning-config-form select,
#afdm-planning-config-form textarea {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #474747;
  box-sizing: border-box;
  font-family: inherit;
}

#afdm-planning-config-form input[name="title"],
#afdm-planning-config-form textarea[name="welcome_message"] {
  width: 100%;
  max-width: 700px;
}

#afdm-planning-config-form textarea[name="welcome_message"] {
  resize: none;
}

.afdm-planning-config-section {
  margin-bottom: 30px;
}

.afdm-planning-config-section > label {
  margin-bottom: 30px;
}

.afdm-planning-section-title {
  margin: 30px 0 6px;
  font-weight: 600;
  color: #474747;
}

/* Horaires */

.afdm-planning-inline-fields {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.afdm-planning-inline-fields label {
  width: 120px;
}

.afdm-planning-inline-fields input[type="time"] {
  width: 110px;
}

/* Personnes */

.afdm-planning-add-person {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.afdm-planning-add-person label {
  width: 180px;
}

.afdm-planning-add-person input[type="text"] {
  width: 180px;
}

.afdm-planning-help {
  margin-top: 20px;
  font-weight: normal;
}

/* Responsables */
.afdm-planning-days-grid {
  width: 360px;
}

.afdm-planning-day-select-row {
  display: grid;
  grid-template-columns: 90px 220px;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.afdm-planning-day-select-row select {
  width: 220px;
  margin-top: 0 !important;
}

/* Boutons */
.afdm-planning-small-btn {
  align-self: center;
  margin-top: 22px;
  background: #d91818;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-weight: normal;
  cursor: pointer;
}

.afdm-planning-small-btn:hover {
    background: #000;
}

.afdm-planning-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 30px;
}

.afdm-planning-actions .afd-infos-submit,
.afdm-planning-delete-btn {
  min-width: 180px;
}


#afdm-planning-config-form[data-mode="create"] .afdm-planning-delete-btn {
  display: none;
}


.afdm-planning-persons-list {
  margin-top: 12px;
}

.afdm-planning-person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  color: #474747;
  font-size: 14px;
  font-weight: 600;
}

.afdm-planning-person-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

#afdm-planning-persons-container {
  margin-top: 15px;
}

/*Titre + message*/
.afdm-planning-public-msg {
  max-width: 760px;
  font-weight:600;
}

.afdm-planning-public-msg p {
  margin: 0;
}

.afdm-planning-share {
  position: relative;
}

.afdm-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);

  white-space: nowrap;

  padding: 6px 10px;

  background: #474747;
  color: #fff;

  border-radius: 6px;

  font-size: 12px;

  opacity: 0;
  pointer-events: none;

  transition: opacity .25s ease;
}

.afdm-planning-share:hover .afdm-tooltip {
  opacity: 1;
}


#afdm-planning-form .afdm-form-row-full {
  grid-column: span 2;
}

#afdm-planning-form #afdm-comment {
  max-width: 420px;
}

#afdm-entry-cancel-edit,
#afdm-entry-submit {
  max-width: 230px;
  width: 100%;
}


.afdm-whatsapp-box {
  width: 80%;
  margin: 20px auto 0;
  padding: 14px;
  border: 1px solid #ddd;
  background: #fff;
}

.afdm-whatsapp-title {
  margin: 0 0 10px;
  font-weight: 600;
}

.afdm-whatsapp-persons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 12px;
  font-size: 13px;
}

#afdm-wa-message {
  width: 100%;
  max-width: 100%;
  resize: none;
  margin-bottom: 12px;
  border-radius: 6px;  
  font-size: 13px;
}

.afdm-wa-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



@media (max-width: 767px) {
    .afdm-planning-public-title {
      font-size: 30px;
      line-height: 1.2;
    }

    .afdm-planning-public-msg {
      font-size: 13px;
      line-height: 1.3;
    }

    .afdm-planning-form-box {
      padding: 22px 12px;
    }

    .afdm-planning-config-section {
      margin-bottom: 24px;
    }

    .afdm-planning-config-section > label {
      margin-bottom: 22px;
    }

    .afdm-planning-section-title {
      margin: 22px 0 6px;
    }

    #afdm-planning-config-form input[name="title"],
    #afdm-planning-config-form textarea[name="welcome_message"] {
      width: 100%;
      max-width: 100%;
    }

    .afdm-planning-inline-fields {
      flex-direction: row;
      gap: 18px;
    }

    .afdm-planning-inline-fields label {
      width: 100px;
    }

    .afdm-planning-inline-fields input[type="time"] {
      width: 95px;
    }

    .afdm-planning-add-person {
      flex-direction: row;
      align-items: flex-end;
      gap: 8px;
    }

    .afdm-planning-add-person label {
      width: 150px;
    }

    .afdm-planning-add-person input[type="text"] {
      width: 150px;
    }

    .afdm-planning-small-btn {
      width: auto;
      min-width: 95px;
    }

    .afdm-planning-days-grid {
      width: 100%;
    }

    .afdm-planning-day-select-row {
      grid-template-columns: 1fr;
      gap: 4px;
      margin-bottom: 14px;
    }

    .afdm-planning-day-select-row select {
      width: 100%;
    }

    .afdm-planning-actions {
      flex-direction: column;
      align-items: stretch;
      gap: 12px;
    }

    .afdm-planning-actions .afd-infos-submit,
    .afdm-planning-delete-btn {
      width: 70%;
      min-width: 0;
    }

    .afdm-planning-nav {
      gap: 8px;
    }

    .afdm-planning-btn {
      padding: 6px 8px;
      font-size: 12px;
    }

    .afdm-planning-week-title {
      font-size: 14px;
    }

    .afdm-planning-week-period {
      font-size: 10px;
    }

    .afdm-planning-table {
      width: 100%;
      margin-top: 14px;
    }

    .afdm-planning-table th,
    .afdm-planning-table td {
      padding: 7px 2px;
    }

    .afdm-planning-table th span {
      font-size: 10px;
    }

    .afdm-planning-table th strong {
      font-size: 11px;
    }

    .afdm-planning-indicator {
      width: 7px;
      height: 7px;
    }

    .afdm-planning-day-view {
      width: 100%;
    }

    .afdm-day-view-header {
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      font-size: 13px;
    }

    #afdm-day-title,
    #afdm-day-responsable {
      white-space: nowrap;
    }

    #afdm-day-responsable {
      text-align: right;
    }

    .afdm-hour-row {
      grid-template-columns: 54px 1fr;
      min-height: 26px;
    }

    .afdm-hour-slot {
      min-height: 26px;
    }

    .afdm-hour-label {
      padding: 4px 5px;
      font-size: 11px;
    }

    .afdm-planning-form {
      grid-template-columns: 1fr 1fr;
    }

    .afdm-form-row-full {
      grid-column: span 2;
    }

    .afdm-planning-submit {
      grid-column: auto;
      width: 100%;
      max-width: 160px;
    }

    #afdm-entry-cancel-edit,
    #afdm-entry-submit {
      max-width: 160px;
    }

    /*  LISTE DES PLANNINGS*/
    .afdm-planning-list-box,
    .afdm-planning-form-box {
      padding: 20px 12px;
      margin-bottom: 25px;
    }

    .afdm-planning-list-item {
      flex-direction: column;
      align-items: flex-start;
      font-size: 12px;
      gap: 10px;
    }

    .afdm-planning-list-actions {
      width: 100%;
      justify-content: flex-start;
      gap: 18px;
    }

    .afdm-planning-list-actions a,
    .afdm-planning-list-actions button {
      font-size: 12px;
    }

    .afdm-planning-actions {
      flex-direction: column;
      align-items: stretch;
      gap: 12px;
    }

    .afdm-planning-actions .afd-infos-submit,
    .afdm-planning-delete-btn {
      width: 100%;
      min-width: 0;
    }

    /* Commentaire : pleine largeur sur mobile */
    #afdm-planning-form .afdm-form-row-full {
      grid-column: span 2;
    }

    #afdm-planning-form #afdm-comment {
      width: 100%;
      max-width: 100%;
    }

    /* Boutons moins larges mais centrés */
    #afdm-entry-cancel-edit,
    #afdm-entry-submit {
      width: 100%;
      max-width: 160px;
      justify-self: center;
    }

    /* Points semaine plus petits sur mobile */
    .afdm-day-indicators {
      gap: 3px;
      min-height: 11px;
      overflow: hidden;
    }

    .afdm-day-slot {
      width: 7px !important;
      height: 7px !important;
      min-height: 7px !important;
      flex: 0 0 7px;
    }

    .afdm-whatsapp-box {
      width: 100%;
    }

    #afdm-wa-message {
      max-width: 100%;
    }
}