/* Genel Ayarlar ve Sıfırlamalar (Gemini Dark Theme) */
body {
  margin: 0;
  font-family: 'Roboto', sans-serif;
  background-color: #202123;
  color: #e0e0e0;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  font-size: 15px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

/* Login Ekranı Stilleri (Gemini Uyumlu) */
#login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  background-color: #1A1A1A;
  box-sizing: border-box;
  padding: 20px;
}

.login-box {
  background-color: #2F3037;
  padding: 35px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  text-align: center;
  width: 100%;
  max-width: 450px;
  box-sizing: border-box;
  color: #e0e0e0;
}

.login-box h1 {
  font-size: 32px;
  color: #e0e0e0;
  margin-bottom: 35px;
  font-weight: 500;
}

.login-box input[type="email"],
.login-box input[type="password"] {
  width: 100%;
  padding: 14px 12px;
  margin-bottom: 18px;
  border: 1px solid #444;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
  background-color: #3C4043;
  color: #e0e0e0;
}

.login-box input[type="email"]:focus,
.login-box input[type="password"]:focus {
  border-color: #8ab4f8;
  outline: none;
  box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.25);
}

.login-box button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  font-weight: 500;
}

#login-button {
  background-color: #8ab4f8;
  color: #1A1A1A;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#login-button:hover {
  background-color: #6a9ce7;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.google-button {
  background-color: #3C4043;
  color: #e0e0e0;
  border: 1px solid #5F6368;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.google-button:hover {
  background-color: #4A4E52;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.google-button img {
  width: 22px;
  height: 22px;
  filter: invert(0.8);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 25px 0;
  color: #A0A0A0;
  font-size: 15px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #444;
}

.divider:not(:empty)::before {
  margin-right: .85em;
}

.divider:not(:empty)::after {
  margin-left: .85em;
}

.error-message {
  color: #ff6b6b;
  font-size: 14px;
  margin-top: 15px;
}

/* Sohbet Ekranı Genel Stilleri (Gemini Dark Theme) */
#chat-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  background-color: #202123;
  overflow: hidden;
  position: relative;
}

/* Sidebar ve Dinamik Yapısı - Masaüstü görünümü */
.sidebar {
  width: 70px;
  min-width: 70px;
  background-color: #2F3037;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  padding: 15px 10px;
  box-sizing: border-box;
  border-right: 1px solid #3C4043;
  position: fixed;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: 600;
  transition: width 0.3s ease-in-out, min-width 0.3s ease-in-out;
  overflow-y: hidden;
}

.sidebar.hovered {
  width: 280px;
  min-width: 280px;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-track {
  background: #2F3037;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: #5F6368;
  border-radius: 4px;
  border: 2px solid #2F3037;
}

.sidebar-header {
  margin-bottom: 20px;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
}

#new-chat-button {
  background-color: #42454a;
  color: #e0e0e0;
  font-weight: 600;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 20px;
  padding: 12px 15px;
  gap: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  width: 100%;
  border: none;
}

#new-chat-button:hover {
  background-color: #515459;
}

.sidebar:not(.hovered) #new-chat-button .text {
  opacity: 0;
  width: 0;
  margin-left: -10px;
  transition: opacity 0.2s ease-out, width 0.2s ease-out, margin-left 0.2s ease-out;
}

.sidebar.hovered #new-chat-button .text {
  opacity: 1;
  width: auto;
  margin-left: 0;
  transition: opacity 0.3s ease-in 0.1s, width 0.3s ease-in 0.1s, margin-left 0.3s ease-in 0.1s;
}

.sidebar:not(.hovered) #new-chat-button {
  justify-content: center;
  padding: 12px 0;
}

.sidebar button,
.sidebar #chat-list div,
.sidebar .user-info > div,
.sidebar .user-info button {
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 12px 15px;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  justify-content: flex-start;
}

.sidebar:not(.hovered) #chat-list .text,
.sidebar:not(.hovered) .user-info #user-email .text,
.sidebar:not(.hovered) .user-info #logout-button .text {
  opacity: 0;
  width: 0;
  margin-left: -10px;
  transition: opacity 0.2s ease-out, width 0.2s ease-out, margin-left 0.2s ease-out;
}

.sidebar.hovered #chat-list .text,
.sidebar.hovered .user-info #user-email .text,
.sidebar.hovered .user-info #logout-button .text {
  opacity: 1;
  width: auto;
  margin-left: 0;
  transition: opacity 0.3s ease-in 0.1s, width 0.3s ease-in 0.1s, margin-left 0.3s ease-in 0.1s;
}

.sidebar:not(.hovered) .sidebar-item-content {
  justify-content: center;
  padding: 12px 0;
}

.sidebar button {
  background-color: transparent;
  color: #e0e0e0;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar button .material-icons,
.sidebar button .fas {
  font-size: 24px;
  flex-shrink: 0;
}

/* Mobil için üst barı sabitleme */
#mobile-top-bar {
  display: none; /* Masaüstünde gizli */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background-color: #2F3037;
  border-bottom: 1px solid #3C4043;
  z-index: 999;
  justify-content: flex-start;
  align-items: center;
  padding: 0 15px;
  box-sizing: border-box;
}

#mobile-menu-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  font-size: 28px;
  color: #e0e0e0;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

#mobile-menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.header-title {
  color: #e0e0e0;
  font-size: 18px;
  font-weight: 500;
  margin-left: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#chat-list {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 15px;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

.sidebar:not(.hovered) #chat-list {
  overflow-y: hidden;
}

.sidebar.hovered #chat-list {
  overflow-y: auto;
}

#chat-list::-webkit-scrollbar {
  width: 8px;
}
#chat-list::-webkit-scrollbar-track {
  background: #2F3037;
}
#chat-list::-webkit-scrollbar-thumb {
  background-color: #5F6368;
  border-radius: 4px;
  border: 2px solid #2F3037;
}

#chat-list div {
  margin-bottom: 8px;
  background-color: transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  font-size: 15px;
  color: #e0e0e0;
}

#chat-list div:hover {
  background-color: #42454a;
}

.sidebar:not(.hovered) #chat-list div.active-chat {
  background-color: transparent;
  color: #ffffff;
}

.sidebar.hovered #chat-list div.active-chat {
  background-color: #42454a;
  color: #ffffff;
}

.user-info {
  padding-top: 15px;
  border-top: 1px solid #3C4043;
  text-align: left;
  font-size: 15px;
  color: #ccc;
  padding-bottom: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.user-info #user-email {
  margin-bottom: 10px;
  color: #e0e0e0;
  font-size: 15px;
  font-weight: 500;
}

.user-info #user-email .fas {
  font-size: 18px;
  color: #8ab4f8;
  flex-shrink: 0;
}

.user-info #logout-button {
  background-color: transparent;
  border: 1px solid #5F6368;
  color: #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  align-self: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.user-info #logout-button:hover {
  background-color: #42454a;
  border-color: #888;
}

/* Main Chat Area - Masaüstü görünümü */
.main-chat-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
  background-color: #202123;
  overflow: hidden;
  padding-left: 70px;
  transition: padding-left 0.3s ease-in-out;
}

.sidebar.hovered + .main-chat-area {
  padding-left: 280px;
}

#messages {
  flex-grow: 1;
  overflow-y: auto;
  padding-top: 20px;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  background-color: #202123;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

#messages::-webkit-scrollbar {
  width: 8px;
}
#messages::-webkit-scrollbar-track {
  background: #202123;
}
#messages::-webkit-scrollbar-thumb {
  background-color: #5F6368;
  border-radius: 4px;
  border: 2px solid #202123;
}

.messages-content-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 80px;
  padding-bottom: 40px;
  box-sizing: border-box;
  min-height: calc(100% - 20px);
  justify-content: flex-end;
}

.message {
  display: flex;
  align-items: flex-start;
  padding: 5px 20px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.6;
  color: #e0e0e0;
  box-sizing: border-box;
  position: relative;
  width: auto;
}

.message.user {
  background-color: #3C4043;
  max-width: 570px;
  align-self: flex-end;
}

.message.bot {
  background-color: transparent;
  max-width: 760px;
  align-self: flex-start;
}

.message-sender {
  display: none;
}

.message-content {
  font-size: 16px;
  line-height: 1.5;
  color: #e0e0e0;
}

.message-content p {
  margin-block-start: 0.5em;
  margin-block-end: 0.5em;
}

#messages .message.bot:first-child {
  background-color: transparent;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  margin-top: 0;
}
#messages .message.bot:first-child .message-content {
  color: #e0e0e0;
}

.input-area {
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  padding-top: 0;
  box-sizing: border-box;
  background-color: #202123;
  z-index: 10;
  max-width: 900px;
  margin: 0 auto;
}

.input-area::before {
  content: '';
  position: absolute;
  top: -75px;
  height: 120px;
  background: linear-gradient(to top, #202123 50%, rgba(32, 33, 35, 0) 100%);
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 9;
}

.input-wrapper {
  display: flex;
  width: 100%;
  background-color: #202123;
  border-radius: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  padding: 10px 15px;
  box-sizing: border-box;
  align-items: flex-end;
  min-height: 50px;
  border: 1px solid #5F6368;
  position: relative;
  z-index: 11;
  margin-bottom: 30px;
}

#user-input {
  flex-grow: 1;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 16px;
  resize: none;
  min-height: 20px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
  color: #e0e0e0;
  background-color: transparent;
}

#user-input::-webkit-scrollbar {
  width: 6px;
}
#user-input::-webkit-scrollbar-track {
  background: #202123;
}
#user-input::-webkit-scrollbar-thumb {
  background-color: #5F6368;
  border-radius: 3px;
  border: 2px solid #202123;
}

#user-input::placeholder {
  color: #A0A0A0;
}

#send-button {
  background-color: transparent;
  color: #8ab4f8;
  border: none;
  border-radius: 50%;
  padding: 8px;
  margin-left: 10px;
  cursor: pointer;
  font-size: 24px;
  transition: background-color 0.2s ease, color 0.2s ease;
  align-self: flex-end;
  display: flex;
  justify-content: center;
  align-items: center;
}

#send-button:hover {
  background-color: rgba(138, 180, 248, 0.1);
  color: #6a9ce7;
}

/* Custom Modal Stilleri (Gemini Uyumlu) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.modal-content {
  background-color: #2F3037;
  padding: 35px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 500px;
  width: 90%;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  color: #e0e0e0;
}

.modal-overlay.visible .modal-content {
  transform: scale(1);
  opacity: 1;
}

.modal-content h3 {
  font-size: 26px;
  color: #e0e0e0;
  margin-bottom: 20px;
  font-weight: 500;
}

.modal-content p {
  font-size: 16px;
  color: #ccc;
  margin-bottom: 30px;
  line-height: 1.7;
}

#modal-close-button {
  background-color: #8ab4f8;
  color: #1A1A1A;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  font-weight: 500;
}

#modal-close-button:hover {
  background-color: #6a9ce7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.hidden {
  display: none !important;
}

#typing-indicator {
  display: none;
  align-items: center;
  justify-content: flex-start;
  margin: 0 auto;
  background-color: transparent;
  align-self: flex-start;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: none;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 10px;
  padding-bottom:40px;
}

.typing-dots-container {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 20px;
}

.typing-dot {
  width: 12px;
  height: 12px;
  background-color: #8ab4f8;
  border-radius: 50%;
  opacity: 0.8;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%, 100% {
      transform: translateY(0);
  }
  30% {
      transform: translateY(-8px);
      opacity: 1;
  }
  60% {
      transform: translateY(0);
      opacity: 0.8;
  }
}

/* Responsive Ayarlamalar (SADECE MOBİL İÇİN) */
@media (max-width: 768px) {
  body {
      font-size: 14px;
      overflow-y: hidden;
      overscroll-behavior-y: contain;
  }

  /* Mobil görünümde menü butonunun olduğu üst barı göster */
  #mobile-top-bar {
    display: flex;
  }

  /* Mobil menü kapalıyken sidebar'ı gizle */
  .sidebar {
      width: 80vw;
      max-width: 300px;
      min-width: unset;
      height: 100vh;
      flex-direction: column;
      justify-content: flex-start;
      align-items: flex-start;
      padding: 0;
      box-sizing: border-box;
      border-right: none;
      border-bottom: none;
      position: fixed;
      top: 0;
      left: 0;
      transform: translateX(-100%);
      z-index: 1000;
      transition: transform 0.3s ease-in-out;
      box-shadow: 0 0 20px rgba(0,0,0,0.5);
      background-color: #2F3037;
      overflow-y: auto;
  }

  .sidebar.expanded-mobile {
      transform: translateX(0);
  }

  /* Sidebar içindeki içeriği mobil menü açıkken göster */
  .sidebar-content {
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 100%;
      box-sizing: border-box;
      padding: 15px;
  }
  
  .sidebar-header {
      margin-bottom: 20px;
  }
  
  #new-chat-button {
      width: 100%;
  }

  #chat-list {
      flex-grow: 1;
      padding-right: 0;
  }

  .user-info {
      padding-top: 15px;
      margin-bottom: 0;
  }
  
  .main-chat-area {
      padding-top: 64px; /* Üst bar yüksekliğine göre boşluk */
      padding-left: 0;
      transition: none;
      width: 100vw;
      height: 100vh;
      overflow: hidden;
  }
  
  .main-chat-area-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      z-index: 999;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  }
  
  .main-chat-area-overlay.visible {
      opacity: 1;
      visibility: visible;
  }

  #messages {
      height: calc(100vh - 64px - 85px);
      box-sizing: border-box;
      overflow-x: hidden;
      padding: 15px 10px;
  }

  .messages-content-wrapper {
      max-width: 100%;
      padding: 0;
      gap: 12px;
      min-height: auto;
      height: 100%;
  }

  .message {
      padding: 10px 15px;
      font-size: 15px;
      line-height: 1.4;
      max-width: 95%;
      box-sizing: border-box;
  }
  
  .message.user {
      align-self: flex-end;
      margin-left: auto;
  }

  .message.bot {
      align-self: flex-start;
      margin-right: auto;
  }
  
  #typing-indicator {
      padding: 10px 15px;
      max-width: 95%;
      margin: 0;
      width: auto;
  }

  .input-area {
      width: 100vw;
      padding: 0 10px;
      box-sizing: border-box;
      position: fixed;
      bottom: 0;
      left: 0;
  }

  .input-area::before {
      display: none;
  }

  .input-wrapper {
      width: 100%;
      padding: 8px 12px;
      min-height: 45px;
      margin-bottom: 25px;
      max-width: 100%;
  }

  #user-input {
      width: 100%;
      padding: 6px 8px;
      font-size: 15px;
      max-height: 100px;
      box-sizing: border-box;
      overflow-x: hidden;
  }

  #send-button {
      padding: 6px;
      font-size: 20px;
      margin-left: 8px;
  }

  .modal-content {
      padding: 25px;
      border-radius: 10px;
      max-width: 90%;
  }

  .modal-content h3 {
      font-size: 22px;
      margin-bottom: 15px;
  }

  .modal-content p {
      font-size: 15px;
      margin-bottom: 25px;
  }

  #modal-close-button {
      padding: 10px 25px;
      font-size: 15px;
  }
}

/* Küçük mobil cihazlar için ek iyileştirmeler */
@media (max-width: 480px) {
  .login-box h1 {
      font-size: 24px;
  }
  .login-box input, .login-box button {
      font-size: 14px;
      padding: 10px;
  }
  #messages {
      height: calc(100vh - 64px - 85px);
  }
  .input-wrapper {
      min-height: 40px;
      margin-bottom: 20px;
  }
  #user-input {
      font-size: 14px;
  }
  #send-button {
      font-size: 18px;
  }
}