
.ai-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  padding: 20px;
  margin-left: 40px;
  background: var(--ai-container-bg);
  border-radius: 12px;
  color: hsl(0, 0%, 93%);
  font-family: 'Courier New', monospace;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  transition: background-color 0.3s ease;
}
.ai-output-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ai-notice {
  position: sticky;
  top: 0;
  z-index: 10;

  padding: 10px;
  margin-bottom: 10px;

  border-radius: 8px;

  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.9) 20%,
    rgba(0, 0, 0, 0.9) 50%,
    rgba(0, 0, 0, 0.9) 80%,
    rgba(0, 0, 0, 0)
  );

  color: #eee;
  text-align: center;
  font-size: clamp(14px, 2vw, 32px);
}

.ai-api-warning {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: clamp(40px, 10vw, 120px);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;

  color: rgb(255, 0, 0);
  text-align: center;
  pointer-events: none; /* 👈 allows interaction through it */

  animation: api-blink 2.5s ease-in-out infinite;
}
@keyframes api-blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.ai-output {
  position: absolute;
  inset: 0;
  flex: 1;
  /* background: var(--ai-output-bg); */
  background-image: url("/images/projects/google_and_local_ai/cpbg5.png");
  background-size: cover;       /* scales image proportionally to cover container */
  background-position: center;  /* keeps it centered */
  background-repeat: no-repeat; /* prevents tiling */
  padding: 12px;
  border-radius: 8px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 14px;
  transition: background-color 0.3s ease;





}
.ai-message {
  display: inline-block;       /* shrink-wrap the text */
  padding: 4px 8px;            /* space inside the bubble */
  border-radius: 26px;
  margin-bottom: 1em;          /* space between messages */
  margin-top: 50px;          /* space between messages */
  max-width: 80%;              /* optional: prevents overly wide bubbles */
  word-wrap: break-word;       /* wrap long words instead of stretching */
  font-size: clamp(14px, 2vw, 32px);
}
.ai-message.you {
  background: rgba(0, 255, 204, 0.15);
  color: #00ffcc;
  text-align: left;
  float: right;          /* user messages on the right */
  clear: both;           /* prevents overlap with previous messages */
  margin-top: 200px;
}
.ai-message.ai {
  background: rgba(255, 102, 255, 0.15);
  color: #ff66ff;
  text-align: left;
  float: left;           /* AI messages on the left */
  clear: both;
}

.ai-loading span {
  display: inline-block;
  animation: loading-wave 1s ease-in-out infinite;
}
@keyframes loading-wave {
  0%   { transform: translateY(0); }
  25%  { transform: translateY(-6px); }
  50%  { transform: translateY(0); }
  100% { transform: translateY(0); }
}

.ai-input-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-input-container input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 1.4em;
  background: var(--ai-output-bg);
  color: #eee;
  transition: background-color 0.3s ease;
}

/* Send and Clear History buttons */
.ai-input-container button:not(.clear-history-button) {
  padding: 10px 16px;
  background: var(--ai-buttons-and-scrollbar);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  font-size: 1.4em;
}
.ai-input-container button:hover {
  background: var(--ai-buttons-and-scrollbar-hover);
}
.ai-input-container .clear-history-button {
  padding: 8px 14px;
  background: rgb(148, 0, 0);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.4em;
  transition: 0.2s;
}
.ai-input-container .clear-history-button:hover {
  background: rgb(211, 18, 18);
}

/* Modal overlay asking for history clearence confirmation */
.ai-confirm-overlay {
  position: fixed;
  inset: 0; /* top/right/bottom/left 0 */
  background: rgba(0, 0, 0, 0.7); /* semi-transparent dark background */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999; /* on top of everything */
  pointer-events: all;
}
.ai-confirm-modal {
  background: #111;
  border: 2px solid var(--ai-confirm-clear-history); /* cyberpunk pink border */
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 80%;
  text-align: center;
  color: #fff;
  font-family: 'Courier New', monospace;
  box-shadow: 0 0 20px var(--ai-confirm-clear-history);
  animation: modal-fade-in 0.3s ease-out;
}
.ai-confirm-modal p {
  font-size: clamp(14px, 2vw, 32px);
  margin-bottom: 20px;
}
.ai-confirm-modal button {
  padding: 10px 20px;
  margin: 0 10px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  font-family: 'Courier New', monospace;
  font-size: clamp(14px, 2vw, 32px);
}
.ai-confirm-modal .yes-btn {
  background: var(--ai-confirm-clear-history-yes-bg);
  color: #fff;
}
.ai-confirm-modal .yes-btn:hover {
  background: var(--ai-confirm-clear-history-yes-bg-hover);
}
.ai-confirm-modal .no-btn {
  background: #222;
  color: var(--ai-confirm-clear-history-no);
  border: 1px solid var(--ai-confirm-clear-history-no);
}
.ai-confirm-modal .no-btn:hover {
  background: #333;
}
@keyframes modal-fade-in {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.ai-output::-webkit-scrollbar {
  width: 8px;
}
.ai-output::-webkit-scrollbar-thumb {
  background: var(--ai-buttons-and-scrollbar);
  border-radius: 3px;
}
.ai-output::-webkit-scrollbar-thumb:hover {
  background: var(--ai-buttons-and-scrollbar-hover);
}

@media (max-width: 1600px) {
  .ai-container {
    margin-left: 30px;
  }
}
@media (max-width: 1300px) {
  .ai-container {
    margin-left: 20px;
  }
}
@media (max-width: 1000px) {
  .ai-container {
    margin-left: 10px;
  }
}
@media (max-width: 900px) {
  .ai-container {
    margin-left: 0px;
  }

  .ai-input-container {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Input always full width (row 1) */
  .ai-input-container input {
    flex: 0 0 calc(100% - 20px);
    min-width: 0;          /* prevent overflow on small screens */
  }

  /* Buttons share row 2, 50% each minus gap */
  .ai-input-container button {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;          /* prevents shrinking issues */
  }
}
