/* Rano AI - Tema escuro avançado com gradiente */
:root {
  --bg: #0f0f23;
  --bg-secondary: #1a1a2e;
  --bg-card: rgba(26, 32, 44, 0.8);
  --border: #2d3748;
  --text: #e2e8f0;
  --text-muted: #a0aec0;
  --primary: #667eea;
  --primary-hover: #764ba2;
  --accent: #f093fb;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
  --radius-lg: 20px;
  --font: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { 
  margin: 0; 
  font-family: var(--font); 
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  color: var(--text); 
  line-height: 1.5; 
  min-height: 100vh;
  background-attachment: fixed;
}
html { scroll-behavior: smooth; }

/* Landing */
.landing { display: flex; flex-direction: column; min-height: 100vh; }
.header { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 1rem 2rem; 
  border-bottom: 1px solid var(--border); 
  background: rgba(15, 15, 35, 0.9); 
  position: sticky; 
  top: 0; 
  z-index: 100; 
  backdrop-filter: blur(12px);
  animation: slideDown 0.6s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.logo { 
  font-weight: 700; 
  font-size: 1.25rem; 
  color: var(--text); 
  text-decoration: none; 
  display: inline-flex; 
  align-items: center; 
  gap: 0.4rem;
  transition: all 0.3s ease;
  animation: fadeIn 0.8s ease;
}
.logo:hover {
  transform: scale(1.05);
}
.logo i { 
  color: var(--primary);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.logo .version { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; }
.nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.btn { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 0.4rem; 
  padding: 0.5rem 1rem; 
  border-radius: 10px; 
  font-family: inherit; 
  font-size: 0.9rem; 
  font-weight: 500; 
  cursor: pointer; 
  text-decoration: none; 
  border: none; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}
.btn:hover::before {
  left: 100%;
}
.btn:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}
.btn-ghost { 
  background: rgba(26, 32, 44, 0.6);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { 
  background: rgba(102, 126, 234, 0.1);
  color: var(--text);
  border-color: var(--primary);
}
.btn-primary { 
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff; 
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  border: none;
}
.btn-primary:hover { 
  background: linear-gradient(135deg, var(--primary-hover), var(--accent));
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
  transform: translateY(-2px) scale(1.02);
}
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(139,122,219,0.15); }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

/* Hero */
.hero { 
  text-align: center; 
  padding: 5rem 2rem 4rem; 
  position: relative; 
  overflow: hidden;
  animation: fadeInUp 0.8s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-glow { 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  width: 800px; 
  height: 800px; 
  margin: -400px 0 0 -400px; 
  background: radial-gradient(circle, rgba(102,126,234,0.2) 0%, rgba(118,75,162,0.1) 40%, transparent 70%); 
  pointer-events: none;
  animation: glow 4s ease-in-out infinite alternate;
}
@keyframes glow {
  from { transform: scale(1); opacity: 0.5; }
  to { transform: scale(1.1); opacity: 0.8; }
}
.hero-badge { 
  display: inline-block; 
  font-size: 0.8rem; 
  color: var(--primary); 
  background: rgba(102, 126, 234, 0.15);
  padding: 0.35rem 0.9rem; 
  border-radius: 100px; 
  margin: 0 0 1.25rem; 
  font-weight: 500; 
  border: 1px solid rgba(102, 126, 234, 0.3);
  backdrop-filter: blur(10px);
  animation: fadeIn 1s ease 0.2s both;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.hero-title { 
  font-size: clamp(2.25rem, 6vw, 3.5rem); 
  font-weight: 800; 
  margin: 0 0 1rem; 
  letter-spacing: -0.02em; 
  line-height: 1.15;
  animation: fadeIn 1s ease 0.4s both;
}
.hero-title .highlight { 
  display: inline-block;
  padding: 0.08em 0;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover), var(--accent));
  -webkit-background-clip: text; 
  -webkit-text-fill-color: transparent; 
  background-clip: text;
  animation: textGlow 3s ease-in-out infinite alternate;
}
@keyframes textGlow {
  from { filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.5)); }
  to { filter: drop-shadow(0 0 30px rgba(240, 147, 251, 0.8)); }
}
.hero-subtitle { 
  font-size: 1.15rem; 
  color: var(--text-muted); 
  max-width: 560px; 
  margin: 0 auto 2rem; 
  line-height: 1.6;
  animation: fadeIn 1s ease 0.6s both;
}
.hero-cta { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 1rem; 
  justify-content: center; 
  margin-bottom: 2.5rem;
  animation: fadeIn 1s ease 0.8s both;
}
.hero-stats { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 2rem; 
  justify-content: center; 
  font-size: 0.95rem; 
  color: var(--text-muted);
  animation: fadeIn 1s ease 1s both;
}
.hero-stats strong { 
  color: var(--primary); 
  font-weight: 600;
  animation: pulse 2s infinite;
}

.section-title { 
  text-align: center; 
  font-size: clamp(1.75rem, 4vw, 2.25rem); 
  font-weight: 700; 
  margin: 0 0 0.5rem; 
  padding: 0 1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeIn 1s ease both;
}
.section-subtitle { 
  text-align: center; 
  color: var(--text-muted); 
  max-width: 520px; 
  margin: 0 auto 2.5rem; 
  font-size: 1rem;
  animation: fadeIn 1s ease 0.2s both;
}

/* How it works */
.how-it-works { 
  padding: 4rem 2rem; 
  background: linear-gradient(180deg, transparent 0%, rgba(102,126,234,0.08) 50%, transparent 100%);
  position: relative;
}
.steps { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
  gap: 2rem; 
  max-width: 960px; 
  margin: 0 auto; 
}
.step { 
  text-align: center; 
  padding: 1.75rem 1.25rem; 
  background: var(--bg-card); 
  border-radius: var(--radius); 
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.6s ease both;
}
.step::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.step:hover::before {
  transform: scaleX(1);
}
.step:hover { 
  transform: translateY(-8px); 
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
  border-color: var(--primary);
}
.step-num { 
  width: 48px; 
  height: 48px; 
  margin: 0 auto 1rem; 
  border-radius: 50%; 
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff; 
  font-weight: 700; 
  font-size: 1.25rem; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  transition: all 0.3s ease;
}
.step:hover .step-num {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}
.step h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.step p { margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* Plans */
.plans { 
  padding: 4rem 2rem;
  background: linear-gradient(180deg, transparent 0%, rgba(118,75,162,0.06) 50%, transparent 100%);
}
.plan-cards { 
  display: grid; 
  grid-template-columns: repeat(4, 1fr); 
  gap: 1.5rem; 
  max-width: 1100px; 
  margin: 0 auto; 
}
.plan-card { 
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  padding: 1.75rem; 
  position: relative; 
  display: flex; 
  flex-direction: column;
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  animation: slideInUp 0.6s ease both;
}
.plan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover), var(--accent));
  transform: scaleX(0);
  transition: transform 0.4s ease;
}
.plan-card:hover::before {
  transform: scaleX(1);
}
.plan-card:hover { 
  transform: translateY(-12px); 
  box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4);
  border-color: var(--primary);
}
.plan-card.featured { 
  border-color: var(--primary); 
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 0 15px 35px rgba(102, 126, 234, 0.25);
  transform: scale(1.02);
}
.plan-card.featured:hover { 
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5), 0 30px 60px rgba(102, 126, 234, 0.35);
  transform: scale(1.05) translateY(-8px);
}
.plan-card .badge { 
  position: absolute; 
  top: 12px; 
  right: 1rem; 
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  animation: pulse 2s infinite;
}
.plan-card h3 { margin: 0 0 0.25rem; font-size: 1.35rem; font-weight: 700; }
.plan-credits { color: var(--primary); font-weight: 700; font-size: 1.1rem; margin: 0 0 0.5rem; }
.plan-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.25rem; line-height: 1.4; }
.plan-card ul { list-style: none; padding: 0; margin: 0 0 1.5rem; flex: 1; }
.plan-card li { padding: 0.35rem 0; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.plan-card li i { color: var(--success); flex-shrink: 0; }
.plan-btn { margin-top: auto; text-align: center; }

/* Features */
.features { 
  padding: 4rem 2rem;
  background: linear-gradient(180deg, transparent 0%, rgba(102,126,234,0.08) 50%, transparent 100%);
}
.feature-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
  gap: 1.5rem; 
  max-width: 1100px; 
  margin: 0 auto; 
}
.feature-item { 
  background: var(--bg-card); 
  padding: 2rem 1.5rem; 
  border-radius: var(--radius-lg); 
  text-align: center; 
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.6s ease both;
}
.feature-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.feature-item:hover::before {
  transform: scaleX(1);
}
.feature-item:hover { 
  transform: translateY(-8px); 
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
  border-color: var(--primary);
}
.feature-icon { 
  width: 56px; 
  height: 56px; 
  margin: 0 auto 1rem; 
  border-radius: 14px; 
  background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(240,147,251,0.2));
  color: var(--primary); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 1.5rem;
  transition: all 0.3s ease;
}
.feature-item:hover .feature-icon {
  transform: scale(1.1) rotate(5deg);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}
.feature-item h4 { margin: 0 0 0.5rem; font-size: 1.05rem; font-weight: 600; }
.feature-item p { margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* CTA */
.cta-section { 
  padding: 4rem 2rem;
  background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(240,147,251,0.1) 100%);
  position: relative;
  overflow: hidden;
}
.cta-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(102,126,234,0.1) 0%, transparent 70%);
  animation: glow 4s ease-in-out infinite alternate;
}
.cta-box { 
  max-width: 640px; 
  margin: 0 auto; 
  text-align: center; 
  padding: 3rem 2rem; 
  background: rgba(26, 32, 44, 0.8);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
  animation: slideInUp 0.6s ease both;
}
.cta-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
  border-color: var(--primary);
}
.cta-box h2 { 
  margin: 0 0 0.75rem; 
  font-size: 1.75rem; 
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cta-box p { 
  color: var(--text-muted); 
  margin: 0 0 1.5rem; 
  font-size: 1rem;
}

/* Footer */
.footer { margin-top: auto; border-top: 1px solid var(--border); padding: 3rem 2rem 2rem; background: var(--bg-card); }
.footer-inner { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto auto; gap: 2rem; align-items: start; }
.footer-brand .logo { margin-bottom: 0.5rem; }
.footer-brand p { margin: 0; font-size: 0.9rem; color: var(--text-muted); max-width: 240px; }
.footer-links { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--primary); }
.footer-copy { grid-column: 1 / -1; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.footer-copy p { margin: 0; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; padding: 1rem; }
.modal.open { opacity: 1; visibility: visible; }
.modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; max-width: 420px; width: 100%; position: relative; transform: scale(0.95); transition: transform 0.25s; border: 1px solid var(--border); }
.modal.open .modal-content { transform: scale(1); }
.modal-lg { max-width: 560px; }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 0.25rem; }
.modal-close:hover { color: var(--text); }
.modal h2 { margin: 0 0 1.5rem; font-size: 1.5rem; }
.modal label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; color: var(--text-muted); }
.modal input[type="text"], .modal input[type="email"], .modal input[type="password"], .modal input[type="search"] { width: 100%; padding: 0.6rem 0.75rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; }
.modal-footer { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); }
.modal-footer a { color: var(--primary); text-decoration: none; }
.modal-footer a:hover { text-decoration: underline; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.5rem; }
.settings-section { margin-bottom: 1.5rem; }
.settings-section h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.settings-section input { margin-bottom: 0.5rem; }
.upgrade-options { display: flex; flex-direction: column; gap: 0.5rem; }
.upgrade-btn { padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; cursor: pointer; text-align: left; transition: background 0.2s; }
.upgrade-btn:hover { background: var(--bg-card); border-color: var(--primary); }
.search-input { margin-bottom: 1rem; }

/* Toast */
#toastContainer { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1.25rem; border-radius: 8px; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.3); transform: translateX(120%); opacity: 0; transition: transform 0.3s, opacity 0.3s; max-width: 320px; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--error); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

/* Chat page */
.chat-page { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border); }
.user-card { padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; border-bottom: 1px solid var(--border); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.25rem; }
.user-name { font-weight: 600; font-size: 0.95rem; }
.plan-badge { font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 6px; background: rgba(139,122,219,0.3); color: var(--primary); text-transform: capitalize; }
.credits-bar { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.credits-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.credits-progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.credits-fill { height: 100%; background: var(--primary); border-radius: 3px; width: 100%; transition: width 0.3s; }
.sidebar-nav { padding: 0.5rem; flex: 1; }
.nav-btn { width: 100%; padding: 0.65rem 1rem; border: none; border-radius: 8px; background: transparent; color: var(--text); font-family: inherit; font-size: 0.9rem; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 0.5rem; transition: background 0.2s; }
.nav-btn:hover { background: rgba(139,122,219,0.15); }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.welcome { text-align: center; padding: 3rem 2rem; }
.welcome-avatar { width: 80px; height: 80px; margin: 0 auto 1rem; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.welcome h2 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.welcome p { color: var(--text-muted); margin: 0; }

.msg { display: flex; gap: 1rem; max-width: 800px; animation: slideUp 0.35s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .msg-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.msg.user .msg-avatar { background: var(--primary); color: #fff; }
.msg.assistant .msg-avatar { background: var(--bg-card); color: var(--primary); border: 1px solid var(--border); }
.msg-bubble { padding: 0.85rem 1.1rem; border-radius: var(--radius); max-width: 85%; }
.msg.user .msg-bubble { background: var(--primary); color: #fff; }
.msg.assistant .msg-bubble { background: var(--bg-card); border: 1px solid var(--border); }
.msg-bubble .content { font-size: 0.95rem; line-height: 1.6; }
.msg-bubble .content p { margin: 0 0 0.5rem; }
.msg-bubble .content p:last-child { margin-bottom: 0; }
.msg-bubble .content pre { background: #0d1117; border-radius: 8px; padding: 1rem; overflow-x: auto; margin: 0.5rem 0; }
.msg-bubble .content code { font-family: 'Consolas', monospace; font-size: 0.85rem; }
.msg-bubble .content pre code { padding: 0; background: none; }
.msg-bubble .copy-btn { margin-top: 0.5rem; padding: 0.25rem 0.5rem; font-size: 0.75rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text-muted); cursor: pointer; }
.msg-bubble .copy-btn:hover { color: var(--primary); }
.msg-typing { color: var(--text-muted); font-size: 0.9rem; }
.history-list { max-height: 360px; overflow-y: auto; }
.history-item { padding: 0.75rem 1rem; border-radius: 8px; cursor: pointer; margin-bottom: 0.35rem; border: 1px solid transparent; transition: background 0.2s, border-color 0.2s; display: flex; justify-content: space-between; align-items: center; }
.history-item:hover { background: var(--bg); border-color: var(--border); }
.history-item .title { font-weight: 500; }
.history-item .meta { font-size: 0.8rem; color: var(--text-muted); }
.history-item .del-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.25rem; }
.history-item .del-btn:hover { color: var(--error); }

.chat-form { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.input-wrap { display: flex; align-items: flex-end; gap: 0.5rem; max-width: 800px; margin: 0 auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 200px; padding: 0.6rem 0.75rem; border: none; background: transparent; color: var(--text); font-family: inherit; font-size: 0.95rem; resize: none; }
.chat-form textarea::placeholder { color: var(--text-muted); }
.chat-form textarea:focus { outline: none; }
.btn-voice { width: 40px; height: 40px; border: none; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; }
.btn-voice:hover { color: var(--primary); }
.btn-voice.recording { color: var(--error); }
.btn-send { width: 40px; height: 40px; border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; }
.btn-send:hover { background: var(--primary-hover); }
.btn-send:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Landing responsive */
@media (max-width: 1024px) {
  .plan-cards { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr auto; }
}
@media (max-width: 768px) {
  .header .nav a:not(.btn-primary) { display: none; }
  .header .nav a.btn-primary { display: inline-flex; }
  .hero { padding: 3rem 1rem 2.5rem; }
  .hero-cta { flex-direction: column; }
  .hero-stats { gap: 1.25rem; }
  .steps { grid-template-columns: 1fr; }
  .plan-cards { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-brand p { max-width: none; }
  .footer-links { flex-direction: row; justify-content: center; }
}
@media (max-width: 480px) {
  .hero-title { font-size: 1.85rem; }
  .cta-box { padding: 2rem 1.25rem; }
}

/* Analytics Styles */
.analytics-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  flex-wrap: wrap;
}

.analytics-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analytics-tab:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--text);
}

.analytics-tab.active {
  background: var(--primary);
  color: white;
}

.analytics-content {
  min-height: 400px;
}

.analytics-panel {
  display: none;
}

.analytics-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.analytics-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
  border-color: var(--primary);
}

.analytics-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(240,147,251,0.2));
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.analytics-info h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.analytics-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

.analytics-change {
  font-size: 0.8rem;
  font-weight: 500;
}

.analytics-change.positive {
  color: var(--success);
}

.analytics-change.negative {
  color: var(--error);
}

.analytics-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.analytics-chart h3 {
  margin: 0 0 1rem;
  color: var(--text);
}

/* Usage Stats */
.usage-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.usage-item h4 {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: 1.1rem;
}

.usage-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.usage-bar span:first-child {
  min-width: 100px;
  font-size: 0.9rem;
  color: var(--text);
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-value {
  min-width: 40px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.endpoint-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.endpoint-stat {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.endpoint-stat i {
  color: var(--primary);
  width: 20px;
}

.endpoint-stat div {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.endpoint-name {
  font-size: 0.9rem;
  color: var(--text);
}

.endpoint-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Rate Limiting */
.rate-limit-config {
  margin-bottom: 2rem;
}

.rate-limit-config h3 {
  margin: 0 0 1rem;
  color: var(--text);
}

.rate-limits {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rate-limit-item {
  display: grid;
  grid-template-columns: 200px 150px 1fr;
  align-items: center;
  gap: 1rem;
}

.rate-limit-item label {
  font-size: 0.9rem;
  color: var(--text);
}

.rate-limit-item input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.rate-current {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rate-status h3 {
  margin: 0 0 1rem;
  color: var(--text);
}

.status-indicators {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green {
  background: var(--success);
}

.status-dot.yellow {
  background: #f59e0b;
}

.status-dot.red {
  background: var(--error);
}

/* Playground */
.playground-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.playground-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.form-group select,
.form-group textarea,
.form-group input[type="number"] {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.form-group input[type="range"] {
  width: 100%;
}

.playground-response h4 {
  margin: 0 0 1rem;
  color: var(--text);
}

.response-box {
  min-height: 200px;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-y: auto;
}

.response-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.response-meta {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Alerts */
.alerts-container h3 {
  margin: 0 0 1rem;
  color: var(--text);
}

.alert-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.alert-filter {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

.alert-filter:hover {
  background: var(--bg-card);
}

.alert-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.alert-item.high {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.alert-item.medium {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.alert-item.low {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-item.high .alert-icon {
  background: var(--error);
  color: white;
}

.alert-item.medium .alert-icon {
  background: #f59e0b;
  color: white;
}

.alert-item.low .alert-icon {
  background: #3b82f6;
  color: white;
}

.alert-content {
  flex: 1;
}

.alert-content h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: var(--text);
}

.alert-content p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.alert-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.alert-actions {
  flex-shrink: 0;
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;

  &:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  }
}

/* Responsive for Analytics */
@media (max-width: 1024px) {
  .usage-stats {
    grid-template-columns: 1fr;
  }
  
  .playground-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .analytics-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .rate-limit-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Chat page responsive */
@media (max-width: 768px) {
  .sidebar { width: 72px; }
  .user-card .user-name, .plan-badge, .credits-label span:first-child, .nav-btn span { display: none; }
  .nav-btn { justify-content: center; }
  .credits-bar { padding: 0.5rem; }
}

.faq-section {
  padding: 2rem 2rem 4rem;
}

.faq-inner {
  max-width: 900px;
  margin: 0 auto;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-question {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.faq-item[open] > .faq-question::after {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-answer {
  padding: 0 1.1rem 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-answer p {
  margin: 0.25rem 0 0;
}

/* ========================================
   ANIMAÇÕES DE SCROLL
   ======================================== */

/* Estado inicial dos elementos animados */
.animate-on-scroll {
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fade in - aparece suavemente de baixo */
.fade-in-scroll {
  transform: translateY(60px);
}

/* Slide da esquerda */
.slide-left-scroll {
  transform: translateX(-80px);
}

/* Slide da direita */
.slide-right-scroll {
  transform: translateX(80px);
}

/* Slide de baixo para cima */
.slide-up-scroll {
  transform: translateY(80px);
}

/* Scale up - aumenta de tamanho */
.scale-up-scroll {
  transform: scale(0.85);
}

/* Rotate in - rotaciona enquanto aparece */
.rotate-in-scroll {
  transform: rotate(-8deg) scale(0.9);
}

/* Blur in - desfoca enquanto aparece */
.blur-in-scroll {
  filter: blur(8px);
  transform: translateY(40px);
}

/* Estado quando o elemento está visível */
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1) rotate(0);
  filter: blur(0);
}

/* Delays para criar efeito em cascata */
.scroll-delay-1 {
  transition-delay: 0.1s;
}

.scroll-delay-2 {
  transition-delay: 0.2s;
}

.scroll-delay-3 {
  transition-delay: 0.3s;
}

.scroll-delay-4 {
  transition-delay: 0.4s;
}

.scroll-delay-5 {
  transition-delay: 0.5s;
}

.scroll-delay-6 {
  transition-delay: 0.6s;
}

/* Animação especial para títulos e seções */
.section-title.animate-on-scroll,
.hero-title.animate-on-scroll {
  transition-duration: 1s;
}

/* Animação de bounce suave ao aparecer */
.bounce-in-scroll {
  transform: scale(0.3);
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bounce-in-scroll.visible {
  transform: scale(1);
}

/* Animação de slide com fade lateral */
.slide-fade-scroll {
  opacity: 0;
  transform: translateX(-100px);
  transition: all 0.8s ease-out;
}

.slide-fade-scroll.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Animação especial para cards em grid */
.grid-item-scroll {
  opacity: 0;
  transform: translateY(40px) scale(0.95);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-item-scroll.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Animação de reveal com linha */
.reveal-line-scroll {
  position: relative;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.reveal-line-scroll::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.8s ease 0.3s;
}

.reveal-line-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-line-scroll.visible::before {
  width: 100%;
}

/* Animação de flip 3D */
.flip-in-scroll {
  opacity: 0;
  transform: perspective(1000px) rotateX(-15deg);
  transform-origin: center;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.flip-in-scroll.visible {
  opacity: 1;
  transform: perspective(1000px) rotateX(0);
}

/* Animação stagger para listas */
.stagger-item-scroll {
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.5s ease;
}

.stagger-item-scroll:nth-child(1) { transition-delay: 0.1s; }
.stagger-item-scroll:nth-child(2) { transition-delay: 0.2s; }
.stagger-item-scroll:nth-child(3) { transition-delay: 0.3s; }
.stagger-item-scroll:nth-child(4) { transition-delay: 0.4s; }
.stagger-item-scroll:nth-child(5) { transition-delay: 0.5s; }
.stagger-item-scroll:nth-child(6) { transition-delay: 0.6s; }

.stagger-item-scroll.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Animação de zoom in */
.zoom-in-scroll {
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-in-scroll.visible {
  opacity: 1;
  transform: scale(1);
}

/* Animação de glow effect */
.glow-in-scroll {
  opacity: 0;
  transform: translateY(30px);
  filter: brightness(0.7);
  transition: all 0.8s ease;
}

.glow-in-scroll.visible {
  opacity: 1;
  transform: translateY(0);
  filter: brightness(1);
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

/* Preferência de movimento reduzido (acessibilidade) */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .fade-in-scroll,
  .slide-left-scroll,
  .slide-right-scroll,
  .slide-up-scroll,
  .scale-up-scroll,
  .rotate-in-scroll,
  .blur-in-scroll,
  .bounce-in-scroll,
  .slide-fade-scroll,
  .grid-item-scroll,
  .reveal-line-scroll,
  .flip-in-scroll,
  .stagger-item-scroll,
  .zoom-in-scroll,
  .glow-in-scroll {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}