html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: inherit;
}

.chatgpt-container {
  border: 1px solid #ccc;
  margin: 10px auto;
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0px 0px 10px #aaa;
}

.chatgpt-container h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.chatgpt-container form {
  padding: 5px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

.chatgpt-container input,
.ccgpt-input {
  padding: 10px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: #fff;
}

.chatgpt-container input:focus,
.ccgpt-input:focus {
  border-color: #4267b2;
  box-shadow: 0 0 0 3px rgba(66, 103, 178, 0.1);
  outline: none;
}

.chatgpt-container textarea,
.ccgpt-textarea {
  padding: 10px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: #fff;
  resize: vertical;
  font-family: inherit;
}

.chatgpt-container textarea:focus,
.ccgpt-textarea:focus {
  border-color: #4267b2;
  box-shadow: 0 0 0 3px rgba(66, 103, 178, 0.1);
  outline: none;
}

.chatgpt-submit,
.ccgpt-button {
  background-color: #1fbd7b;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  padding: 10px 20px;
  transition: background-color 0.3s;
}
.chatgpt-submit:hover,
.ccgpt-button:hover {
  background-color: #1d885b;
}
.chatgpt-submit:active,
.ccgpt-button:active {
  transform: translateY(2px);
}

.chatgpt-container p {
  margin: 1px;
  font-size: 1rem;
  padding: 0.5em 0;
}

.chatgpt-container .chatgpt-output {
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.chatgpt-container .bot-message,
.chatgpt-container .your-message {
  max-width: 85%;
  padding: 10px;
  border-radius: 10px;
  margin: 5px;
  width: fit-content;
}
.chatgpt-container .bot-message {
  background-color: #f2f2f2;
  color: black;
  align-self: flex-start;
}
.chatgpt-container .your-message {
  background-color: #0084ff;
  color: white;
  align-self: flex-end;
}

@keyframes dots {
  0% {
    content: "";
  }
  33% {
    content: ".";
  }
  66% {
    content: "..";
  }
  100% {
    content: "...";
  }
}
.chatgpt-container .dots:after {
  display: inline-block;
  animation: dots 1s infinite;
  content: "...";
}

.chatgpt-container .chatgpt-title {
  font-size: 1.6rem;
  font-weight: bold;
  text-align: center;
  background-color: #4267b2;
  color: #ffffff;
  padding: 8px;
  border-radius: 8px 8px 0 0;
}

.chatgpt-container .animate-background {
  animation: background 0.5s ease-in-out infinite alternate;
}
@keyframes background {
  0% {
    background: #0084ff;
  }
  50% {
    background: #86a8c9;
  }
  100% {
    background: #f2f2f2;
  }
}

.chatgpt-container .bot-message pre {
  background-color: #2e3440;
  border-radius: 4px;
  color: #d8dee9;
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
  line-height: 1.4;
  margin: 1em 0;
  overflow: auto;
  padding: 0.2em;
  white-space: pre;
}

@media only screen and (max-width: 768px) {
  .chatgpt-container {
    margin: 0;
    padding: 0;
  }
  .chatgpt-container h2 {
    font-size: 20px;
    margin-bottom: 5px;
  }
  .chatgpt-container input,
  .ccgpt-input {
    padding: 8px;
    font-size: 14px;
    width: 100%;
  }
  .chatgpt-submit,
  .ccgpt-button {
    font-size: 14px;
  }
  .chatgpt-container .your-message,
  .chatgpt-container .bot-message {
    max-width: 100%;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 5px;
  }
  .chatgpt-container .chatgpt-title {
    margin-bottom: 10px;
  }
  .chatgpt-container button span {
    display: none;
  }
  #chatgpt-help-form label,
  #chatgpt-help-form select {
    flex-basis: 100% !important;
    flex: none;
  }
}

#chatgpt-help-form {
  background-color: #f6f6f6;
  border: 1px solid #ccc;
  padding: 5px;
  width: 100%;
  margin: 0 auto;
}
#chatgpt-help-form label,
#chatgpt-help-form select {
  display: block;
  margin-bottom: 5px;
}
#chatgpt-help-form textarea {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}
#chatgpt-help-form input[type="submit"] {
  background-color: #2cce8a;
  color: white;
  border: none;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  border-radius: 5px;
}

#chatgpt-form-output {
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 5px;
  width: 100%;
  margin: 0 auto;
  margin-top: 20px;
}
#chatgpt-form-output b {
  color: #2cce8a;
}

.chatgpt-container .input-group {
  display: flex;
  flex-wrap: wrap;
}
.chatgpt-container .input-field {
  flex: 1;
}

.chatgpt-container button {
  padding: 4px;
}
.chatgpt-container .button-group {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}
.chatgpt-container .token-alert {
  margin-left: auto;
}

.chatgpt-container .icon {
  display: inline-flex;
  align-self: center;
  height: 16px;
  width: 16px;
}
.chatgpt-container .icon svg,
.chatgpt-container .icon img {
  height: 16px;
  width: 16px;
  fill: none;
  /*top: 0.125em;*/
  position: relative;
}

.chatgpt-container .error-container {
  background-color: #ffcccc;
  color: #ff0000;
  font-size: 14px;
  padding: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.chatgpt-container .error-container.active {
  opacity: 1;
  transform: translateY(0);
}

.chatgpt-title {
  background-color: #0a49b3 !important;
}

/* Modal Styles */
.ccgpt-modal,
.ccgpt-context-modal,
#ccgpt-image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.5);
}

/* Désactiver le scroll du body quand la modal est ouverte */
body.ccgpt-modal-open {
  overflow: hidden;
}

.ccgpt-modal-content,
.ccgpt-context-modal-content,
#ccgpt-image-modal-content,
#ccgpt-modal-content {
  background-color: #ffffff;
  border: 1px solid #ccc;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  width: 600px;
  max-width: 90%;
  border-radius: 10px;
  box-shadow: 0px 0px 10px #aaa;
}

/* Styles responsive pour mobile */
@media (max-width: 768px) {
  .ccgpt-modal-content,
  .ccgpt-context-modal-content,
  #ccgpt-image-modal-content,
  #ccgpt-modal-content {
    padding: 15px;
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .ccgpt-image-modal-title {
    font-size: 18px;
  }

  .ccgpt-modal-title {
    font-size: 20px;
  }

  .ccgpt-form {
    padding: 0;
  }

  .ccgpt-form input[type="text"],
  .ccgpt-form textarea {
    font-size: 16px; /* Évite le zoom sur iOS */
    padding: 12px;
  }

  .ccgpt-form button {
    padding: 12px 15px;
    font-size: 14px;
  }

  .ccgpt-label {
    font-size: 14px;
    margin-bottom: 5px;
  }
}

/* Amélioration des labels et formulaires */
.ccgpt-label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  font-size: 15px;
}

/* Styles spécifiques pour les modals */
.ccgpt-modal .ccgpt-input,
.ccgpt-context-modal .ccgpt-input,
#ccgpt-image-modal .ccgpt-input {
  width: 100%;
  box-sizing: border-box;
}

.ccgpt-modal textarea,
.ccgpt-context-modal textarea,
#ccgpt-image-modal textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 100px;
}

/* Amélioration du contraste pour les placeholders */
.ccgpt-input::placeholder,
.ccgpt-textarea::placeholder {
  color: #888;
  opacity: 1;
}

/* Styles spécifiques pour la modal de contexte */
.ccgpt-context-modal-title {
  font-size: 20px;
  font-weight: bold;
  color: #4267b2;
  margin: 0;
  flex-grow: 1;
}

.ccgpt-context-close-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.ccgpt-context-info {
  background-color: #f0f4ff;
  border: 1px solid #d0d9f0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #4267b2;
}

.ccgpt-context-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.ccgpt-context-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.ccgpt-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: #333;
}

.ccgpt-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4267b2;
}

.ccgpt-context-enable-container {
  display: flex;
  align-items: center;
}

/* Responsive pour la modal de contexte */
@media (max-width: 768px) {
  .ccgpt-context-controls {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .ccgpt-context-enable-container {
    justify-content: center;
  }

  .ccgpt-context-modal-title {
    font-size: 18px;
  }
}

/* Styles améliorés pour tous les champs de formulaire du plugin */
input[type="text"].input-field,
input[type="email"].input-field,
input[type="number"].input-field,
select.input-field,
textarea.input-field {
  padding: 10px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: #fff;
  font-family: inherit;
}

input[type="text"].input-field:focus,
input[type="email"].input-field:focus,
input[type="number"].input-field:focus,
select.input-field:focus,
textarea.input-field:focus {
  border-color: #4267b2;
  box-shadow: 0 0 0 3px rgba(66, 103, 178, 0.1);
  outline: none;
}

/* Amélioration des labels dans tout le plugin */
label {
  font-weight: 500;
  color: #333;
  margin-bottom: 5px;
}

/* Style pour les select */
select.input-field {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 32px;
}

.ccgpt-close,
.ccgpt-context-close,
.ccgpt-image-close {
  color: #555;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.ccgpt-close:hover,
.ccgpt-close:focus,
.ccgpt-context-close:hover,
.ccgpt-context-close:focus,
.ccgpt-image-close:hover,
.ccgpt-image-close:focus {
  color: black;
  text-decoration: none;
}

.ccgpt-close-container {
  display: flex;
  flex-direction: row-reverse;
}

.ccgpt-image-close-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px; /* Optional padding for better spacing */
}

.ccgpt-image-close {
  position: relative;
  right: -3px;
  top: -16px;
  font-size: 24px;
  cursor: pointer;
  color: #333;
}

.ccgpt-image-modal-title {
  font-size: 20px;
  font-weight: bold;
  color: #4267b2;
  margin: 0;
}

.ccgpt-modal-title {
  color: #4267b2;
  font-size: 24px;
  margin-bottom: 10px;
  text-align: center;
}
.ccgpt-modal-description {
  color: #333;
  font-size: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.ccgpt-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ccgpt-label {
  font-size: 16px;
  margin-bottom: 5px;
}

.ccgpt-image-usage-info {
  text-align: center;
  margin-top: 20px;
  font-family: monospace;
}

.ccgpt-progress-bar {
  width: 100%;
  background-color: #c0e4d4;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1px;
}
.ccgpt-progress {
  width: 0%;
  height: 10px;
  background-color: #2dce89;
}

.spinner {
  border: 16px solid #f3f3f3;
  border-top: 16px solid #3498db;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 2s linear infinite;
  margin: 10px auto;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Download Button Styles */
.ccgpt-download-button {
  display: flex;
  align-items: center;
  background-color: #fffefb;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 10px;
  justify-content: space-between;
}
.ccgpt-download-button:hover {
  border: 1px solid #85c2f8;
}

.ccgpt-download-icon {
  width: 70%;
  max-width: 300px;
}

#ccgpt-generated-image {
  border-radius: 8px;
  margin-right: 10px;
  width: 100px;
}

#ccgpt-image-prompt {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-top: 10px;
  background-color: #f6f6f6;
}

#ccgpt-info-text {
  margin-top: 10px;
  font-size: 0.8em;
  background-color: #32486e;
  color: #ffffff;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #0a48b3;
}

.ccgpt-btn {
  display: inline-block !important;
  font-weight: 400 !important;
  text-align: center !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
  user-select: none !important;
  background-color: transparent !important;
  border: 1px solid transparent !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
  border-radius: 0.25rem !important;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
  cursor: pointer !important;
}

.ccgpt-btn:hover {
  text-decoration: none !important;
}

.ccgpt-btn-primary {
  color: #fff !important;
  background-color: #0a48b3 !important;
  border-color: #0a48b3 !important;
}

.ccgpt-btn-primary:hover {
  color: #fff !important;
  background-color: #083d9b !important;
  border-color: #072c8b !important;
}

.ccgpt-btn-success {
  color: #fff !important;
  background-color: #2dce89 !important;
  border-color: #2dce89 !important;
}

.ccgpt-btn-success:hover {
  color: #fff !important;
  background-color: #28b77a !important;
  border-color: #239e6c !important;
}

.ccgpt-btn-light {
  color: #212529 !important;
  background-color: #f8f9fa !important;
  border-color: #f8f9fa !important;
}

.ccgpt-btn-light:hover {
  color: #212529 !important;
  background-color: #e2e6ea !important;
  border-color: #dae0e5 !important;
}

.ccgpt-btn-sm {
  padding: 0.25rem 0.5rem !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  border-radius: 0.2rem !important;
}

@media (max-width: 768px) {
  .ccgpt-download-button {
    flex-direction: column;
    align-items: center;
  }

  .ccgpt-generated-image {
    margin: 0 0 10px 0;
  }
}
.ced-chatgpt-token-usage {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  font-family: Arial, sans-serif;
}
.ced-chatgpt-usage-title {
  margin-top: 0;
  color: #495057;
  margin-bottom: 10px;
}
.ced-chatgpt-token-info {
  margin-bottom: 10px;
}
.ced-chatgpt-token-ratio {
  font-size: 1.2em;
  font-weight: bold;
  color: #212529;
  margin: 5px 0;
}
.ced-chatgpt-token-progress {
  background-color: #e9ecef;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 5px;
}
.ced-chatgpt-progress-bar {
  background-color: #007bff;
  height: 100%;
  transition: width 0.5s ease-in-out;
}
.ced-chatgpt-token-percentage {
  text-align: right;
  font-size: 0.9em;
  color: #6c757d;
  margin: 0;
}

/* Tableau de statistiques avec scroll horizontal */
.toplevel_page_tokens-used .wp-list-table {
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}

.toplevel_page_tokens-used .wp-list-table table {
  min-width: 100%;
  width: max-content;
}

.toplevel_page_tokens-used .wp-list-table th,
.toplevel_page_tokens-used .wp-list-table td {
  white-space: nowrap;
  padding: 8px 10px;
  min-width: 80px;
}

.toplevel_page_tokens-used .wp-list-table th:first-child,
.toplevel_page_tokens-used .wp-list-table td:first-child {
  position: sticky;
  left: 0;
  background-color: #f1f1f1;
  z-index: 10;
}

.toplevel_page_tokens-used .wp-list-table tbody tr:hover th:first-child,
.toplevel_page_tokens-used .wp-list-table tbody tr:hover td:first-child {
  background-color: #e8e8e8;
}

/* Conteneur pour le scroll horizontal */
.tokens-usage-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Style pour les entêtes de colonnes */
.toplevel_page_tokens-used .wp-list-table th {
  background-color: #f9f9f9;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
}

/* Amélioration de la lisibilité */
.toplevel_page_tokens-used .wp-list-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.toplevel_page_tokens-used .wp-list-table tbody tr:hover {
  background-color: #f1f1f1;
}

/* Token usage table: enable horizontal scroll when too many columns */
.tokens-usage-table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.tokens-usage-table-container .wp-list-table {
  min-width: 2200px;
}
