@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

:root {
  --bg: #020617;
  --card: rgba(255, 255, 255, 0.06);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #38bdf8;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #020617;
  --muted: #475569;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 32px;
}

#themeToggle {
  position: fixed;
  top: 16px;
  right: 16px;
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
}

.container {
  width: 100%;
  max-width: 760px;
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  backdrop-filter: blur(12px);

  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
}

header {
  text-align: center;
  margin-bottom: 24px;
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border-radius: 10px;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

textarea::placeholder {
  color: var(--muted);
}

.divider {
  text-align: center;
  margin: 16px 0;
  color: var(--muted);
}

#dropZone {
  border: 2px dashed var(--muted);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
}

button {
  position: relative;
  margin-top: 20px;
  width: 100%;
  height: 52px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.hidden {
  display: none;
}

#loader {
  margin: 0 auto;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#result {
  margin-top: 32px;
}

.meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

#historyList {
  display: grid;
  gap: 12px;
}

.history-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.history-card strong {
  font-size: 13px;
}

.history-card .produtivo {
  color: #22c55e;
}

.history-card .improdutivo {
  color: #facc15;
}

.history-card small {
  color: var(--muted);
  display: block;
  margin: 4px 0;
}

.history-card em {
  font-style: normal;
  font-size: 13px;
  color: var(--text);
}

#themeToggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
}

#themeToggle:hover {
  transform: scale(1.08);
}

#themeToggle .icon {
  font-size: 18px;
}

.footer {
  margin-top: auto;
  padding-top: 24px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.25s ease;
}

.footer-links a:hover {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  transform: translateY(-2px);
}

.form-error {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text);
}

/* Ações do histórico */
.history-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

#clearHistory {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.25s;
}

#clearHistory:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* Botão remover do histórico (ultra compacto) */
.remove-item {
  margin-top: 6px;
  align-self: flex-end;

  display: inline-flex;
  align-items: center;
  gap: 3px;

  padding: 3px 5px;
  border-radius: 999px;

  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);

  color: #ef4444;
  font-size: 10px;
  font-weight: 600;

  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-item:hover {
  background: #ef4444;
  color: #fff;
}

.remove-item:active {
  transform: scale(0.94);
}

.trash-icon {
  font-size: 11px;
}

#aiResponse {
  white-space: pre-line;
  background: rgba(255, 255, 255, 0.05);
  padding: 16px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 14px;
}

.copy-btn {
  margin-top: 14px;
  width: fit-content;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.copy-btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

.copy-btn.copied {
  background: #22c55e;
}

.remove-item.icon-only {
  padding: 4px;
  width: 22px;
  height: 22px;
  justify-content: center;
}
