/* ============================================
   Sabiomz v2 — Design System
   Cores: #0A1F44 (azul) + #00FF9C (verde)
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:       #0A1F44;
  --bg-2:     #0d2554;
  --panel:    #0f2a5e;
  --panel-2:  #142f6a;
  --text:     #E8EEFB;
  --muted:    #9DB0D6;
  --accent:   #00FF9C;
  --accent-2: #00d685;
  --danger:   #ff5555;
  --warn:     #ffaa00;
  --border:   rgba(255,255,255,.08);
  --shadow:   0 10px 30px rgba(0,0,0,.4);
  --radius:   14px;
  --font:     'Inter', -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg:      #f4f6fb;
  --bg-2:    #ffffff;
  --panel:   #ffffff;
  --panel-2: #eef1f8;
  --text:    #0A1F44;
  --muted:   #5b6b8a;
  --border:  rgba(10,31,68,.1);
  --shadow:  0 8px 24px rgba(0,0,0,.12);
}

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; color: inherit; }
img { max-width: 100%; }

/* ── Layout ── */
.app   { display: flex; min-height: 100vh; }
.main  { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-width: 0; animation: fadeIn .35s ease; }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: 260px; height: 100vh;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px; z-index: 50;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-weight: 700; font-size: 20px; }
.logo-dot {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #00b56e);
  box-shadow: 0 0 20px rgba(0,255,156,.45);
  display: flex; align-items: center; justify-content: center;
}
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); transition: all .2s; font-size: 14.5px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--panel); color: var(--text); transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(0,255,156,.15), transparent);
  color: var(--accent); border-left: 3px solid var(--accent); padding-left: 9px;
}
.sidebar-footer { padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--panel); border-radius: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #00b56e); color: #03130b; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-name  { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-plan  { font-size: 10px; color: var(--accent); letter-spacing: .5px; font-weight: 600; }
.plan-badge { display: inline-block; font-size: 9px; padding: 2px 7px; border-radius: 5px; font-weight: 700; letter-spacing: .5px; }
.plan-free  { background: rgba(157,176,214,.15); color: var(--muted); }
.plan-pro   { background: rgba(0,200,255,.15);   color: #00c8ff; }
.plan-black { background: rgba(200,150,255,.15); color: #c896ff; }

/* ── Hamburger ── */
.hamburger {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 60;
  background: var(--panel); border: 1px solid var(--border);
  width: 42px; height: 42px; border-radius: 10px; cursor: pointer;
  align-items: center; justify-content: center;
}
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; backdrop-filter: blur(4px); }
.overlay.show { display: block; animation: fadeIn .2s; }

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03130b; font-weight: 600; padding: 11px 18px;
  border: none; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s; box-shadow: 0 4px 16px rgba(0,255,156,.2);
  font-size: 14px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,255,156,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 10px 16px; border-radius: 10px;
  cursor: pointer; text-align: center; transition: all .2s; font-size: 14px;
}
.btn-ghost:hover { background: var(--panel); border-color: var(--accent); }
.btn-danger { background: rgba(255,85,85,.15); color: var(--danger); border: 1px solid rgba(255,85,85,.3); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .2s; }
.btn-danger:hover { background: rgba(255,85,85,.3); }

/* ── Container ── */
.container { padding: 24px 32px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.page-sub   { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

/* ── Cards ── */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  transition: all .25s; cursor: pointer; animation: fadeUp .4s ease backwards;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0,255,156,.1); }
.card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; color: #03130b;
}
.card h3 { font-size: 16px; margin-bottom: 6px; }
.card p   { color: var(--muted); font-size: 13px; line-height: 1.5; }
.badge {
  display: inline-block; font-size: 10px; padding: 3px 8px;
  border-radius: 6px; background: rgba(0,255,156,.15);
  color: var(--accent); font-weight: 700; letter-spacing: .5px; margin-top: 8px;
}
.badge-pro   { background: rgba(0,200,255,.15); color: #00c8ff; }
.badge-black { background: rgba(200,150,255,.15); color: #c896ff; }

/* ── Forms ── */
.form-card {
  max-width: 440px; margin: 50px auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 34px; animation: fadeUp .4s;
}
.form-card h2 { margin-bottom: 4px; font-size: 22px; }
.form-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); font-weight: 500; }
.field input,
.field select,
.field textarea {
  width: 100%; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; transition: border-color .2s; color: var(--text);
}
.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,255,156,.1); }
.form-card button  { width: 100%; margin-top: 8px; }
.form-link { text-align: center; margin-top: 16px; color: var(--muted); font-size: 13px; }
.form-link a { color: var(--accent); font-weight: 600; }
.alert-error   { background: rgba(255,85,85,.12); color: #ff8080; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; border: 1px solid rgba(255,85,85,.2); }
.alert-success { background: rgba(0,255,156,.1);  color: var(--accent); padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; border: 1px solid rgba(0,255,156,.2); }

/* ── Chat ── */
.chat-wrap { display: flex; flex: 1; height: 100vh; overflow: hidden; }
.chat-list {
  width: 260px; border-right: 1px solid var(--border);
  background: var(--bg-2); display: flex; flex-direction: column; padding: 14px; gap: 6px;
  overflow-y: auto; flex-shrink: 0;
}
.chat-list h4 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 8px 4px 4px; }
.conv-item {
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  color: var(--muted); transition: all .15s; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px;
}
.conv-item:hover  { background: var(--panel); color: var(--text); }
.conv-item.active { background: var(--panel); color: var(--text); border-left: 2px solid var(--accent); padding-left: 10px; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.chat-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.chat-topbar-title { font-weight: 600; font-size: 15px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px 20px; scroll-behavior: smooth; }
.msg { max-width: 780px; margin: 0 auto 20px; display: flex; gap: 12px; animation: fadeUp .3s; }
.msg.user      { flex-direction: row-reverse; }
.msg .av       { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.msg.user  .av { background: #1f3a7a; color: #fff; }
.msg.ai    .av { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #03130b; }
.msg-body { flex: 1; line-height: 1.7; font-size: 14.5px; padding: 12px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); word-wrap: break-word; }
.msg.user .msg-body { background: rgba(0,255,156,.1); border-color: rgba(0,255,156,.2); color: #c8ffe8; }

/* Markdown no chat */
.msg-body h1,.msg-body h2,.msg-body h3 { margin: 14px 0 8px; font-weight: 600; color: var(--text); }
.msg-body h1 { font-size: 18px; }
.msg-body h2 { font-size: 16px; }
.msg-body h3 { font-size: 15px; color: var(--accent); }
.msg-body p  { margin-bottom: 10px; }
.msg-body ul,.msg-body ol { padding-left: 20px; margin-bottom: 10px; }
.msg-body li { margin-bottom: 4px; }
.msg-body code { background: var(--panel-2); padding: 2px 7px; border-radius: 5px; font-size: 13px; font-family: 'Courier New', monospace; color: var(--accent); }
.msg-body pre  { background: var(--panel-2); padding: 14px; border-radius: 10px; overflow-x: auto; margin: 10px 0; border: 1px solid var(--border); }
.msg-body pre code { background: transparent; padding: 0; color: var(--text); }
.msg-body strong { font-weight: 700; color: var(--text); }
.msg-body em     { font-style: italic; color: var(--muted); }
.msg-body blockquote { border-left: 3px solid var(--accent); padding: 8px 14px; margin: 10px 0; color: var(--muted); background: rgba(0,255,156,.05); border-radius: 0 8px 8px 0; }
.msg-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.msg-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.msg-actions button { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12px; transition: all .2s; }
.msg-actions button:hover { background: var(--panel-2); color: var(--text); border-color: var(--accent); }

.thinking { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

.chat-input-wrap { padding: 12px 20px 20px; background: var(--bg); border-top: 1px solid var(--border); }
.chat-input {
  max-width: 780px; margin: 0 auto;
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px 8px 8px 14px; transition: border-color .2s;
}
.chat-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,255,156,.08); }
.chat-input textarea { flex: 1; background: transparent; border: none; resize: none; font-size: 14.5px; max-height: 180px; outline: none; line-height: 1.6; padding: 6px 0; color: var(--text); }
.chat-input textarea::placeholder { color: var(--muted); }
.chat-input button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  color: #03130b; display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.chat-input button:hover    { transform: scale(1.05); }
.chat-input button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.limit-warn { max-width: 780px; margin: 0 auto 12px; background: rgba(255,170,0,.1); border: 1px solid rgba(255,170,0,.3); color: var(--warn); padding: 10px 14px; border-radius: 10px; font-size: 13px; text-align: center; }
.limit-warn a { color: var(--accent); font-weight: 600; }

/* ── Hero ── */
.hero { text-align: center; padding: 60px 24px 40px; }
.hero h1 { font-size: clamp(28px, 5vw, 50px); font-weight: 800; line-height: 1.1; margin-bottom: 14px; background: linear-gradient(135deg, var(--text), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p   { color: var(--muted); font-size: 16px; max-width: 580px; margin: 0 auto 28px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(8px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.show { display: flex; animation: fadeIn .25s; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 30px; max-width: 440px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { font-size: 20px; margin-bottom: 10px; }
.modal p  { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.6; }
.modal-close { position: absolute; top: 16px; right: 16px; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 20px; }

/* ── Admin table ── */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: var(--panel-2); }
th,td { padding: 12px 14px; text-align: left; }
th    { font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
tbody tr { border-top: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: var(--panel-2); }

/* ── Planos ── */
.plans-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 8px; }
.plan-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 28px; position: relative; transition: all .25s; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 16px 40px rgba(0,255,156,.1); }
.plan-price { font-size: 36px; font-weight: 800; margin: 10px 0 4px; color: var(--text); }
.plan-price span { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan-features { list-style: none; margin: 16px 0 22px; display: flex; flex-direction: column; gap: 8px; }
.plan-features li { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.plan-features li::before { content: '✓'; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.plan-features li.off::before { content: '✕'; color: var(--danger); }
.plan-features li.off { opacity: .55; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); padding: 12px 22px; border-radius: 30px;
  font-size: 14px; z-index: 9999; box-shadow: var(--shadow);
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
@keyframes toastIn { from { opacity: 0; bottom: 60px; } to { opacity: 1; bottom: 80px; } }

/* ── Bottom Nav (mobile) ── */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-2); border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 50; justify-content: space-around;
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 10px; padding: 4px 10px; transition: color .2s; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--accent); }

/* ── Animations ── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse   { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Stats cards (admin) ── */
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-card .value { font-size: 34px; font-weight: 800; color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar  { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .hamburger { display: flex; }
  .main   { margin-left: 0; }
  .bottom-nav { display: flex; }
  .chat-list  { display: none; }
  .container  { padding: 16px; }
  .form-card  { margin: 20px auto; }
  body        { padding-bottom: 65px; }
  .chat-wrap  { height: calc(100vh - 65px); }
  .chat-main  { height: calc(100vh - 65px); }
}
@media (max-width: 480px) {
  .plans-grid { grid-template-columns: 1fr; }
  .hero h1    { font-size: 28px; }
}
