* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0a;
  --card: #141414;
  --card-border: #1f1f1f;
  --text: #e5e5e5;
  --text-muted: #737373;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --green-border: rgba(34, 197, 94, 0.3);
  --yellow: #eab308;
  --yellow-bg: rgba(234, 179, 8, 0.1);
  --yellow-border: rgba(234, 179, 8, 0.3);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --red-border: rgba(239, 68, 68, 0.3);
  --radius: 12px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  padding: 24px 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 24px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  color: white;
}

.header h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--accent);
  color: white;
}

.tab:hover:not(.active) {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

.card h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 20px 0 12px;
  color: var(--text);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed #2a2a2a;
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 20px;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.drop-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.drop-text {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.drop-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drop-formats {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Preview */
.preview-container {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--card-border);
  font-size: 13px;
  color: var(--text-muted);
}

.btn-remove {
  background: none;
  border: none;
  color: var(--red);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.preview-media {
  max-height: 300px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.preview-media img, .preview-media video {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}

/* Form */
.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
  resize: vertical;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.char-count {
  position: absolute;
  right: 8px;
  bottom: -18px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Tone Options */
.tone-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tone-option {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
}

.tone-option input {
  display: none;
}

.tone-option.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-secondary {
  padding: 14px 24px;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #16a34a;
  color: #000;
}

.btn-primary {
  flex: 1;
  padding: 14px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Traffic Light */
.traffic-light {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.light {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  transition: all 0.5s;
}

.light.active.green {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.light.active.yellow {
  background: var(--yellow);
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.5);
}

.light.active.red {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.risk-label {
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.risk-label.green { color: var(--green); }
.risk-label.yellow { color: var(--yellow); }
.risk-label.red { color: var(--red); }

.risk-score {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.risk-score span {
  font-weight: 700;
  color: var(--text);
}

.risk-bar {
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease, background 0.5s;
  width: 0%;
}

.risk-summary {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Problem Cards */
.problem-card {
  padding: 16px;
  border-radius: 8px;
  margin-top: 12px;
}

.problem-card.BAIXA {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.problem-card.MEDIA {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
}

.problem-card.ALTA, .problem-card.CRITICA {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

.problem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.problem-rule {
  font-size: 14px;
  font-weight: 700;
}

.problem-severity {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.problem-severity.BAIXA { background: var(--green); color: #000; }
.problem-severity.MEDIA { background: var(--yellow); color: #000; }
.problem-severity.ALTA { background: #f97316; color: #000; }
.problem-severity.CRITICA { background: var(--red); color: white; }

.problem-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.problem-fix {
  font-size: 13px;
  color: var(--green);
  padding-left: 12px;
  border-left: 2px solid var(--green);
}

/* Safety Tips */
#safetyTips ul {
  list-style: none;
  padding: 0;
}

#safetyTips li {
  padding: 8px 0 8px 20px;
  position: relative;
  font-size: 13px;
  color: var(--text-muted);
}

#safetyTips li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

/* Generated Content */
.gen-title-card, .gen-caption-card {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.gen-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.gen-text {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.gen-style {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 4px;
  color: var(--accent);
}

.btn-copy {
  background: none;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  float: right;
  transition: all 0.2s;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy.copied {
  border-color: var(--green);
  color: var(--green);
}

.hashtags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.hashtag {
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  color: #a78bfa;
  cursor: pointer;
}

.hashtag:hover {
  background: rgba(139, 92, 246, 0.2);
}

.tip-box {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.tip-box strong {
  color: var(--accent);
}

/* Precedent Section */
.precedent-verdict {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 8px;
}

.precedent-verdict.SEGURO {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.precedent-verdict.PARCIAL {
  color: var(--yellow);
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
}

.precedent-verdict.SEM_PRECEDENTE {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

.precedent-subject {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.precedent-terms {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.precedent-recommendation {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}

.portal-card {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.portal-name {
  font-size: 14px;
  font-weight: 700;
}

.portal-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
}

.portal-status.found {
  background: var(--green);
  color: #000;
}

.portal-status.not-found {
  background: #333;
  color: var(--text-muted);
}

.portal-link {
  display: block;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--card-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.portal-link-title {
  font-size: 13px;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

/* Guide */
.btn-guide {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.2s;
}

.btn-guide:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.guide-card {
  margin-bottom: 20px;
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.guide-header h2 {
  margin-bottom: 0;
}

.guide-section {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.guide-section.danger {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

.guide-section.safe {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.guide-section h3 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.guide-section.danger h3 { color: var(--red); }
.guide-section.safe h3 { color: var(--green); }

.guide-section ul {
  list-style: none;
  padding: 0;
}

.guide-section li {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  line-height: 1.5;
}

.guide-section li:last-child { border-bottom: none; }
.guide-section li strong { color: var(--text); }
.guide-section li em { color: var(--accent); font-style: normal; font-size: 12px; }

/* Footer */
.footer {
  padding: 32px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--card-border);
  margin-top: 40px;
}

/* Responsive */
@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .tabs {
    flex-direction: column;
  }

  .drop-zone {
    padding: 24px;
  }

  .traffic-light .light {
    width: 40px;
    height: 40px;
  }

  .tone-options {
    flex-direction: column;
  }
}
