:root {
  --bg-dark: #0c0f17;
  --bg-card: #141821;
  --bg-hover: #1a1f2e;
  --border: #2a3142;
  --text-primary: #f5f6fa;
  --text-secondary: #a0aec0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #34d399;
  --warning: #f59e0b;
  --error: #ef4444;
  
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
}

body {
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.login-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
}

.login-header {
  margin-bottom: 2rem;
}

.login-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 28px;
  font-weight: 700;
}

.login-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: transparent;
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 14px;
  margin-top: -0.5rem;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.login-footer {
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: 13px;
}

.login-footer p {
  margin: 0;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-card);
}

.top-bar-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: auto;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.top-bar-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  padding: 0.5rem 0;
}

.top-bar-link:hover {
  color: var(--accent);
}

.top-bar-logout {
  margin: 0;
  padding: 0;
}

.top-bar-logout-btn {
  background-color: var(--accent);
  border: none;
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
}

.top-bar-logout-btn:hover {
  background-color: var(--accent-hover);
}

main {
  padding: 2rem;
  display: grid;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

.section h2 {
  margin: 0 0 1rem 0;
  font-size: 18px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.list li {
  padding: 1rem;
  background-color: var(--bg-hover);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.list li:hover {
  background-color: var(--bg-dark);
  border-left: 3px solid var(--accent);
  padding-left: calc(1rem - 3px);
}

.list li a {
  color: inherit;
  text-decoration: none;
}

/* Session View */
.session {
  display: grid;
  gap: 2rem;
}

.session .section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: transparent;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 14px;
  box-sizing: border-box;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

#chat-log {
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 6px;
  max-height: 500px;
  overflow-y: auto;
}

.message {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border-radius: 4px;
}

.msg-persona {
  color: #60a5fa;
  background-color: rgba(96, 165, 250, 0.1);
  border-left: 3px solid #60a5fa;
  padding-left: calc(0.75rem - 3px);
}

.msg-kalia {
  color: #34d399;
  background-color: rgba(52, 211, 153, 0.1);
  border-left: 3px solid #34d399;
  padding-left: calc(0.75rem - 3px);
}

/* Buttons */
button {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

button:hover {
  background-color: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

button.secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent);
}

/* Utilities */
.text-secondary {
  color: var(--text-secondary);
}

.text-sm {
  font-size: 14px;
}

.text-xs {
  font-size: 12px;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.justify-between {
  justify-content: space-between;
}

.items-center {
   align-items: center;
}

/* Modal Styles */
.modal {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0, 0, 0, 0.6);
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 1000;
}

.modal-content {
   background-color: var(--bg-card);
   border: 1px solid var(--border);
   border-radius: 12px;
   max-width: 700px;
   max-height: 85vh;
   overflow-y: auto;
   box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 1.5rem;
   border-bottom: 1px solid var(--border);
}

.modal-header h2 {
   margin: 0;
   font-size: 1.5rem;
}

.modal-close {
   background: none;
   border: none;
   color: var(--text-secondary);
   font-size: 1.5rem;
   cursor: pointer;
   padding: 0;
   width: 2rem;
   height: 2rem;
   display: flex;
   align-items: center;
   justify-content: center;
}

.modal-close:hover {
   color: var(--text-primary);
}

.modal-body {
   padding: 2rem;
   line-height: 1.8;
}

.modal-body h3 {
   margin-top: 1.5rem;
   margin-bottom: 0.8rem;
   color: var(--accent);
   font-size: 1.1rem;
}

.modal-body h3:first-child {
   margin-top: 0;
}

.modal-body p {
   margin: 0.8rem 0;
   color: var(--text-secondary);
}

.modal-body ul,
.modal-body ol {
   margin: 0.8rem 0;
   padding-left: 1.5rem;
   color: var(--text-secondary);
}

.modal-body li {
   margin: 0.5rem 0;
}

.modal-body blockquote {
   margin: 1.5rem 0;
   padding-left: 1rem;
   border-left: 3px solid var(--accent);
   font-style: italic;
   color: var(--text-primary);
}

/* Help button styling */
#help-btn {
   background: none;
   border: none;
   color: var(--text-primary);
   cursor: pointer;
   padding: 0.5rem 1rem;
   font-size: 0.95rem;
}

#help-btn:hover {
   color: var(--accent);
}
