/* ========================================
   BOT FortalRH - Simulador de Chat
   ======================================== */

:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --background: #f1f5f9;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --chat-user: #2563eb;
  --chat-bot: #f8fafc;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
}

/* Container */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
}

.header-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header-content .subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--error-color);
  color: white;
  border-radius: 9999px;
  margin-left: 0.5rem;
}

/* Main */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Chat Section */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border-color);
  min-height: 0;
  overflow: hidden;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.welcome-content {
  max-width: 400px;
  text-align: center;
}

.welcome-content h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.welcome-content > p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.start-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.start-form label {
  text-align: left;
  font-weight: 500;
  font-size: 0.875rem;
}

.start-form input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.start-form input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.test-data {
  background: var(--background);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: left;
}

.test-data h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.test-data p {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.copy-text {
  color: var(--primary-color);
  cursor: pointer;
  font-family: monospace;
}

.copy-text:hover {
  text-decoration: underline;
}

/* Chat Container */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

.btn-reset {
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 0.375rem;
  color: white;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.btn-reset:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--background);
  min-height: 0;
  scroll-behavior: smooth;
}

.message {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-user {
  align-self: flex-end;
  background: var(--chat-user);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 0.25rem;
}

.message-bot pre {
  white-space: pre-wrap;
  font-family: inherit;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  align-self: flex-start;
}

.typing-indicator span {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--secondary-color);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-0.375rem);
  }
}

/* Input Area */
.input-area {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.input-area input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  font-size: 1rem;
}

.input-area input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn-send {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 1.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-send:hover {
  background: var(--primary-dark);
}

/* Logs Panel */
.logs-panel {
  width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.logs-header h3 {
  font-size: 1rem;
}

.logs-actions {
  display: flex;
  gap: 0.5rem;
}

.logs-actions select {
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.logs-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  font-family: monospace;
  font-size: 0.75rem;
  background: #1e293b;
  color: #e2e8f0;
}

.log-entry {
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.2s;
}

.log-entry:hover {
  background: rgba(255, 255, 255, 0.1);
}

.log-entry.info {
  border-left: 3px solid var(--primary-color);
}

.log-entry.request {
  border-left: 3px solid #06b6d4;
}

.log-entry.response {
  border-left: 3px solid var(--success-color);
}

.log-entry.error {
  border-left: 3px solid var(--error-color);
}

.log-entry.debug {
  border-left: 3px solid var(--secondary-color);
}

.log-time {
  color: var(--secondary-color);
}

.log-source {
  color: var(--warning-color);
}

/* Buttons */
.btn-primary {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: var(--background);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.75rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--surface);
  border-radius: 0.5rem;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.log-detail {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.75rem;
  white-space: pre-wrap;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .logs-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 100;
  }

  .message {
    max-width: 90%;
  }
}
