/**
 * Main CSS - Index page inline styles
 * OyuncuNW AI Assistant
 * Moved from index.html for better caching and performance
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
    sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  color: var(--text-primary);
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: all 0.3s;
}

.sidebar-header {
  padding: 10px;
  flex-shrink: 0;
}

.new-chat-btn {
  width: 100%;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.new-chat-btn:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-color: rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.new-chat-btn:active {
  transform: translateY(0);
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-primary);
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.sidebar-nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.sidebar-nav-btn {
  width: 100%;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.sidebar-nav-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-nav-btn .nav-icon {
  font-size: 1em;
  flex-shrink: 0;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  min-height: 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.chat-history::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.chat-history-item {
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.chat-history-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-history-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-history-item .chat-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-item .delete-btn {
  opacity: 0;
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #888;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.4em;
  line-height: 1;
}

.chat-history-item:hover .delete-btn {
  opacity: 1;
}

.chat-history-item .delete-btn:hover {
  color: #ff6b6b;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border-primary);
  flex-shrink: 0;
  position: relative; /* Profil menüsü için */
}

.incognito-toggle-btn {
  width: 100%;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  font-weight: 500;
  margin-bottom: 8px;
}

.incognito-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.incognito-toggle-btn.active {
  background: rgba(147, 51, 234, 0.1);
  border-color: rgba(147, 51, 234, 0.3);
  color: #9333ea;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.user-profile:hover {
  background: var(--bg-tertiary);
}

.user-menu-icon {
  margin-left: auto;
  font-size: 1.2em;
  color: var(--text-secondary);
}

.user-email {
  font-size: 0.7em;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User email in sidebar footer */
#userEmail {
  font-size: 0.7em;
  color: #888;
}

/* User Profile Menu (ChatGPT style) */
.user-profile-menu {
  position: absolute;
  bottom: 60px;
  left: 10px;
  right: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s;
  z-index: 1000;
}

.user-profile-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.profile-menu-header .user-avatar {
  width: 40px;
  height: 40px;
  font-size: 1.2em;
}

.menu-user-name {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-primary);
}

.menu-user-email {
  font-size: 0.75em;
  color: var(--text-secondary);
}

.profile-menu-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 4px 0;
}

.profile-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85em;
  text-align: left;
}

.profile-menu-item:hover {
  background: var(--bg-tertiary);
}

.profile-menu-item:first-of-type {
  border-radius: 0;
}

.profile-menu-item:last-of-type {
  border-radius: 0 0 12px 12px;
}

.profile-menu-item .menu-icon {
  font-size: 1.1em;
  width: 20px;
  text-align: center;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0078d4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-name {
  font-size: 0.75em;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: transparent;
  color: #ff6b6b;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7em;
  text-align: left;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: #3d1a1a;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 60px;
  flex-shrink: 0;
}

.chat-header h1 {
  font-size: 1.1em;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1em;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Chat Area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

.chat-messages {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100%;
}

.empty-state {
  text-align: center;
  color: var(--text-disabled);
  padding: 40px 20px;
  margin-top: auto;
}

.empty-state h2 {
  font-size: 2em;
  font-weight: 400;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 1em;
  color: var(--text-muted);
}

.message {
  padding: 12px 0;
  animation: fadeIn 0.3s ease;
  width: 100%;
  word-wrap: break-word;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.message-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
}

/* User Message */
.user-message {
  background: transparent;
  display: flex;
  justify-content: flex-end;
}

.user-message .message-wrapper {
  justify-content: flex-end;
  max-width: 50%;
  width: fit-content;
}

.user-message .message-content {
  background: var(--bg-tertiary);
  padding: 12px 16px;
  border-radius: 18px;
  border-top-right-radius: 4px;
  text-align: left;
  border: 1px solid var(--border-secondary);
}

.user-message .message-content p {
  line-height: 1.6;
  color: var(--text-primary);
  font-size: 0.95em;
  margin: 0;
}

.user-message .message-content p strong {
  color: var(--text-secondary);
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

/* AI Message */
.ai-message {
  background: transparent;
  display: flex;
  justify-content: flex-start;
}

.ai-message .message-wrapper {
  justify-content: flex-start;
  max-width: 50%;
  width: fit-content;
}

.ai-message .message-content {
  background: rgba(37, 99, 235, 0.1);
  padding: 12px 16px;
  border-radius: 18px;
  border-top-left-radius: 4px;
  text-align: left;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.ai-message .message-content {
  line-height: 1.7;
  color: var(--text-primary);
  font-size: 0.95em;
  max-width: 100%;
}
.ai-message .message-content p {
  margin: 0 0 12px 0;
  line-height: 1.7;
  color: var(--text-primary);
  max-width: 100%;
  overflow-wrap: break-word;
}
.ai-message .message-content p:last-child {
  margin-bottom: 0;
}
.ai-message .message-content h1 {
  font-size: 1.8em;
  font-weight: 700;
  margin: 20px 0 12px 0;
  color: var(--text-primary);
}
.ai-message .message-content h2 {
  font-size: 1.5em;
  font-weight: 700;
  margin: 18px 0 10px 0;
  color: var(--text-primary);
}
.ai-message .message-content h3 {
  font-size: 1.3em;
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: var(--text-primary);
}
.ai-message .message-content strong {
  font-weight: 700;
  color: var(--text-primary);
}
.ai-message .message-content em {
  font-style: italic;
  color: var(--text-secondary);
}
.ai-message .message-content code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9em;
  color: #6eb7ff;
  border: 1px solid var(--border-primary);
}
.ai-message .message-content pre {
  background: var(--bg-secondary);
  padding: 12px;
  padding-top: 40px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border-primary);
  position: relative;
}
.ai-message .message-content pre code {
  background: transparent;
  padding: 0;
  color: var(--text-primary);
  border: none;
}

/* Code Block Header with Copy Button */
.code-block-wrapper {
  position: relative;
  margin: 12px 0;
}
.code-block-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
  z-index: 1;
}
.code-language {
  font-size: 0.75em;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.copy-code-btn {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.3);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75em;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-code-btn:hover {
  background: rgba(37, 99, 235, 0.2);
  transform: translateY(-1px);
}
.copy-code-btn.copied {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
}
.ai-message .message-content ul,
.ai-message .message-content ol {
  margin: 12px 0;
  padding-left: 24px;
  color: var(--text-primary);
}
.ai-message .message-content li {
  margin: 6px 0;
  line-height: 1.6;
  color: var(--text-primary);
}
.ai-message .message-content blockquote {
  border-left: 4px solid var(--accent-primary);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--text-secondary);
  font-style: italic;
}
.ai-message .message-content a {
  color: #6eb7ff;
  text-decoration: none;
}
.ai-message .message-content a:hover {
  text-decoration: underline;
  color: #8ec9ff;
}

/* Model Badge - Güzelleştirilmiş */
.model-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(99, 37, 235, 0.15) 100%);
  color: #60a5fa;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.72em;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.15);
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}

/* Loading Animation */
.loading .message-content p {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Input Area */
.input-area {
  padding: 16px 24px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-primary);
  flex-shrink: 0;
}

.input-container {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-input);
  padding: 12px 14px;
  border-radius: 24px;
  border: 1px solid var(--border-secondary);
  transition: all 0.2s;
}

.input-container:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(84, 54, 218, 0.1);
}

#questionInput {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-size: 0.95em;
  outline: none;
  color: var(--text-primary);
  resize: none;
  max-height: 200px;
  min-height: 24px;
  line-height: 1.5;
  font-family: inherit;
}

#questionInput::placeholder {
  color: var(--text-disabled);
}

.input-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.input-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.input-btn.send-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.input-btn.send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.input-btn.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.input-btn.send-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-disabled);
  box-shadow: none;
}

.input-btn#addBtn,
.input-btn#imageBtn {
  display: none; /* Vision destekli model yok */
}

.input-btn#voiceBtn {
  display: flex; /* Sesli mesaj aktif */
}

/* Image Preview */
.image-preview-container {
  padding: 12px 16px;
  border-top: 1px solid var(--border-primary);
  display: none;
}

.image-preview-container.show {
  display: block;
}

.image-preview {
  position: relative;
  display: inline-block;
  max-width: 200px;
}

.image-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.image-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff6b6b;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.image-preview-remove:hover {
  background: #ff5252;
  transform: scale(1.1);
}

/* Scrollbar - Daha ince ve şık */
.chat-history::-webkit-scrollbar,
.chat-area::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-history::-webkit-scrollbar-track,
.chat-area::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-history::-webkit-scrollbar-thumb,
.chat-area::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.chat-history::-webkit-scrollbar-thumb:hover,
.chat-area::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Firefox scrollbar */
.chat-history,
.chat-area,
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Desktop Tam Ekran - Linux/Pardus Uyumluluğu */
@media (min-width: 769px) and (hover: hover) {
  /* Sidebar sabit, main content tam */
  body {
    overflow: hidden;
  }
  
  .sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0;
    width: 260px !important;
    height: 100vh !important;
    transform: none !important;
    z-index: 100;
  }
  
  .main-content {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
    height: 100vh;
  }
  
  .chat-area {
    height: calc(100vh - 60px - 80px);
    overflow-y: auto;
  }
  
  .chat-messages {
    max-width: 100%;
    width: 100%;
    padding: 20px 40px;
  }
  
  /* Menu butonu masaüstünde gizle */
  #menuBtn {
    display: none !important;
  }
}

/* Mobile styles - mobile-optimizations.css'de tanımlı */
