/* Base and layout styles */
* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  height: 100vh;
  display: flex;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--border-light);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 20;
}

/* Ensure sidebar header allows tooltip overflow */
.sidebar-header {
  position: relative;
  overflow: visible;
}

.sidebar.is-collapsed {
  width: 64px;
}

.sidebar-header {
  padding: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: none;
}

.sidebar-content {
  flex: 1;
  padding: var(--space-lg);
  margin-top: var(--space-3xl);
  overflow: auto;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-lg);
  border-top: none;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
}

.version-link {
  position: fixed;
  bottom: 8px;
  left: calc(var(--sidebar-width) / 2);
  transform: translateX(-50%);
  color: var(--text-secondary);
  font-size: 12px;
  z-index: 25;
  pointer-events: none;
  transition: left 0.2s ease;
}

aside.sidebar.is-collapsed~.version-link {
  left: 32px;
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.chat-header {
  height: var(--toolbar-height);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-2xl);
  position: sticky;
  top: 0;
  z-index: 25;
}

.chat-header .left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  min-width: 0;
}

.chat-header .right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-auth-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-btn {
  font-size: 14px;
  padding: var(--space-sm) var(--space-lg);
}

/* Hide header compose icon on desktop by default */
.header-compose-icon {
  display: none;
}

/* Ensure header compose icon aligns with other header buttons */
.chat-header .header-compose-icon.btn.icon {
  border-radius: var(--border-radius-sm) !important;
  min-height: auto !important;
  height: auto !important;
  padding: var(--space-sm) var(--space-sm);
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

.messages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2xl) 0;
  scroll-behavior: smooth;
}

.message-column {
  max-width: var(--message-max-width);
  min-width: 0;
  margin: 0 auto;
  padding: 0 var(--space-2xl);
}

/* Hero composer positioning */
.hero-composer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 760px;
  padding: 0 var(--space-2xl);
  display: none;
  z-index: 5;
}

.hero-composer.visible {
  display: block;
}

/* Mobile hamburger visibility baseline */
.sidebar-toggle {
  display: none;
}

/* Global focus styles */
.btn:focus-visible,
.dialogue-item:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Footer styles */
.page-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  font-size: 12px;
  color: #666;
  background-color: transparent;
  pointer-events: none;
  z-index: 1;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  width: 100%;
  pointer-events: auto;
}

.footer-disclaimer {
  text-align: center;
  flex: 1;
  pointer-events: none;
}

.footer-version-mobile {
  display: none;
  color: var(--text-secondary);
  font-size: 12px;
  pointer-events: none;
}

.footer-about-link {
  display: inline;
  text-decoration: underline;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: color 0.2s ease;
  pointer-events: auto;
}

.footer-about-link:hover {
  color: var(--text-primary);
}