/* Structure globale */
.whatsapp-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: #0b141a url('https://prime.creasite.ch/wp-content/uploads/2025/03/bg.png') center center / cover no-repeat fixed;
}

/* Header et Footer */
.whatsapp-wrapper > .whatsapp-header,
.whatsapp-footer {
  background: #005e54;
  color: #fff;
  text-align: left;
  padding: 0;
  flex: 0 0 auto;
}

.whatsapp-wrapper > .whatsapp-header {
  position: sticky;
  top: 0;
  z-index: 12000;
  width: 100%;
  left: 0;
  right: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.whatsapp-header h2,
.whatsapp-footer p {
  margin: 0;
}

.cs-header-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background-color: #075e54;
  overflow-x: auto;
  white-space: normal;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  -webkit-overflow-scrolling: touch;
}

.cs-header-row::-webkit-scrollbar {
  display: none;
}

.cs-header-block {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 12px;
  padding: 7px 10px;
  font-weight: 600;
  font-size: 14px;
  flex: 0 0 auto;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .cs-header-row {
    padding: 8px 10px;
    gap: 6px;
  }

  .cs-header-block {
    font-size: 11px;
    padding: 6px 8px;
  }
}

@media (max-width: 480px) {
  .cs-header-row {
    gap: 5px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .cs-header-block {
    font-size: 10px;
    padding: 5px 7px;
  }
}

@media (max-width: 360px) {
  .cs-header-block {
    font-size: 9px;
    padding: 3px 5px;
  }
}

.cs-header-label {
  background: rgba(255, 255, 255, 0.18);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-header-block.cs-total-main {
  background: rgba(255, 255, 255, 0.24);
}

.cs-gtranslate select {
  color: #000;
}

.cs-gtranslate-login {
  margin-bottom: 10px;
}

.cs-gtranslate-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Contenu principal responsive */
.whatsapp-container {
  max-width: 780px;
  margin: 0 auto;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  padding: 0 14px;
  flex-grow: 1;
  overflow-y: auto;
  box-sizing: border-box;
  padding-bottom: 80px;
  width: 100%;
  position: relative;
}

.whatsapp-load-indicator {
  width: 100%;
  text-align: center;
  padding: 6px 10px;
  color: #f1f1f1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Séparateur de date */
.whatsapp-date-separator {
  text-align: center;
  margin: 10px 0;
  font-size: 0.85em;
  color: #777;
}

/* Messages */
.whatsapp-message {
  display: flex;
  align-items: flex-end;
  margin: 6px 0 14px 0;
  gap: 6px;
}
.whatsapp-message-left { justify-content: flex-start; }
.whatsapp-message-right { justify-content: flex-end; }

.whatsapp-avatar {
  margin-right: 0px;
}
.whatsapp-avatar img {
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.whatsapp-content {
  background-color: #d9fdd3;
  padding: 9px 10px 18px 10px;
  border-radius: 10px;
  max-width: 78%;
  width: auto;
  position: relative;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
  color: #111b21;
}
.whatsapp-message-left .whatsapp-content {
  background-color: #ffffff;
}
.whatsapp-message-right .whatsapp-content {
  background-color: #d9fdd3;
}
.whatsapp-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 12px;
  height: 10px;
  background-repeat: no-repeat;
  background-position: center;
}
.whatsapp-message-left .whatsapp-content::after {
  left: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M12 0C7.5 5.5 3.5 8 0 8c2.5-1 4-3.5 4-6C4 1 4.5 0 6 0h6Z' fill='%23ffffff'/%3E%3C/svg%3E");
}
.whatsapp-message-right .whatsapp-content::after {
  right: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M0 0c4.5 5.5 8.5 8 12 8C9.5 7 8 4.5 8 2 8 1 7.5 0 6 0H0Z' fill='%23d9fdd3'/%3E%3C/svg%3E");
}

.whatsapp-message .whatsapp-header {
  font-size: 0.9em;
  color: #555;
  margin-bottom: 5px;
}

.whatsapp-body {
  font-size: 0.95em;
  color: #111b21;
  margin-bottom: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.whatsapp-title {
  font-size: 0.9em;
  margin: 0 0 5px;
}

.whatsapp-prestation-image {
  width: 100%;
  max-width: 240px !important;
  display: block;
  margin: 8px 0 6px;
  cursor: pointer;
  transition: transform 0.3s;
  border-radius: 10px;
}
.whatsapp-prestation-image:hover {
  transform: scale(1.05);
}

.whatsapp-price {
  font-weight: bold;
  color: #333;
  margin-top: 5px;
}

.whatsapp-date {
  display: none;
}
.whatsapp-time {
  position: absolute;
  bottom: 5px;
  right: 10px;
  font-size: 12px;
  color: #667781;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

/* Footer - Boutons */
.whatsapp-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  background: #005e54;
  height: 80px;
}

/* Boutons d’action */
.whatsapp-add-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 6px;
  gap: 6px;
  border: none;
  color: white;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  min-width: 80px;
  transition: background-color 0.2s ease;
}

/* Modals */
.whatsapp-modal,
.whatsapp-add-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 13000;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.whatsapp-modal img {
  max-width: 90%;
  max-height: 90%;
}
.whatsapp-modal-close {
  position: absolute;
  top: 20px; right: 30px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
}
.whatsapp-add-modal-content {
  background: #ece5dd;
  width: 90%;
  max-width: 500px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  position: relative;
  margin: 60px auto;
  box-sizing: border-box;
  z-index: 13001;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.whatsapp-add-modal-close {
  position: absolute;
  top: 7px; right: 20px;
  cursor: pointer;
  font-size: 30px;
  color: #333;
}
.whatsapp-add-modal h3 {
  margin-top: 0;
  font-size: 1.1em;
  margin-bottom: 10px;
  text-align: center;
}

/* Formulaires */
#whatsapp-add-prestation-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
#whatsapp-add-prestation-form .title-field,
#caisse-form .title-field {
  display: none;
}
#whatsapp-add-prestation-form input[type='text'],
#whatsapp-add-prestation-form select {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
}
#whatsapp-add-prestation-form input[type='file'] {
  margin-bottom: 10px;
}

form#whatsapp-add-bar-form,
form#caisse-form {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-content: space-between;
  justify-content: space-around;
  align-items: stretch;
  font-family: sans-serif;
}

form#caisse-form label, form#whatsapp-add-bar-form label, form#whatsapp-add-prestation-form label{
  margin-top: 10px;
  margin-bottom: 4px;
  font-weight: 500;
  color: #333;
}

form#caisse-form input[type="number"],
form#caisse-form select,
form#caisse-form textarea,
form#caisse-form input[type="file"],


#whatsapp-add-bar-form select, #whatsapp-add-bar-form textarea, #whatsapp-add-bar-form input[type="file"], #whatsapp-add-bar-form input[type="number"],
#whatsapp-add-prestation-form select, #whatsapp-add-prestation-form textarea, #whatsapp-add-prestation-form input[type="file"], #whatsapp-add-prestation-form input[type="number"]


{ 
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.whatsapp-add-modal-submit {
  display: block;
  margin-left: auto;
  padding: 10px 20px;
  background-color: #25D366;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.whatsapp-add-modal-submit:hover {
  background-color: #1ebe5d;
  transform: translateY(-1px);
}

/* Login */
.whatsapp-login-form {
  max-width: 400px;
  margin: 50px auto;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-family: sans-serif;
}
.whatsapp-login-form label {
  display: block;
  margin-bottom: 5px;
}
.whatsapp-login-form input[type='text'],
.whatsapp-login-form input[type='password'] {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.whatsapp-login-form input[type='submit'] {
  background: #25D366;
  color: #fff;
  padding: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
}

/* Divers */
.whatsapp-excluded {
  text-align: center;
  font-size: 20px;
  height: auto;
  padding: 25px;
}
p {
  margin-block-start: 0px !important;
  margin-block-end: 0px !important;
}

[type=button], [type=submit], button {
  font-weight: 400;
  color: #ffffff !important;
  text-align: center;
  white-space: nowrap;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: #005e54 !important;
  padding: .5rem 1rem;
  font-size: 1rem;
  border-radius: 5px;
  transition: all .3s;
  display: flex;
  flex-direction: row;
  align-content: flex-start;
  align-items: flex-end;
  justify-content: flex-start;
}

[type=button]:focus, [type=button]:hover, [type=submit]:focus, [type=submit]:hover, button:focus, button:hover {
  color: #fff;
  background-color: rgb(76 175 80 / 74%) !important;
  text-decoration: none;
}

/* Responsive */
@media only screen and (max-width: 600px) {
  .whatsapp-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 8px;
    border: none;
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 80px;
    height: calc(100vh - 120px);
    overflow-y: auto;
  }
  .whatsapp-header,
  .whatsapp-footer {
    padding: 8px;
    font-size: 1em;
  }
  .whatsapp-total,
  .cs-status {
    font-size: 0.9em;
  }
  .whatsapp-add-button {
    padding: 8px 16px;
    font-size: 0.8em;
  }
  .whatsapp-content {
    max-width: 90%;
    padding: 8px 8px 16px 8px;
    font-size: 0.9em;
  }
  .whatsapp-avatar img {
    width: 30px;
    height: 30px;
  }
  .whatsapp-message {
    margin: 5px 0 10px 0;
  }
  .whatsapp-add-modal-content {
    width: 100%;
    max-width: none;
    padding: 14px;
    margin: 20px 0;
    max-height: calc(100vh - 60px);
  }
  .whatsapp-add-modal h3 {
    font-size: 1em;
  }
  form#caisse-form label,
  form#whatsapp-add-bar-form label,
  form#whatsapp-add-prestation-form label {
    font-size: 13px;
  }
  form#caisse-form textarea,
  #whatsapp-add-bar-form textarea,
  #whatsapp-add-prestation-form textarea,
  form#caisse-form input,
  #whatsapp-add-bar-form input,
  #whatsapp-add-prestation-form input,
  form#caisse-form select,
  #whatsapp-add-bar-form select,
  #whatsapp-add-prestation-form select {
    font-size: 14px;
  }
  .whatsapp-add-modal-submit {
    width: 100%;
    font-size: 15px;
    padding: 10px;
  }
}

@media only screen and (max-width: 420px) {
  .whatsapp-add-modal {
    align-items: flex-start;
    overflow-y: auto;
  }
  .whatsapp-add-modal-content {
    margin: 16px 0;
    padding: 12px;
    border-radius: 10px;
    max-height: calc(100vh - 32px);
  }
  .whatsapp-add-modal h3 {
    font-size: 0.95em;
  }
  form#caisse-form label,
  form#whatsapp-add-bar-form label,
  form#whatsapp-add-prestation-form label {
    font-size: 12px;
  }
  form#caisse-form textarea,
  #whatsapp-add-bar-form textarea,
  #whatsapp-add-prestation-form textarea,
  form#caisse-form input,
  #whatsapp-add-bar-form input,
  #whatsapp-add-prestation-form input,
  form#caisse-form select,
  #whatsapp-add-bar-form select,
  #whatsapp-add-prestation-form select {
    font-size: 13px;
    padding: 9px;
  }
}
