/* Reset e estilos base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

:root {
  --background: #f9fafb;
  --foreground: #1f2937;
  --card: #ffffff;
  --border: #e5e7eb;
  --whatsapp: #25D366;
  --whatsapp-dark: #128C7E;
  --muted: #9ca3af;
  --radius: 0.5rem;
}

body {
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #6b7280;
  max-width: 36rem;
  margin: 0 auto;
}

/* Card e grid */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: background-color 0.2s;
  cursor: pointer;
}

.upload-area:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: 100%;
}

.upload-icon {
  margin-bottom: 0.75rem;
}

.whatsapp-color {
  color: var(--whatsapp);
}

.upload-text {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #4b5563;
}

.upload-text span {
  font-weight: 600;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* Contatos */
.contact-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.contact-count {
  font-size: 0.875rem;
  color: var(--muted);
}

.contact-table-container {
  max-height: 10rem;
  overflow-y: auto;
}

.contact-table {
  width: 100%;
  border-collapse: collapse;
}

.contact-table th {
  background-color: #f9fafb;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.contact-table td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.contact-table tr:last-child td {
  border-bottom: none;
}

.text-center {
  text-align: center;
}

/* Compositor de mensagem */
.message-composer {
  margin-top: 1rem;
}

.composer-hint {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.message-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  font-size: 0.875rem;
}

.message-textarea:focus {
  outline: 2px solid rgba(37, 211, 102, 0.5);
  border-color: var(--whatsapp);
}

/* Preview */
.preview-container {
  height: 18rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: #f9fafb;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-placeholder {
  color: var(--muted);
  text-align: center;
}

.preview-chat {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.contact-avatar {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--whatsapp);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.contact-name {
  font-weight: medium;
}

.contact-number {
  font-size: 0.875rem;
  color: var(--muted);
}

.message-bubble {
  background-color: var(--whatsapp);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  max-width: 80%;
  align-self: flex-end;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Botão */
.send-button {
  background-color: var(--whatsapp);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 1rem;
  width: 100%;
}

.send-button:hover {
  background-color: var(--whatsapp-dark);
}

.send-button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

/* Instruções */
.instructions {
  text-align: center;
  margin-top: 2rem;
  color: var(--muted);
}

.instructions-list {
  max-width: 28rem;
  margin: 0 auto;
  padding-left: 1.5rem;
  text-align: left;
  list-style-type: decimal;
}

.instructions-list li {
  margin-bottom: 0.5rem;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
}

.toast {
  background: white;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.3s ease-out forwards;
}

.toast-success {
  border-left: 4px solid var(--whatsapp);
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-loading {
  border-left: 4px solid #3b82f6;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.preview-button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.preview-button:hover {
  color: var(--whatsapp);
}

.selected-row {
  background-color: #f3f4f6;
}
