/**
 * AI-Assistant Desktop UI
 * Modern 2-Column Layout with Context Sidebar
 */

/* ============================================================================
   DESKTOP CONTAINER - 2 COLUMNS (FULLWIDTH)
   ============================================================================ */

.ai-desktop-container {
  display: grid;
  grid-template-columns: 350px 1fr;
  width: 100vw !important;
  max-width: 100vw !important;
  height: calc(100vh - 110px) !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  position: relative;
  left: calc(-50vw + 50%);
}

/* ============================================================================
   LEFT SIDEBAR - CONTEXT PANEL
   ============================================================================ */

.ai-context-sidebar {
  background: linear-gradient(180deg, rgba(15,23,42,0.95) 0%, rgba(30,41,59,0.95) 100%);
  border-right: 1px solid rgba(148,163,184,0.2);
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.ai-sidebar-header {
  flex: 0 0 auto;
  padding: 16px;
  border-bottom: 1px solid rgba(148,163,184,0.2);
  background: rgba(30,41,59,0.5);
  position: sticky;
  top: 0;
  z-index: 10;
}

.ai-sidebar-header h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: #e2e8f0;
  font-weight: 600;
}

.ai-sidebar-header small {
  color: #94a3b8;
  font-size: 12px;
}

.ai-sidebar-section {
  padding: 14px;
  border-bottom: 1px solid rgba(148,163,184,0.15);
  flex: 0 0 auto;
}

.ai-sidebar-section h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(71,85,105,0.2);
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  font-size: 12px;
  color: #cbd5e1;
  transition: all 0.2s ease;
}

.ai-sidebar-item:hover {
  background: rgba(71,85,105,0.35);
  border-left-color: #60a5fa;
  color: #e2e8f0;
}

.ai-sidebar-item .time {
  color: #94a3b8;
  font-weight: 600;
  min-width: 45px;
}

.ai-sidebar-item .text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-sidebar-item .icon {
  font-size: 14px;
}

.ai-sidebar-item .priority {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.ai-sidebar-item .priority-hoch {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}

.ai-sidebar-item .priority-normal {
  background: rgba(251,146,60,0.2);
  color: #fed7aa;
}

.ai-sidebar-item .priority-niedrig {
  background: rgba(34,197,94,0.2);
  color: #86efac;
}

/* Quick Actions Grid */
.ai-quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ai-qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(37,99,235,0.2));
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  color: #93c5fd;
  font-weight: 500;
}

.ai-qa-btn:hover {
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(37,99,235,0.3));
  border-color: rgba(59,130,246,0.5);
  color: #bfdbfe;
  transform: translateY(-2px);
}

.ai-qa-btn span:first-child {
  font-size: 18px;
}

/* ============================================================================
   RIGHT SIDE - MAIN CHAT INTERFACE
   ============================================================================ */

.ai-chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1a1f35 100%);
}

/* Chat Header */
.ai-chat-header {
  flex: 0 0 auto;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(148,163,184,0.2);
  background: linear-gradient(180deg, rgba(30,41,59,0.6) 0%, rgba(15,23,42,0.4) 100%);
}

.ai-chat-header-content h2 {
  margin: 0 0 4px 0;
  font-size: 24px;
  color: #e2e8f0;
  font-weight: 700;
}

.ai-chat-header-content p {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
}

/* Messages Area - BIG & SPACIOUS */
.ai-messages-desktop {
  flex: 1 1 auto;
  min-height: 200px;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-messages-desktop::-webkit-scrollbar {
  width: 8px;
}

.ai-messages-desktop::-webkit-scrollbar-track {
  background: transparent;
}

.ai-messages-desktop::-webkit-scrollbar-thumb {
  background: rgba(71,85,105,0.4);
  border-radius: 4px;
}

.ai-messages-desktop::-webkit-scrollbar-thumb:hover {
  background: rgba(71,85,105,0.6);
}

/* Message Rows */
.ai-msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-msg-row.user-msg {
  justify-content: flex-end;
}

.ai-msg-row.assistant-msg {
  justify-content: flex-start;
}

/* Message Bubble */
.ai-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 12px;
  line-height: 1.6;
  word-wrap: break-word;
  font-size: 15px;
}

.ai-msg-row.user-msg .ai-bubble {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border-radius: 16px 4px 16px 16px;
}

.ai-msg-row.assistant-msg .ai-bubble {
  background: rgba(71,85,105,0.4);
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 4px 16px 16px 16px;
}

.ai-bubble p {
  margin: 0 0 8px 0;
}

.ai-bubble p:last-child {
  margin-bottom: 0;
}

.ai-bubble strong {
  color: #bfdbfe;
}

.ai-msg-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #94a3b8;
}

.ai-msg-row.user-msg .ai-msg-icon {
  order: 2;
}

.ai-msg-row.assistant-msg .ai-msg-icon {
  color: #3b82f6;
}

/* ============================================================================
   INPUT AREA - DESKTOP VERSION
   ============================================================================ */

.ai-input-desktop {
  flex: 0 0 auto;
  padding: 24px 32px 28px 32px;
  background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(30,41,59,0.6) 100%);
  border-top: 1px solid rgba(148,163,184,0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
}

.ai-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
}

.ai-input-field-desktop {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  background: rgba(71,85,105,0.3);
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 15px;
  height: 44px;
  outline: none;
  transition: all 0.2s ease;
}

.ai-input-field-desktop::placeholder {
  color: #64748b;
}

.ai-input-field-desktop:focus {
  background: rgba(71,85,105,0.5);
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* Input Buttons */
.ai-input-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
  color: #e2e8f0;
}

.ai-voice-btn {
  background: rgba(59,130,246,0.2);
  border: 1px solid rgba(59,130,246,0.3);
}

.ai-voice-btn:hover {
  background: rgba(59,130,246,0.3);
  border-color: rgba(59,130,246,0.5);
}

.ai-send-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
}

.ai-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(59,130,246,0.3);
}

.ai-send-btn:active {
  transform: translateY(0);
}

/* Quick Message Buttons */
.ai-quick-messages {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-qm-btn {
  padding: 10px 16px;
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 6px;
  color: #93c5fd;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  white-space: nowrap;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.ai-qm-btn:hover {
  background: rgba(59,130,246,0.25);
  border-color: rgba(59,130,246,0.5);
  color: #bfdbfe;
}

.ai-qm-btn-clear {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.ai-qm-btn-clear:hover {
  background: rgba(239,68,68,0.25);
  border-color: rgba(239,68,68,0.5);
  color: #fecaca;
}

/* ============================================================================
   RESPONSIVE - TABLETS & SMALLER DESKTOPS
   ============================================================================ */

@media (max-width: 1600px) {
  .ai-desktop-container {
    grid-template-columns: 320px 1fr;
  }
  
  .ai-bubble {
    max-width: 80%;
  }
}

@media (max-width: 1400px) {
  .ai-desktop-container {
    grid-template-columns: 280px 1fr;
  }
  
  .ai-bubble {
    max-width: 75%;
  }
  
  .ai-messages-desktop,
  .ai-chat-header,
  .ai-input-desktop {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 1024px) {
  /* Fall back to mobile layout */
  .ai-desktop-container {
    display: none;
  }
}
