/* Neura Chatworld — layout and theme.
   Built on Bootstrap 5; this file only adds the app shell + accessibility. */

:root {
  --cw-sidebar-width: 250px;
  --cw-topbar-height: 56px;
  --cw-accent: #6c5ce7;
  --cw-accent-dark: #4834b8;
}

body {
  background: #f4f5f9;
}

/* --- Accessibility -------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2000;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
}

/* Always-visible focus outline for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}

/* --- App shell ----------------------------------------------------------- */
.cw-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--cw-topbar-height);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  background: linear-gradient(90deg, var(--cw-accent-dark), var(--cw-accent));
  color: #fff;
  z-index: 1040;
}

.cw-brand {
  color: #fff;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
}
.cw-brand:hover { color: #fff; }

.cw-sidebar {
  background: #1e1f2b;
  color: #d7d8e0;
}

@media (min-width: 992px) {
  .cw-sidebar {
    position: fixed;
    top: var(--cw-topbar-height);
    bottom: 0;
    left: 0;
    width: var(--cw-sidebar-width);
    overflow-y: auto;
  }
  .cw-main {
    margin-left: var(--cw-sidebar-width);
  }
}

.cw-main {
  margin-top: var(--cw-topbar-height);
  padding: 1.5rem;
}

.cw-sidebar .nav-link {
  color: #c3c4d0;
  border-radius: 0.4rem;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.15rem;
}
.cw-sidebar .nav-link:hover {
  background: #2c2d3d;
  color: #fff;
}
.cw-sidebar .nav-link.active {
  background: var(--cw-accent);
  color: #fff;
}
.cw-sidebar .nav-link.disabled {
  color: #6b6c7d;
}
.cw-sidebar .nav-link .badge {
  font-size: 0.65rem;
  vertical-align: middle;
}

.cw-nav-section {
  display: block;
  padding: 0.25rem 0.8rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b6c7d;
}

/* --- Auth pages ---------------------------------------------------------- */
.cw-auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--cw-accent-dark), #1e1f2b);
}
.cw-auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.25);
}

/* --- Misc ---------------------------------------------------------------- */
.cw-flash { max-width: 720px; }

.cw-stat-card {
  border: none;
  border-radius: 0.6rem;
}
.cw-stat-card .display-6 { font-weight: 600; }

.cw-page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* --- AJAX panel busy state ----------------------------------------------- */
.cw-busy {
  position: relative;
  min-height: 4rem;
}
.cw-busy > * {
  opacity: 0.4;
  pointer-events: none;
}
.cw-busy::after {
  content: "";
  position: absolute;
  top: 1.5rem;
  left: 50%;
  width: 2.2rem;
  height: 2.2rem;
  margin-left: -1.1rem;
  border: 3px solid #d3d4de;
  border-top-color: var(--cw-accent);
  border-radius: 50%;
  animation: cw-spin 0.8s linear infinite;
}
@keyframes cw-spin {
  to { transform: rotate(360deg); }
}

/* --- Chat ---------------------------------------------------------------- */
.cw-chat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cw-msg {
  display: flex;
}
.cw-msg-user {
  justify-content: flex-end;
}
.cw-bubble {
  max-width: 80%;
  padding: 0.6rem 0.9rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cw-msg-assistant .cw-bubble {
  background: #fff;
  border: 1px solid #e2e3ec;
  border-bottom-left-radius: 0.25rem;
}
.cw-msg-user .cw-bubble {
  background: var(--cw-accent);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}
