* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

:root {
  --bg-primary: #111;
  --bg-secondary: #202123;
  --bg-chat: #343541;
  --bg-input: #40414f;
  --border-color: #2a2b32;
  --text-primary: #fff;
  --text-secondary: #d1d5db;
  --accent-color: #10a37f;
  --user-color: #10a37f;
  --assistant-color: #fff;
  --danger-color: #ef4444;
  --script-bg: #1e1f2a;
  --script-border: #10a37f;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-chat: #ffffff;
  --bg-input: #f7f7f8;
  --border-color: #e5e5e5;
  --text-primary: #000000;
  --text-secondary: #6b7280;
  --accent-color: #10a37f;
  --user-color: #10a37f;
  --assistant-color: #000000;
  --danger-color: #ef4444;
  --script-bg: #f8f9fa;
  --script-border: #10a37f;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  transition: all 0.3s ease;
}

.container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  padding: 15px;
  border-right: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.logo {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.new-chat-btn, #theme-btn {
  width: 100%;
  background-color: var(--bg-chat);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.new-chat-btn:hover, #theme-btn:hover {
  background-color: var(--bg-input);
}

.chat-history {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 15px;
}

.chat-item {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background-color: transparent;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.chat-item:hover {
  background-color: var(--bg-chat);
  border-color: var(--border-color);
}

.chat-item.active {
  background-color: var(--bg-chat);
  border-color: var(--accent-color);
}

.chat-item-content {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-chat {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s ease;
}

.chat-item:hover .delete-chat {
  opacity: 1;
}

.delete-chat:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

.theme-toggle {
  margin-top: auto;
}

/* Chat area */
.chat {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--bg-chat);
  position: relative;
  transition: all 0.3s ease;
}

/* Mensagens */
.messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.welcome-message {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 50px;
}

.welcome-message h3 {
  margin-bottom: 10px;
  color: var(--text-primary);
}

.message {
  margin-bottom: 25px;
  line-height: 1.6;
  max-width: 100%;
}

.user {
  align-self: flex-end;
  background: var(--user-color);
  color: white;
  padding: 12px 16px;
  border-radius: 18px 18px 6px 18px;
  max-width: 70%;
  word-wrap: break-word;
}

.assistant {
  align-self: flex-start;
  color: var(--assistant-color);
  padding: 12px 16px;
  border-radius: 18px 18px 18px 6px;
  max-width: 80%;
  word-wrap: break-word;
  background: var(--bg-input);
}

/* Script Box */
.script-box {
  background: var(--script-bg);
  border: 1px solid var(--script-border);
  border-radius: 8px;
  padding: 16px;
  margin: 10px 0;
  position: relative;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
}

.script-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--script-border);
}

.script-title {
  font-weight: 600;
  color: var(--accent-color);
  font-size: 14px;
}

.copy-script-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.copy-script-btn:hover {
  background: #0d8c6d;
}

.copy-script-btn.copied {
  background: var(--accent-color);
  color: white;
}

.script-content {
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 5px;
}

.script-content::-webkit-scrollbar {
  width: 6px;
}

.script-content::-webkit-scrollbar-track {
  background: transparent;
}

.script-content::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

/* Upload dentro do chat input */
.upload-chat-btn {
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  z-index: 2;

}

.upload-chat-btn:hover {
  color: var(--accent-color);
}

.input-wrapper {
  position: relative;
  width: 85%;
  max-width: 800px;
  margin: 0 auto;
}

.chat-input input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  padding: 55px 50px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  margin-bottom: 30px;
  line-height:1.5;

}

.chat-input input:focus {
  border-color: var(--accent-color);
}

.upload-chat-btn {
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-color);
  transition: all 0.2s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

#send-btn {
  position: absolute;
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-color);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.chat-input button:hover {
  color: var(--user-color);
}

.icon {
  width: 22px;
  height: 22px;
}

/* Info do arquivo no chat */
.file-info-chat {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.file-info-chat.show {
  display: flex;
}

.file-info-chat .remove-file {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
}

.file-info-chat .remove-file:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border-color);
}

.modal-content h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
}

.modal-content p {
  margin-bottom: 20px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-chat);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Responsividade */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: absolute;
    z-index: 100;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .input-wrapper {
    width: 90%;
  }
  
  .user, .assistant {
    max-width: 90%;
  }
}