/* =========================================================
   Canido AI — Folha de estilos principal
   Paleta inspirada na imagem de referência: fundo claro,
   acento índigo/violeta, cartões arredondados e sombras suaves.
   ========================================================= */

:root {
  --c-bg: #ffffff;
  --c-bg-soft: #f7f7fb;
  --c-sidebar: #fbfbfd;
  --c-border: #ececf2;
  --c-text: #1f2230;
  --c-text-muted: #6b7080;
  --c-primary: #6c5ce7;
  --c-primary-dark: #5a4bd1;
  --c-primary-soft: #efecfd;
  --c-gradient: linear-gradient(135deg, #6c5ce7 0%, #a78bfa 100%);
  --c-shadow: 0 10px 30px rgba(76, 60, 160, 0.08);
  --c-shadow-sm: 0 2px 10px rgba(31, 34, 48, 0.06);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --font-display: "Inter", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --c-bg: #14141c;
  --c-bg-soft: #1b1c27;
  --c-sidebar: #181922;
  --c-border: #2a2b38;
  --c-text: #f0f0f6;
  --c-text-muted: #9498ab;
  --c-primary: #8b7bf0;
  --c-primary-dark: #7464e0;
  --c-primary-soft: #25223f;
  --c-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --c-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  transition: background .25s ease, color .25s ease;
}

a { text-decoration: none; }

h1, h2, h3, .font-display {
  font-family: var(--font-display);
}

/* ---------- Layout shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--c-sidebar);
  box-shadow: 0 16px 38px -12px rgba(0, 0, 0, 0.56), 0 4px 25px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
}

.brand-badge {
  width: 56px;
  height: 56px;
  border-radius: 50px;
  background: var(--c-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--c-shadow-sm);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--c-text);
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 500;
  font-size: 14.5px;
  transition: background .15s ease, color .15s ease;
}

.sidebar-link i { font-size: 17px; width: 20px; text-align: center; }

.sidebar-link:hover {
  background: #383838a3;
  color: #ffffff;
}

.sidebar-link.active {
  background: #383838a3;
  color: #ffffff;
  font-weight: 600;
}

.sidebar-section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fff;
  margin: 22px 12px 8px;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #fff;;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-md);
  min-width: 0;
}

.user-chip .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-chip .meta { min-width: 0; }
.user-chip .meta {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.user-chip .meta .email {
  font-size: 11.5px;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--c-bg-soft); color: var(--c-text); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
}

.lang-select {
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-scroll {
  flex: 1;
  padding: 150px 28px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Hero / greeting ---------- */
.hero {
  width: 100%;
  max-width: 760px;
  text-align: center;
  margin-top: 6vh;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 28px;
}

.hero h1 .accent {
  background: var(--c-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Search bar ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  padding: 8px 10px 8px 22px;
  box-shadow: var(--c-shadow-sm);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15.5px;
  color: var(--c-text);
}

.search-bar input::placeholder { color: var(--c-text-muted); }

.mic-btn, .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .12s ease, background .15s ease;
}

.mic-btn {
  background: transparent;
  color: var(--c-text-muted);
}
.mic-btn:hover { color: var(--c-primary); }
.mic-btn.is-listening {
  color: #fff;
  background: #ef4444;
  animation: pulse-rec 1.1s infinite;
}

@keyframes pulse-rec {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,.45); }
  70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.send-btn {
  background: var(--c-gradient);
  color: #fff;
}
.send-btn:hover { transform: scale(1.05); }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s ease, border-color .15s ease;
}
.pill-btn:hover { background: var(--c-bg-soft); border-color: var(--c-primary); }
.pill-btn i { color: var(--c-primary); }

/* ---------- Result cards ---------- */
.results-wrap {
  width: 100%;
  max-width: 760px;
  margin-top: 34px;
}

.results-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-muted);
  font-weight: 700;
  margin-bottom: 14px;
}

.result-card {
  display: flex;
  gap: 16px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--c-shadow-sm);
}

.result-card .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--c-primary-soft);
  color: var(--c-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 19px;
}

.result-card .category-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-primary);
  font-weight: 700;
  margin-bottom: 3px;
}

.result-card h3 {
  font-size: 16.5px;
  font-weight: 700;
  margin: 0 0 4px;
}

.result-card p {
  font-size: 14px;
  color: var(--c-text-muted);
  margin: 0;
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  color: var(--c-text-muted);
  padding: 50px 20px;
}
.empty-state i { font-size: 32px; color: var(--c-primary); margin-bottom: 10px; display: block; }

/* ---------- History list ---------- */
.history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.history-card .q { font-weight: 600; font-size: 14.5px; }
.history-card .meta { font-size: 12.5px; color: var(--c-text-muted); }

/* ---------- Weather widget ---------- */
.weather-card {
  width: 100%;
  max-width: 760px;
  margin-top: 30px;
  background: var(--c-gradient);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  color: #fff;
  box-shadow: var(--c-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.weather-card .temp { font-size: 2.1rem; font-weight: 800; font-family: var(--font-display); }
.weather-card .forecast { display: flex; gap: 18px; }
.weather-card .forecast div { text-align: center; font-size: 12.5px; opacity: .95; }
.weather-card .forecast i { font-size: 18px; display: block; margin-bottom: 2px; }

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg-soft);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--c-shadow);
  padding: 36px 32px;
  border: 1px solid var(--c-border);
}

.auth-card .brand-badge { margin: 0 auto 14px; }
.auth-card h1 { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.auth-card .subtitle { text-align: center; color: var(--c-text-muted); font-size: 14px; margin-bottom: 26px; }

.form-floating-custom { margin-bottom: 14px; }
.form-floating-custom label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-bottom: 6px;
  display: block;
}
.form-control-custom {
  width: 100%;
  border: 1px solid var(--c-border);
  background: var(--c-bg-soft);
  color: var(--c-text);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 14.5px;
  outline: none;
  transition: border-color .15s ease;
}
.form-control-custom:focus { border-color: var(--c-primary); }

.btn-primary-grad {
  width: 100%;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: var(--c-gradient);
  box-shadow: var(--c-shadow-sm);
  transition: transform .12s ease;
}
.btn-primary-grad:hover { transform: translateY(-1px); }

.auth-switch { text-align: center; font-size: 13.5px; margin-top: 18px; color: var(--c-text-muted); }
.auth-switch a { color: var(--c-primary); font-weight: 700; }

.demo-hint {
  text-align: center;
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 14px;
  background: var(--c-bg-soft);
  border-radius: var(--radius-md);
  padding: 8px;
}

.alert-floating {
  border-radius: var(--radius-md);
  font-size: 13.5px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* ---------- Chatbot widget ---------- */
.chat-toggle {
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--c-gradient);
  color: #fff;
  border: none;
  font-size: 22px;
  box-shadow: var(--c-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  transition: transform .15s ease;
}
.chat-toggle:hover { transform: scale(1.06); }

.chat-window {
  position: fixed;
  right: 26px;
  bottom: 96px;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 460px;
  max-height: 70vh;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--c-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
}
.chat-window.open { display: flex; }

.chat-header {
  background: var(--c-gradient);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14.5px;
}
.chat-header i { font-size: 18px; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--c-bg-soft);
}

.chat-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
}
.chat-msg.bot {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  background: var(--c-gradient);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--c-border);
}
.chat-footer input {
  flex: 1;
  border: 1px solid var(--c-border);
  background: var(--c-bg-soft);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  color: var(--c-text);
}
.chat-footer button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--c-gradient);
  color: #fff;
  flex-shrink: 0;
}

.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--c-text-muted);
  display: inline-block;
  margin: 0 1px;
  animation: blink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ---------- Mobile ---------- */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    z-index: 1100;
    transition: transform .2s ease;
    box-shadow: var(--c-shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .topbar { padding: 12px 16px; display: none;}
  .content-scroll { padding: 45px 16px 60px; }
  .hero h1 { font-size: 1.7rem; }
  .hero { margin-top: 2vh; }
  .chat-window { right: 14px; left: 14px; width: auto; bottom: 88px; }
  .chat-toggle { right: 16px; bottom: 16px; }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1090;
}
.sidebar-backdrop.show { display: block; }
