/* CatMax UI - Simplified Clean Styles */

/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  min-height: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0f;
  color: #fff;
  overflow: hidden;
}

/* Header */
.app-header {
  position: relative;
  width: 100%;
  height: 60px;
  flex-shrink: 0;
  border-bottom: 2px solid #f97316;
  box-shadow: 0 0 10px #f97316, 0 0 20px rgba(249, 115, 22, 0.5);
  background: #12121a;
}

.lightning-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.lightning-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.header-content {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 20px;
}

.logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.logo-img {
  max-width: 180px;
  height: auto;
  display: block;
}

.tagline {
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.05em;
  z-index: 20;
  padding: 2px 8px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}

/* Sidebar Toggle */
.sidebar-toggle {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(18, 18, 26, 0.9);
  border: 2px solid #f97316;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
  flex-shrink: 0;
  z-index: 2000;
}

.sidebar-toggle span {
  width: 18px;
  height: 2px;
  background: #f97316;
  border-radius: 1px;
}

/* Terminal Toggle */
.terminal-toggle {
  background: #374151;
  border: 1px solid #4b5563;
  color: #9ca3af;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.2s;
}

.terminal-toggle:hover {
  background: #4b5563;
  color: #fff;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Chat Container */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #12121a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1a25;
}

.chat-agent-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-agent-avatar {
  width: 74px;
  height: 62px;
  border-radius: 8px;
  object-fit: contain;
  border: 2px solid #f97316;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
  padding: 4px;
  background: #1a1a25;
}

.chat-agent-details h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.chat-agent-status {
  font-size: 0.875rem;
  color: #94a3b8;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

.message.agent-message {
  align-self: flex-start;
}

.message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.message-content {
  background: #252535;
  padding: 12px 16px;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.message.user-message .message-content {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 4px;
}

.message-text {
  font-size: 1rem;
  line-height: 1.5;
}

.message-time {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 4px;
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1a25;
}

.chat-input-wrapper {
  display: flex;
  gap: 12px;
  background: #0a0a0f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 8px 16px;
}

.chat-input-wrapper:focus-within {
  border-color: #f97316;
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  outline: none;
  resize: none;
  min-height: 24px;
  padding: 8px 0;
}

#chat-input::placeholder {
  color: #64748b;
}

.send-btn {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.5);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: #12121a;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  transition: left 0.3s ease;
  overflow-y: auto;
  padding: 20px;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f97316;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.3);
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f97316;
}

.sidebar-close {
  background: none;
  border: none;
  color: #f97316;
  font-size: 1.5rem;
  cursor: pointer;
}

.sidebar-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-add-terminal {
  background: #f97316;
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-add-terminal:hover {
  background: #ea580c;
  transform: scale(1.1);
}

.sidebar-terminal-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-terminal-item .terminal-icon {
  font-size: 0.875rem;
}

.sidebar-terminal-item .terminal-name {
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-list {
  list-style: none;
}

.nav-list li {
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  gap: 12px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.sidebar-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: all 0.3s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Mobile */
@media (max-width: 768px) {
  .app-header {
    height: 50px;
  }
  
  .logo-img {
    max-width: 150px;
  }
  
  .logo-wrapper {
    flex-direction: row;
    gap: 10px;
  }
  
  .sidebar {
    width: 260px;
    left: -260px;
  }
  
  .chat-section {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .app-header {
    height: 45px;
  }
  
  .logo-img {
    max-width: 120px;
  }
  
  .tagline {
    font-size: 0.6rem;
  }
  
  .chat-section {
    padding: 5px;
  }
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #f97316;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* View Container System */
#view-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.view {
  display: none;
  width: 100%;
  height: 100%;
}

.view.active {
  display: block;
}

/* Main Layout with Agent Sidebar */
body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  background: #0a0a0f;
  position: relative;
}

#agent-sidebar {
  flex-shrink: 0;
}

.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 20px;
  overflow: hidden;
}

/* View Container for Router */
.view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.view.active {
  display: flex;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
