/* Import Google Font - Poppins */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

:root {
  --text-color: #ffffff;
  --subheading-color: #ffd6d6;
  --placeholder-color: #ffffff;
  --primary-color: #fff5f5;
  --secondary-color: #ff4d4d;
  --secondary-hover-color: #e60000;
  --scrollbar-color: #ff6666;
}

body.light-theme {
  --text-color: #1a1a1a;
  --subheading-color: #b34747;
  --placeholder-color: #8c8c8c;
  --primary-color: #fffafa;
  --secondary-color: #ffe6e6;
  --secondary-hover-color: #ffc2c2;
  --scrollbar-color: #ff9999;
}

body {
  color: var(--text-color);
  background: var(--primary-color);
  transition: background 0.4s ease, color 0.4s ease;
  margin-left: 100px;
}

.container {
  overflow-y: auto;
  padding: 32px 0 60px;
  height: calc(100vh - 127px);
  scrollbar-color: var(--scrollbar-color) transparent;
}

.container::-webkit-scrollbar {
  height: 6px;
}
.container::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-color);
  border-radius: 6px;
}

.container :where(.app-header, .suggestions, .message, .prompt-wrapper) {
  position: relative;
  margin: 0 auto;
  width: 100%;
  padding: 0 20px;
  max-width: 990px;
}

.container .app-header {
  margin-top: 3vh;
}

.app-header .heading {
  width: fit-content;
  font-size: 3rem;
  background: linear-gradient(to right, #ff7b7b, #ffcccc);
  background-clip: text;              
  -webkit-background-clip: text;      
  -webkit-text-fill-color: transparent;
  animation: fadeInDown 0.6s ease-out;
}


.app-header .sub-heading {
  font-size: 2.6rem;
  margin-top: -5px;
  color: var(--subheading-color);
  animation: fadeInUp 0.6s ease-out;
}

.container .suggestions {
  display: flex;
  list-style: none;
  gap: 15px;
  margin-top: 9.5vh;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

body.chats-active .container :where(.app-header, .suggestions) {
  display: none;
}

.suggestions .suggestions-item {
  cursor: pointer;
  padding: 18px;
  width: 228px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  scroll-snap-align: center;
  border-radius: 16px;
  background: var(--secondary-color);
  box-shadow: 0 4px 12px rgba(255, 77, 77, 0.2);
  transition: 0.3s ease;
}
.suggestions .suggestions-item:hover {
  background: var(--secondary-hover-color);
  transform: translateY(-4px);
}

.suggestions .suggestions-item .text {
  font-size: 1.1rem;
}
.suggestions .suggestions-item .icon {
  width: 45px;
  height: 45px;
  display: flex;
  font-size: 1.4rem;
  margin-top: 35px;
  align-self: flex-end;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background-color: #005fa3;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
.suggestions .suggestions-item:nth-child(2) .icon {
  background-color: #28a745;
}
.suggestions .suggestions-item:nth-child(3) .icon {
  background-color: #ffc107;
}
.suggestions .suggestions-item:nth-child(4) .icon {
  background-color: #6f42c1;
}

.container .chats-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chats-container .message {
  display: flex;
  gap: 11px;
  align-items: center;
}
.chats-container .message .avatar {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  align-self: flex-start;
  border-radius: 50%;
  padding: 6px;
  margin-right: -7px;
  background: var(--secondary-color);
  border: 2px solid var(--secondary-hover-color);
}
.chats-container .message.loading .avatar {
  animation: pulse 1.2s infinite ease-in-out;
}

.chats-container .message .message-text {
  padding: 10px 16px;
  word-wrap: break-word;
  white-space: pre-line;
  border-radius: 12px;
}

.chats-container .bot-message {
  margin: 9px auto;
}
.chats-container .user-message {
  flex-direction: column;
  align-items: flex-end;
}
.chats-container .user-message .message-text {
  max-width: 75%;
  background: #ff9999;
  border-radius: 13px 13px 3px 13px;
  box-shadow: 0 2px 10px rgba(255, 102, 102, 0.3);
}

.chats-container .user-message .img-attachment,
.chats-container .user-message .file-attachment {
  margin-top: -7px;
  border-radius: 13px 3px 13px 13px;
}
.chats-container .user-message .img-attachment {
  width: 50%;
}
.chats-container .user-message .file-attachment {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px;
  background: #ffd6d6;
}
.chats-container .user-message .file-attachment span {
  color: #cc0000;
}

.container .prompt-container {
  position: fixed;
  width: 100%;
  left: 0;
  bottom: 0;
  padding: 16px 0;
  background: var(--primary-color);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.prompt-container :where(.prompt-wrapper, .prompt-form, .prompt-actions) {
  display: flex;
  gap: 12px;
  height: 56px;
  align-items: center;
}

.prompt-container .prompt-form {
  height: 100%;
  width: 100%;
  border-radius: 130px;
  background: var(--secondary-color);
  box-shadow: inset 0 0 5px rgba(255, 77, 77, 0.2);
}

.prompt-form .prompt-input {
  width: 100%;
  height: 100%;
  background: none;
  outline: none;
  border: none;
  font-size: 1rem;
  color: var(--text-color);
  padding-left: 24px;
}
.prompt-form .prompt-input::placeholder {
  color: var(--placeholder-color);
}

.prompt-wrapper button {
  width: 56px;
  height: 100%;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 50%;
  font-size: 1.4rem;
  border: none;
  color: var(--text-color);
  background: var(--secondary-color);
  transition: 0.3s ease;
}
.prompt-wrapper button:hover {
  background: var(--secondary-hover-color);
  transform: scale(1.05);
}

.prompt-form .prompt-actions {
  gap: 5px;
  margin-right: 7px;
}

.prompt-wrapper .prompt-form :where(.file-upload-wrapper, button, img) {
  position: relative;
  height: 45px;
  width: 45px;
}

.prompt-form .prompt-actions #send-prompt-btn {
  color: #fff;
  display: none;
  background: #cc0000;
}
.prompt-form .prompt-input:valid ~ .prompt-actions #send-prompt-btn {
  display: block;
}
.prompt-form #send-prompt-btn:hover {
  background: #ff0000;
}

.prompt-form .file-upload-wrapper :where(button, img) {
  display: none;
  border-radius: 50%;
  object-fit: cover;
  position: absolute;
}
.prompt-form .file-upload-wrapper.active #add-file-btn {
  display: none;
}
.prompt-form .file-upload-wrapper #add-file-btn,
.prompt-form .file-upload-wrapper.active.img-attached img,
.prompt-form .file-upload-wrapper.active.file-attached .file-icon,
.prompt-form .file-upload-wrapper.active:hover #cancel-file-btn {
  display: block;
}
.prompt-form :is(#stop-response-btn:hover, #cancel-file-btn) {
  color: #cc0000;
}
.prompt-wrapper .prompt-form .file-icon {
  color: #e60000;
}
.prompt-form #stop-response-btn,
body.bot-responding .prompt-form .file-upload-wrapper {
  display: none;
}
body.bot-responding .prompt-form #stop-response-btn {
  display: block;
}

/* Animații */
@keyframes fadeInDown {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px 0 100px;
  }
  .app-header :is(.heading, .sub-heading) {
    font-size: 2rem;
    line-height: 1.4;
  }
  .app-header .sub-heading {
    font-size: 1.7rem;
  }
  .container .chats-container {
    gap: 15px;
  }
  .chats-container .bot-message {
    margin: 4px auto;
  }
  .prompt-container :where(.prompt-wrapper, .prompt-form, .prompt-actions) {
    gap: 8px;
    height: 53px;
  }
  .prompt-container button {
    width: 53px;
  }
  .prompt-form :is(.file-upload-wrapper, button, img) {
    height: 42px;
    width: 42px;
  }
  .prompt-form .prompt-input {
    padding-left: 20px;
  }
  .prompt-form .file-upload-wrapper.active #cancel-file-btn {
    opacity: 0;
  }
  .prompt-wrapper.hide-controls :where(#theme-toggle-btn, #delete-chats-btn) {
    display: none;
  }
}


.chat-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 87vh;
  background: #ff7272;
  color: white;
  padding: 1rem;
  overflow-y: auto;
  z-index: 999;
  border-right: 1px solid #ffc2c2;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
/* Când este activ, apare */
.chat-sidebar.active {
  transform: translateX(0);
}

/* Butonul de toggle conversații */
.chat-sidebar-toggle {
  position: fixed;
  top: 90px;
  left: 50px;
  height: 50px;
    width: 50px;
  top: 620px; 
  z-index: 1100;
  background-color: #cc00aa;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.chat-sidebar-toggle:hover {
  background-color: #a30088;
}


.chat-sidebar h2 {
  margin-top: 0;
  font-size: 18px;
}

#saved-conversations {
  list-style: none;
  padding: 0;
}

#saved-conversations li {
  padding: 0.5rem;
  border-bottom: 1px solid #ffc2c2;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#saved-conversations li:hover {
  background-color: #ff0000;
}

#save-chat-btn {
  position: fixed;
  top: 20px;
  right: 10px;
  background: #cc00aa;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 1000;
}

#save-chat-btn:hover {
  background: #005fa3;
}


.copy-btn {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  margin-left: 10px;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.copy-btn:hover {
  color: #000;
}


.scroll-icon {
  position: fixed;
  bottom: 100px;
  right: 20px;
  font-size: 50px;
  color: #e91e63; /* roz */
  background: none;
  border: none;
  cursor: pointer;
  display: none; /* inițial ascuns */
  z-index: 1000;
  background-color: #ea76c9;
  border-radius: 50%;
}
/* LIGHT/DARK SWITCHER */
#theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-size: 1.8rem;
  background: #fff;
    color: #8b0000;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 10000;
  transition: background-color 0.3s ease;
}

#theme-toggle:hover {
  background-color: #8b0000;
  color: #fff;
}

body.dark {
  background: linear-gradient(to right, #3b0a0a, #5a1f1f);
  color: white;
}

body.dark .main-content {
  background: rgba(255,255,255,0.05);
}

body.dark .sidebar {
  background: #3a0f0f;
  color: #eee;
}

body.dark .sidebar li:hover {
  background-color: #ffffff22;
  color: #fff;
}

/* LOADER CORTINĂ CU ADN */
#loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  
}

#loader-left, #loader-right {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background-image: url('assets/poze/fundal_rosu.png');
  background-repeat: no-repeat;
  background-size: 200% 100%;
  z-index: 2;
  transition: all 1s ease;
}

#loader-left {
  left: 0;
  background-position: left center;
}

#loader-right {
  right: 0;
  background-position: right center;
}

#loader-center {
  position: relative;
  z-index: 3;
  text-align: center;
  color: white;
}

.site-title {
  font-size: 3rem;
  margin-bottom: 20px;
  
  color: #ffebf0;
  text-shadow: 2px 2px 8px #4f88e1;
}

#rotating-adn {
  width: 100px;
  height: 100px;
  animation: rotateADN 3s linear infinite;
  filter: drop-shadow(0 0 10px #ff4040);
}

@keyframes rotateADN {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loader-close #loader-left {
  transform: translateX(-100%);
}
.loader-close #loader-right {
  transform: translateX(100%);
}
.loader-close #loader-center {
  opacity: 0;
  transition: opacity 0.4s ease;
}
