* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding: 2rem 1rem 1rem 1rem;
  box-sizing: border-box;
}

body {
  font-family: 'Raleway', sans-serif;
  background: linear-gradient(to bottom, #0a0818, #12122b);
  display: grid;
  grid-template-columns: 80px 1fr;
  grid-template-rows: 1fr;
  height: 100vh;
  min-height: 100vh;
  color: #e6e6ff;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

#sidebar {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: 100vh;
  width: 250px;
  background-color: rgba(18, 15, 36, 0.85);
  border-right: 1px solid rgba(123, 104, 238, 0.3);
  position: sticky;
  top: 0;
  align-self: start;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 100;
}

#sidebar.close {
  width: 60px;
}

.sidebar-header {
  flex-shrink: 0;
  padding: 5px 1em 0 1em;
  z-index: 102;
  border-bottom: 1px solid rgba(123, 104, 238, 0.2);
  margin-bottom: 8px;
}

#sidebar.close .sidebar-header {
  padding: 5px;
}

.logo-row {
  font-size: 1.4rem;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.logo-row .logo {
  font-weight: 400;
}

.chat-list-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 1em;
  margin-bottom: 10px;
  position: relative;
  z-index: 101;
}

#sidebar.close .chat-list-container {
  padding: 0 5px;
}

#sidebar:hover {
  overflow: hidden;
}

.chat-list-container:hover {
  overflow-y: auto;
}

.chat-list-container::-webkit-scrollbar {
  width: 6px;
}

.chat-list-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-list-container::-webkit-scrollbar-thumb {
  background: rgba(123, 104, 238, 0.4);
  border-radius: 3px;
}

.chat-list-container::-webkit-scrollbar-thumb:hover {
  background: rgba(123, 104, 238, 0.6);
}

#sidebar-footer {
  flex-shrink: 0;
  padding: 1.2rem 0 0.8rem 0;
  width: 100%;
  text-align: center;
  background: inherit;
  border-top: 1px solid rgba(123, 104, 238, 0.2);
  z-index: 102;
  position: relative;
}

.sidebar-footer-text {
  color: #a9a9ff;
  font-size: 0.85rem;
  padding: 0 1rem;
  word-break: break-word;
  white-space: normal;
  line-height: 1.3;
  display: block;
}

.sidebar-footer-copyright {
  color: #a9a9ff;
  font-size: 1.1rem;
  display: none;
  margin-top: 0.5rem;
}

#sidebar.close .sidebar-footer-text {
  display: none;
}

#sidebar.close .sidebar-footer-copyright {
  display: block;
}

#sidebar a,
#sidebar .dropdown-btn,
#sidebar .logo {
  border-radius: .5em;
  padding: .85em;
  text-decoration: none;
  color: #dcdcff;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar a:hover,
#sidebar .dropdown-btn:hover {
  background: rgba(123, 104, 238, 0.15);
  transform: translateX(2px);
}

.dropdown-btn {
  cursor: pointer;
  width: 100%;
  background: none;
  text-align: left;
  border: none;
  font-family: 'Raleway', sans-serif;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar svg {
  flex-shrink: 0;
  fill: #dcdcff;
}

#sidebar a:hover svg,
#sidebar .dropdown-btn:hover svg {
  fill: #ffffff;
}

#toggle-btn {
  margin-left: auto;
  padding: 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  position: relative;
  z-index: 104;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

#toggle-btn svg {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#toggle-btn.rotated svg {
  transform: rotate(180deg);
}

#toggle-btn:hover {
  background-color: #2a2a5a;
}

#sidebar.close .btn-text,
#sidebar.close .chat-title {
  display: none;
}

#sidebar.close .chat-item {
  display: none;
}

#sidebar.close #add-chat-btn {
  display: flex !important;
}

#sidebar.close #add-chat-btn .btn-icon {
  display: block !important;
}

#placeholder-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 650px;
  height: 170px;
  padding: 3px;
  position: relative;
  top: 0;
  margin-top: 8rem;
}

.placeholder-box {
  margin: 0;
}

.placeholder-left {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.placeholder-box {
  border-radius: 12px;
  border: 1px solid rgba(123, 104, 238, 0.4);
}

.inner-box {
  width: 100%;
  height: 35%;
  background-color: #1a1830;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 15px 25px;
  color: #e6e6ff;
  position: absolute;
  bottom: 0;
  box-sizing: border-box;
}

.inner-box .box-icon {
  width: 40px;
  height: 40px;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
}

.inner-box .box-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  top: -3px;
}

.inner-box .box-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.inner-box .box-subtitle {
  font-size: 0.75rem;
  color: rgba(230, 230, 255, 0.7);
}

.placeholder-box:hover {
  transform: translateY(-8px) rotate(1.5deg);
  transition: all 0.3s ease-in-out;
}

.grid-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: 40px 40px;
  background-image: radial-gradient(circle, rgba(123, 104, 238, 0.1) 1px, transparent 1px);
  opacity: 0.2;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.dynamic-quote {
  font-family: 'Raleway', sans-serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: #e6e6ff;
  text-align: center;
  margin: 0;
  padding: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  animation: gradientShift 4s ease-in-out infinite, fadeInUp 0.8s ease-out;
  position: relative;
  z-index: 1;
  margin-top: 170px;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.dynamic-quote.quote-changing {
  animation: fadeOut 0.3s ease-in-out;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.dynamic-quote.quote-entering {
  animation: fadeInUp 0.6s ease-out;
}

@media (max-width: 768px) {
  .quote-container {
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
  }
  
  .dynamic-quote {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .quote-container {
    padding: 1rem 0.75rem;
    margin-bottom: 1rem;
  }
  
  .dynamic-quote {
    font-size: 1.5rem;
    line-height: 1.3;
  }
}

.dynamic-quote.loading {
  opacity: 0.6;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

h3 {
  margin-top: .5rem;
  font-family: 'Univers', sans-serif;
  font-size: 1rem;
  color: #e6e6ff;
  font-weight: 300;
  letter-spacing: 1.1px;
  margin-bottom: 2rem;
  text-align: center;
}

#title-logo {
  height: 65px;
  width: auto;
  vertical-align: middle;
  display: inline-block;
  position: relative;
  top: -7px;
  transition: transform 2s ease-in-out;
}

#title-logo:hover {
  transform: rotate(-10deg);
}

#logo {
  left: 1rem;
  size: 50px;
}

#chat-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  max-width: 650px;
  width: 100%;
  margin: 0 auto;
  height: calc(100vh - 200px);
  box-sizing: border-box;
}

#chat {
  flex-grow: 1;
  overflow-y: auto;
  border-radius: 12px;
  padding: 1.2rem;
  padding-top: 2rem;
  background: transparent;
  box-shadow: none;
  scrollbar-width: none;
  scrollbar-color: #5d5fef #1a1830;
  height: 100%;
  max-height: calc(100vh - 280px);
  box-sizing: border-box;
}

#chat::-webkit-scrollbar {
  width: 8px;
}

#chat::-webkit-scrollbar-track {
  background: #1a1830;
  border-radius: 10px;
}

#chat::-webkit-scrollbar-thumb {
  background-color: #5d5fef;
  border-radius: 10px;
  border: 2px solid #1a1830;
}

#chat div {
  margin-bottom: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: 15px;
  max-width: 50%;
  width: 700px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 1rem;
  font-weight: 500;
  user-select: text;
}

.user {
  background-color: rgba(93, 95, 239, 0.2);
  color: #e6e6ff;
  margin-left: auto;
  text-align: left;
  border-bottom-left-radius: 2px;
}

.user:hover {
  background-color: rgba(93, 95, 239, 0.3);
}

.bot {
  background-color: rgba(40, 35, 80, 0.3);
  color: #e6e6ff;
  text-align: left;
  max-width: fit-content;
  margin-right: auto;
  display: block;
}

.bot:hover {
  background-color: rgba(40, 35, 80, 0.4);
}

@keyframes pulseIcon {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

#cookie-consent {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #1a1830 0%, #24225a 100%);
  color: #e6e6ff;
  padding: 20px;
  z-index: 10000;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 400px;
  width: calc(100vw - 40px);
  transform: translateX(120%);
  transition: transform 0.3s ease-in-out;
}

#cookie-consent.show {
  transform: translateX(0);
}

.cookie-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cookie-text {
  text-align: left;
}

.cookie-text h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #e6e6ff;
}

.cookie-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #e6e6ff;
}

.cookie-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.cookie-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Raleway', sans-serif;
  flex: 1;
}

.cookie-accept {
  border: 1px solid #5d5fef;
  color: white;
  background: rgba(93, 95, 239, 0.3);
}

.cookie-accept:hover {
  background: rgba(93, 95, 239, 0.5);
  transform: translateY(-1px);
}

.cookie-decline {
  background: transparent;
  color: #a9a9ff;
  border: 1px solid #5d5fef;
}

.cookie-decline:hover {
  background: rgba(93, 95, 239, 0.2);
  color: white;
}

@media (max-width: 768px) {
  #cookie-consent {
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: none;
    width: calc(100vw - 40px);
  }

  .cookie-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .cookie-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  #cookie-consent {
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
    padding: 16px;
  }
}

body.cookies-declined #sidebar,
body.cookies-declined main {
  filter: blur(2px);
  pointer-events: none;
}

.cookie-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1830;
  color: #e6e6ff;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  z-index: 10001;
  display: none;
}

.cookie-notice.show {
  display: block;
}

#input {
  width: 100%;
  max-width: 100%;
  padding: 12px 50px 50px 12px;
  font-size: 1rem;
  font-family: 'Raleway', sans-serif;
  border: none;
  background: transparent;
  color: #e6e6ff;
  outline: none;
  resize: none;
  overflow-y: hidden;
  user-select: text;
  box-sizing: border-box;
  display: block;
  line-height: 3;
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 50px;
}

#input-area {
  box-sizing: border-box;
  padding: 10px;
  width: 100%;
  max-width: 750px;
  margin: 1rem auto 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: 100px;
  min-height: 100px;
  max-height: 100px;
  position: relative;
  overflow: visible;
  line-height: 30px;
  border-radius: 20px;
  border: 0.5px solid rgba(123, 104, 238, 0.4);
  background: rgba(40, 35, 80, 0.3);
  left: 0;
  bottom: 320px;
}

#input::placeholder {
  color: rgba(230, 230, 255, 0.7);
  font-family: 'Raleway', sans-serif;
  line-height: 3;
  vertical-align: top;
  text-align: left;
}

#input::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

#input::-webkit-scrollbar-track {
  background: transparent;
}

#input::-webkit-scrollbar-thumb {
  background: transparent;
  border: none;
}

#image-upload-btn {
  position: absolute;
  top: 70%;
  transform: translateY(-50%);
  left: 15px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border: 1px solid rgba(123, 104, 238, 0.3);
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

#image-upload-btn:hover {
  background: rgba(123, 104, 238, 0.2);
}

#image-upload-btn svg {
  width: 20px;
  height: 20px;
  fill: rgba(230, 230, 255, 0.8);
  transition: fill 0.2s ease;
}

#image-upload-btn:hover svg {
  fill: rgba(230, 230, 255, 1);
}

#image-upload-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#image-input {
  display: none;
}

.image-preview {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 24, 48, 0.95);
  border: 1px solid rgba(123, 104, 238, 0.3);
  border-radius: 12px;
  padding: 12px;
  max-width: 300px;
  display: none;
  z-index: 10;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.image-preview.show {
  display: block;
}

.image-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}

.image-preview-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-preview-name {
  color: rgba(230, 230, 255, 0.8);
  font-size: 0.85rem;
  font-family: 'Raleway', sans-serif;
  flex: 1;
  margin-right: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remove-image-btn {
  background: rgba(255, 59, 48, 0.8);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.remove-image-btn:hover {
  background: rgba(255, 59, 48, 1);
}

#send {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(123, 104, 238, 0.3);
  border-radius: 7.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

#auth-box {
  position: absolute;
  top: 20px;
  right: 20px;
}

#signin-btn {
  background-color: #1a1830;
  color: #e6e6ff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
  font-family: 'Raleway', sans-serif;
}

#signin-btn:hover {
  background-color: #2a2870;
}

#send {
  position: absolute;
  top: 50%;
  transform: translateY(10%);
  right: 10px;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(123, 104, 238, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#send:hover {
  background: rgba(123, 104, 238, 0.2);
}

#send img {
  width: 15px;
  height: 15px;
  opacity: 0.9;
}

#send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: translateY(-50%);
}

#send:disabled img {
  opacity: 0.3;
}

.chat-menu-btn:hover .menu-icon {
  opacity: 1;
}

#chat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-list::-webkit-scrollbar {
  display: none;
}

.chat-list {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.chat-item {
  position: relative;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: all 0.15s ease;
  margin: 1px 0;
  padding: 0;
  cursor: pointer;
  min-height: 44px;
  color: #dcdcff;
  border: 1px solid transparent;
}

.chat-item:hover {
  background: rgba(123, 104, 238, 0.1);
}

.chat-item.active {
  background: rgba(93, 95, 239, 0.2);
  border-color: rgba(93, 95, 239, 0.2);
}

.chat-item.menu-active {
  z-index: 10001;
}

.chat-button {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  min-height: 44px;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  gap: 12px;
}

.chat-button:hover {
  background: transparent;
}

.chat-button:focus {
  outline: none;
}

.chat-title {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: #dcdcff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  margin: 0;
  letter-spacing: -0.01em;
  min-width: 0;
  word-break: break-word; 
}

.chat-item:hover .chat-title {
  color: #ffffff;
}

.chat-item.active .chat-title {
  color: #ffffff;
  font-weight: 500;
}

.chat-menu-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  opacity: 0;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}

.chat-item:hover .chat-menu-btn,
.chat-item.menu-active .chat-menu-btn {
  opacity: 1;
}

.chat-menu-btn:hover {
  background: rgba(123, 104, 238, 0.2);
  opacity: 1 !important;
}

.chat-menu-btn:focus {
  outline: none;
  opacity: 1 !important;
  background: rgba(123, 104, 238, 0.2);
}

.menu-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  pointer-events: none;
  color: #dcdcff;
}

.chat-menu-btn:hover .menu-icon {
  opacity: 1;
}

.chat-menu {
  position: fixed;
  background: #24225a;
  border: 1px solid #5d5fef;
  border-radius: 12px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 50000;
  min-width: 140px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transition: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  overflow: hidden;
  padding: 6px 0;
  margin-top: 152px;
  margin-left: 80px;
}

.chat-menu.show {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
}

.menu-option {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: #e6e6ff;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  border-radius: 0;
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.4;
}

.menu-option:hover {
  background: rgba(123, 104, 238, 0.2);
  color: #ffffff;
}

.menu-option:focus {
  background: rgba(123, 104, 238, 0.2);
  color: #ffffff;
  outline: none;
}

.menu-option.delete-option:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.menu-option.delete-option:focus {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.rename-option {
  border-bottom: 1px solid #5d5fef;
  margin-bottom: 6px;
  padding-bottom: 12px;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10003;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  background: #24225a;
  border: 1px solid #5d5fef;
  border-radius: 12px;
  padding: 20px;
  width: 320px;
  max-width: 90vw;
  z-index: 10004;
  position: relative;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.3),
    0 4px 6px -2px rgba(0, 0, 0, 0.2);
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

.popup-overlay.show .popup-content {
  transform: translateY(0);
}

.popup-content h3 {
  color: #ffffff;
  margin: 0 0 16px 0;
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}

#rename-input {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid #5d5fef;
  border-radius: 6px;
  color: #e6e6ff;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  line-height: 1.4;
}

#rename-input:focus {
  outline: none;
  border-color: #7b68ee;
}

.popup-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.popup-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
  min-width: 60px;
}

.save-btn {
  background: transparent;
  color: white;
  border: 1px solid #5d5fef;
}

.save-btn:hover {
  background: rgba(93, 95, 239, 0.3);
  color: white;
}

.cancel-btn {
  background: transparent;
  color: white;
  border: 1px solid #5d5fef;
}

.cancel-btn:hover {
  background: rgba(93, 95, 239, 0.3);
  color: white;
}

body.menu-open {
  overflow: hidden;
}

.menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 49999;
  background: transparent;
  display: none;
}

.menu-backdrop.active {
  display: block;
}

#add-chat-btn {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid #5d5fef;
  color: #dcdcff;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  margin: 8px 0;
  border-radius: 8px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: -0.01em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 44px;
  box-shadow: none;
}

#add-chat-btn:hover {
  background: rgba(93, 95, 239, 0.2);
  border-color: #7b68ee;
  color: #ffffff;
}

#add-chat-btn:focus {
  outline: none;
}

#add-chat-btn:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

.btn-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  opacity: 0.8;
}

#add-chat-btn:hover .btn-icon {
  opacity: 1;
  transform: scale(1.05);
}

#add-chat-btn.loading {
  pointer-events: none;
  opacity: 0.6;
  color: #999;
}

#add-chat-btn.loading .btn-icon {
  display: none;
}

#add-chat-btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(230, 230, 255, 0.2);
  border-top: 2px solid #dcdcff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.add-chat-minimal {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid rgba(123, 104, 238, 0.2);
  color: #dcdcff;
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
  margin: 6px 0;
  border-radius: 6px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 36px;
}

.add-chat-minimal:hover {
  background: rgba(123, 104, 238, 0.15);
  border-color: rgba(123, 104, 238, 0.3);
  color: #ffffff;
}

.add-chat-minimal:active {
  transform: scale(0.98);
}

.profile-dropdown {
  position: relative;
  display: inline-block;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid rgba(123, 104, 238, 0.3);
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
}

.profile-btn:hover {
  background: rgba(123, 104, 238, 0.2);
  border-color: rgba(123, 104, 238, 0.4);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #383858 0%, #2b2b5a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: white;
}

.profile-name {
  font-size: 14px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.profile-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

.profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: rgba(36, 34, 90, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(93, 95, 239, 0.3);
  border-radius: 12px;
  padding: 12px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.profile-menu.hidden {
  display: none;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-avatar-large {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5d5fef 0%, #7b68ee 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
}

.profile-details {
  flex: 1;
}

.profile-name-large {
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.profile-email {
  font-size: 12px;
  color: rgba(230, 230, 255, 0.7);
}

.profile-divider {
  border: none;
  height: 1px;
  background: rgba(123, 104, 238, 0.3);
  margin: 12px 0;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  color: rgba(230, 230, 255, 0.8);
  font-size: 14px;
}

.logout-btn:hover {
  background: rgba(123, 104, 238, 0.2);
  color: white;
}

.logout-icon {
  font-size: 12px;
}

#signin-btn {
  background: #1a1830;
  border: 1px solid #5d5fef;
  border-radius: 20px;
  padding: 10px 20px;
  color: #e6e6ff;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease;
}

#signin-btn:active {
  transform: scale(1.05);
}

#signin-btn:hover {
  background: #2a2870;
}

#welcome-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

#welcome-popup.show {
  display: flex;
}

.welcome-popup-content {
  background: #1a1830;
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: slideIn 0.4s ease-out;
  border: 1px solid #5d5fef;
}

.welcome-popup-content h2 {
  color: #e6e6ff;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px 0;
  font-family: 'Raleway', sans-serif;
}

.welcome-popup-content p {
  color: #dcdcff;
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 32px 0;
  font-family: 'Raleway', sans-serif;
}

.popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popup-btn {
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Raleway', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.popup-btn-primary {
  background: #5d5fef;
  color: white;
}

.popup-btn-primary:hover {
  background: #7b68ee;
  transform: translateY(-1px);
}

.popup-btn-secondary {
  background: #24225a;
  color: #ffffff;
  border: 1px solid #5d5fef;
}

.popup-btn-secondary:hover {
  background: #2a2870;
  color: white;
  transform: translateY(-1px);
}

.popup-btn-tertiary {
  background: transparent;
  color: #a9a9ff;
  border: none;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
}

.popup-btn-tertiary:hover {
  color: #ffffff;
  background: rgba(93, 95, 239, 0.2);
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #a9a9ff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.popup-close:hover {
  background: rgba(93, 95, 239, 0.2);
  color: #ffffff;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 480px) {
  .welcome-popup-content {
    padding: 24px;
    margin: 16px;
  }

  .welcome-popup-content h2 {
    font-size: 20px;
  }

  .welcome-popup-content p {
    font-size: 14px;
  }

.sidebar-download-btn {
  width: calc(100% - 32px);
  margin: 8px 16px;
  padding: 12px 16px;
  background: #5d5fef;
  color: white !important;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none !important;
  border: none;
  min-height: 44px;
  box-shadow: 0 2px 8px rgba(93, 95, 239, 0.3);
}

.sidebar-download-btn:hover {
  background: #7b68ee;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(93, 95, 239, 0.4);
}

.sidebar-download-btn:active {
  transform: translateY(0);
}

#sidebar.close .sidebar-download-btn {
  width: calc(100% - 10px);
  margin: 8px 5px;
}

#sidebar.close .sidebar-download-btn .btn-text {
  display: none;
}

#sidebar.close .sidebar-download-btn .btn-icon {
  margin: 0 auto;
}
