/* ==================== Theme Variables ==================== */
:root {
  /* Accent colors */
  --accent-color: #000000;
  --accent-hover: #333333;
  --accent-active: #555555;
  --accent-light: rgba(0, 0, 0, 0.05);
  --accent-lighter: rgba(0, 0, 0, 0.02);

  /* Light mode colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f9fc;
  --bg-tertiary: #f9fafb;
  --bg-accent: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-primary: #e5e7eb;
  --border-secondary: #d1d5db;
  --shadow: rgba(0, 0, 0, 0.1);
}

/* Dark mode colors */
[data-theme="dark"] {
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-accent: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --border-primary: #374151;
  --border-secondary: #4b5563;
  --shadow: rgba(0, 0, 0, 0.3);
  --accent-light: rgba(255, 255, 255, 0.1);
  --accent-lighter: rgba(255, 255, 255, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-secondary);
  color: var(--text-primary);
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Phase 7: App Container */
.app-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 16px 24px;
  display: grid;
  grid-template-columns: minmax(auto, 300px) 1fr minmax(auto, 300px);
  align-items: center;
  gap: 20px;
  box-shadow: 0 2px 10px var(--shadow);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.beacon-logo {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.logo-link {
  text-decoration: none;
  color: var(--accent-color);
  cursor: pointer;
  transition: opacity 0.2s;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo-link:hover .beacon-logo {
  transform: scale(1.05);
}

.header-priorities {
  display: flex;
  width: 100%;
}

.header-priorities .focus-timeline-header {
  flex: 1;
  margin-bottom: 0;
}

.header-priorities .focus-timeline-header h3 {
  font-size: 14px;
  font-weight: 500;
}

.header-priorities .priority-input {
  font-size: 13px;
  padding: 6px 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: end;
}

.user-email {
  font-size: 14px;
  opacity: 0.9;
}

/* Header Navigation Link */
.header-nav-link {
  background: var(--bg-accent);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}

.header-nav-link:hover {
  background: #e5e7eb;
}

/* Account Menu */
.account-menu-container {
  position: relative;
}

.account-menu-btn {
  background: var(--bg-accent);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  font-family: inherit;
}

.account-menu-btn:hover {
  background: #e5e7eb;
}

.dropdown-icon {
  font-size: 10px;
  opacity: 0.7;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-primary);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-item {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  color: #374151;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
  font-weight: 500;
}

.dropdown-item:hover {
  background: var(--bg-accent);
  color: var(--accent-color);
}

/* Phase 7: 2-Column Layout (left panel removed) */
.three-column-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  flex: 1;
  overflow: hidden;
  background: #e5e7eb;
  position: relative;
}

.left-column,
.right-column {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.center-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.widget-wrapper {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: visible;
}

/* Make Related widget wrapper take full height in right column */
.right-column .widget-wrapper {
  flex: 1;
  overflow: hidden;
}

.center-column {
  border-right: 1px solid var(--border-primary);
}

.column-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-tertiary);
  flex-shrink: 0;
  margin-bottom: 0;
}

.column-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Phase 7: Left Column - Related Docs */
.related-docs-container {
  flex: 1;
  max-height: 100%;
  overflow-y: auto;
  padding: 16px;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.related-doc-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.related-doc-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-color);
}

.related-doc-item.pinned {
  border-color: var(--accent-color);
  background: var(--bg-accent);
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}

.doc-type-icon {
  font-size: 18px;
  margin-right: 8px;
}

.doc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.4;
}

.doc-actions {
  display: flex;
  gap: 4px;
}

.doc-action-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.doc-action-btn:hover {
  opacity: 1;
}

.doc-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.doc-metadata {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-tertiary);
}

.doc-relevance {
  font-weight: 600;
  color: var(--accent-color);
}

/* Phase 7: Right Column - Calendar */
.calendar-container {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

.calendar-container::-webkit-scrollbar {
  width: 8px;
}

.calendar-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.calendar-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.calendar-container::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.calendar-day-section {
  margin-bottom: 24px;
}

.calendar-day-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.calendar-event {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent-color);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.calendar-event:hover {
  background: var(--bg-accent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.event-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 4px;
}

.event-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.event-attendees {
  font-size: 11px;
  color: var(--text-secondary);
}

.calendar-loading,
.calendar-empty {
  text-align: center;
  padding: 12px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
  overflow: visible;
}

/* Phase 11: Right Column - Messages */
.messages-list-container {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

.messages-list-container::-webkit-scrollbar {
  width: 8px;
}

.messages-list-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.messages-list-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.messages-list-container::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.messages-loading,
.messages-empty {
  text-align: center;
  padding: 12px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
  overflow: visible;
}

/* Connect buttons for empty states */
.connect-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 100;
}

.connect-btn {
  display: inline-block;
  padding: 10px 16px;
  background: var(--accent-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
  cursor: pointer;
  border: none;
  width: 100%;
}

.connect-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Connect dropdown menu */
.connect-dropdown {
  position: fixed;
  margin-top: 4px;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  min-width: 200px;
}

.provider-option {
  display: block;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--bg-tertiary);
  color: #374151;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.provider-option:last-child {
  margin-bottom: 0;
}

.provider-option:hover {
  background: var(--accent-color);
  color: white;
  transform: translateX(4px);
}

.message-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-left: 3px solid var(--accent-color);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.message-item:hover {
  background: var(--bg-accent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.message-item.unread {
  border-left-color: #ef4444;
  background: var(--bg-primary);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 6px;
}

.message-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.message-score {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-color);
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.message-subject {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 500;
}

.message-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-tertiary);
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-primary);
}

.message-action-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.message-action-btn:hover {
  transform: translateY(-1px);
}

.btn-mark-read {
  background: #e5e7eb;
  color: #4b5563;
}

.btn-mark-read:hover {
  background: #d1d5db;
}

.btn-archive {
  background: #dbeafe;
  color: #1e40af;
}

.btn-archive:hover {
  background: #bfdbfe;
}

.btn-reply {
  background: var(--accent-color);
  color: white;
}

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

.vip-settings-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.vip-settings-btn:hover {
  opacity: 1;
}

.column-header {
  position: relative;
}

.column-header .vip-settings-btn {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.column-header .section-icon {
  font-size: 18px;
  margin-right: 10px;
  opacity: 0.8;
}

.column-header {
  display: flex;
  align-items: center;
}

.column-header h3 {
  flex: 1;
}

.column-header .todos-view-toggle {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
}

/* Phase 7: Center Column - Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-accent);
  max-width: 93%;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.welcome-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.welcome-message h2 {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.welcome-message p {
  font-size: 16px;
}

.message {
  display: block;
  width: 100%;
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-role {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.message-user .message-role {
  color: var(--accent-color);
}

.message-assistant .message-role {
  color: var(--accent-color);
}

.message-error .message-role {
  color: #ef4444;
}

.message-content {
  padding: 16px 20px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 15px;
}

.message-user .message-content {
  background: var(--accent-color);
  color: white;
  margin-left: auto;
  max-width: 80%;
}

.message-assistant .message-content {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  max-width: 80%;
}

.message-error .message-content {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  max-width: 80%;
}

/* Phase 7: Center Column - Input */
.input-container {
  padding: 16px 20px;
  background: var(--bg-primary);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#chat-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 90%;
}

#message-input {
  width: 100%;
  padding: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-secondary);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: all 0.2s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

#message-input:hover {
  border-color: var(--accent-color);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--accent-color);
}

#message-input:focus {
  border-color: var(--accent-color);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08), 0 0 0 3px rgba(0, 0, 0, 0.1);
}

#message-input:disabled {
  background: var(--bg-accent);
  cursor: not-allowed;
  box-shadow: none;
}

.input-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.primary-btn {
  background: var(--accent-color);
  color: white;
  min-width: 100px;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  background: var(--bg-accent);
  color: var(--text-secondary);
}

.secondary-btn:hover {
  background: #e5e7eb;
}

.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none;
}

/* Scrollbar styling */
.messages-container::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Phase 10: Background Tasks & Notifications */

/* Background tasks badge */
.background-tasks-badge {
  position: relative;
}

.background-tasks-badge button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.background-tasks-badge button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.badge-icon {
  font-size: 18px;
}

.badge-count {
  background: #ef4444;
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Task drawer */
.task-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--bg-primary);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.task-drawer.hidden {
  transform: translateX(100%);
}

.drawer-header {
  background: var(--accent-color);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 20px;
  font-weight: 600;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  padding: 0;
  transition: background 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.empty-state {
  text-align: center;
  color: var(--text-tertiary);
  padding: 40px 20px;
}

.task-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.task-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.task-item.status-completed {
  border-color: #10b981;
  background: #f0fdf4;
}

.task-item.status-error {
  border-color: #ef4444;
  background: #fef2f2;
}

.task-item.status-running {
  border-color: var(--accent-color);
  background: var(--bg-accent);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.task-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.task-status {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e5e7eb;
  color: var(--text-secondary);
}

.status-completed .task-status {
  background: #d1fae5;
  color: #065f46;
}

.status-error .task-status {
  background: #fee2e2;
  color: #991b1b;
}

.status-running .task-status {
  background: #dbeafe;
  color: #1e40af;
}

.task-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

.task-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-view,
.btn-cancel {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  font-weight: 500;
}

.btn-view {
  background: var(--accent-color);
  color: white;
}

.btn-cancel {
  background: #fee2e2;
  color: #991b1b;
}

/* Connection status indicator */
.connection-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 999;
}

.connection-status.connected {
  background: #10b981;
}

.connection-status.disconnected {
  background: #ef4444;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 350px;
}

.toast {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  animation: slideIn 0.3s ease;
}

.toast.fade-out {
  animation: slideOut 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast-success {
  border-left: 4px solid #10b981;
  color: #065f46;
}

.toast-error {
  border-left: 4px solid #ef4444;
  color: #991b1b;
}

.toast-info {
  border-left: 4px solid var(--accent-color);
  color: #1e40af;
}

/* Phase 6: Focus Timeline (adapted for Phase 7 center column) */

.focus-timeline-container {
  background: var(--bg-tertiary);
  padding: 16px 20px;
  flex-shrink: 0;
}

.focus-timeline-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.focus-timeline-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.priority-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-secondary);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  resize: none;
  overflow: hidden;
  line-height: 1.5;
}

.priority-input.inactive {
  border-color: transparent;
  background: transparent;
  cursor: pointer;
}

.priority-input.inactive:hover {
  border-color: var(--border-primary);
  background: var(--bg-primary);
}

.priority-input:hover {
  border-color: var(--accent-color);
}

.priority-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.priority-input::placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

#priorities-display {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.priority-label {
  display: inline;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.2s;
}

.priority-label:hover {
  color: var(--text-secondary);
}

.priority-edit-input {
  padding: 4px 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--accent-color);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  outline: none;
}

.focus-collapse-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.focus-collapse-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.focus-priorities-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: none;
  padding-left: 4px;
}

.focus-settings-btn {
  background: var(--accent-light);
  color: #ffffff;
  padding: 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.focus-settings-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.add-connection-header-btn {
  background: var(--accent-light);
  color: #ffffff;
  padding: 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.add-connection-header-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.focus-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 16px;
}

.focus-day {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}

.focus-day.today {
  border-color: var(--accent-color);
  background: var(--bg-accent);
}

.focus-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.focus-day-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.focus-day.today .focus-day-label {
  color: var(--accent-color);
}

.focus-day-date {
  font-size: 11px;
  color: var(--text-tertiary);
}

.focus-priorities {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.focus-priority {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-primary);
  margin: 0 -8px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: all 0.2s;
}

.focus-priority:last-child {
  border-bottom: none;
}

.focus-priority[draggable="true"]:hover {
  background: var(--accent-lighter);
  border-radius: 4px;
}

.focus-priority.dragging {
  opacity: 0.5;
}

.focus-priority.drag-over {
  border-top: 2px solid var(--accent-color);
  padding-top: 10px;
}

.focus-priorities.drop-target {
  background: var(--accent-lighter);
  border: 2px dashed var(--accent-color);
  border-radius: 8px;
  padding: 8px;
  min-height: 60px;
  transition: all 0.2s;
}

.focus-priority.ai-suggestion {
  color: var(--accent-color);
  font-style: italic;
}

.focus-priority-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.focus-priority-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-priority-checkbox {
  margin-right: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.focus-priority-checkbox:disabled {
  cursor: not-allowed;
}

.focus-priority-drag-handle {
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: grab;
  padding: 2px 4px;
  margin-right: 4px;
  flex-shrink: 0;
  user-select: none;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.focus-priority:hover .focus-priority-drag-handle {
  opacity: 0.7;
}

.focus-priority-drag-handle:active {
  cursor: grabbing;
}

.focus-priority.completed {
  opacity: 0.6;
}

.focus-priority.completed .focus-priority-text {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.empty-focus {
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

.focus-edit-btn {
  padding: 4px 8px;
  font-size: 12px;
  background: var(--accent-light);
  color: var(--accent-color);
  border-radius: 6px;
}

.focus-edit-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.focus-add-priority-btn {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.focus-add-priority-btn:hover {
  background: var(--border-primary);
  color: var(--text-primary);
}

.focus-add-input {
  width: 100%;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 14px;
  border: 2px solid var(--accent-color);
  border-radius: 6px;
  font-family: inherit;
  outline: none;
}

.focus-add-input::placeholder {
  color: #999;
}

.focus-edit-form {
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.focus-edit-form::-webkit-scrollbar {
  width: 6px;
}

.focus-edit-form::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.focus-edit-form::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.focus-edit-form::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.focus-edit-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  font-family: inherit;
}

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

.focus-edit-input:disabled {
  background: var(--bg-accent);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

.focus-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.focus-save-btn,
.focus-cancel-btn {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.focus-save-btn {
  background: var(--accent-color);
  color: white;
}

.focus-cancel-btn {
  background: var(--bg-accent);
  color: var(--text-secondary);
}

.focus-collapsed {
  max-height: 0;
  overflow: hidden;
  padding: 0;
  border-bottom: none;
  opacity: 0;
  transition: all 0.3s ease;
}

.focus-timeline-container.collapsed .focus-timeline {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
  transition: all 0.3s ease;
}

.focus-timeline-container.collapsed .focus-timeline-header {
  margin-bottom: 0;
}

.focus-toggle-btn {
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 12px;
}

.focus-toggle-btn:hover {
  color: var(--text-primary);
}

/* Widget collapse/expand functionality */
.widget-collapse-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.widget-collapse-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

/* Adjust positioning when VIP settings button exists */
.column-header .vip-settings-btn {
  right: 48px;
}

/* Adjust positioning when todos view toggle exists - removed duplicate */

/* Widget collapsed states */
.widget-collapsed {
  max-height: 0 !important;
  min-height: 0 !important;
  overflow: hidden;
  opacity: 0;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  transition: all 0.3s ease;
}

/* Responsive design */
@media (max-width: 1024px) {
  /* Tablet: Stack left column on top */
  .three-column-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .left-column {
    order: 3;
    max-height: 200px;
    border-top: 1px solid var(--border-primary);
  }

  .center-column {
    order: 1;
    border: none;
  }

  .right-column {
    order: 2;
    max-height: 250px;
    border-top: 1px solid var(--border-primary);
  }
}

@media (max-width: 768px) {
  /* Mobile: Single column */
  .app-header h1 {
    font-size: 18px;
  }

  .header-actions {
    gap: 8px;
  }

  .user-email {
    display: none;
  }

  .three-column-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .left-column,
  .right-column {
    display: none;
  }

  .center-column {
    border: none;
  }

  .messages-container {
    padding: 16px 24px;
  }

  .message-content {
    max-width: 90%;
  }

  .input-container {
    padding: 12px 16px;
  }

  /* Phase 10 responsive */
  .task-drawer {
    width: 100%;
  }

  .toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  /* Phase 6 responsive */
  .focus-timeline {
    grid-template-columns: 1fr;
  }

  .focus-timeline-container {
    padding: 12px 16px;
  }
}

/* Phase 9: Semantic Chat Categorization */

/* View toggle above messages */
.view-toggle-container {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-primary);
  padding: 12px 20px;
  flex-shrink: 0;
}

.view-toggle {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.view-toggle-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-toggle-btn:hover {
  background: var(--bg-accent);
  border-color: #d1d5db;
}

.view-toggle-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Semantic view container */
.semantic-view-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-primary);
}

.semantic-view-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.semantic-view-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.semantic-view-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Categories list */
.categories-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.category-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}

.category-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.category-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.category-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.category-delete-btn {
  background: transparent;
  color: var(--text-tertiary);
  border: none;
  font-size: 24px;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.category-delete-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.category-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 0;
  border-top: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
}

.category-stat {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-view-category {
  width: 100%;
  padding: 10px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-view-category:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Category sessions view */
.category-sessions-view {
  max-width: 900px;
  margin: 0 auto;
}

.category-sessions-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.btn-back {
  background: var(--bg-accent);
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-back:hover {
  background: #e5e7eb;
}

.category-sessions-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.category-sessions-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Sessions list */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.session-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-color);
}

.session-card-content {
  flex: 1;
}

.session-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.session-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.session-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-resume-session {
  padding: 8px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-resume-session:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive for categories */
@media (max-width: 768px) {
  .categories-list {
    grid-template-columns: 1fr;
  }

  .session-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .btn-resume-session {
    width: 100%;
  }
}

/* ==================== Todos Styles (Phase 13) ==================== */

.todos-container {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.todos-container::-webkit-scrollbar {
  width: 8px;
}

.todos-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.todos-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.todos-container::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.todos-loading,
.todos-error {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
}

.todos-error .retry-btn {
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.todos-view-toggle {
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.todos-view-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.todos-view-toggle .icon-active {
  opacity: 1;
  font-size: 18px;
  transform: scale(1);
  transition: all 0.2s;
}

.todos-view-toggle .icon-inactive {
  opacity: 0.3;
  font-size: 14px;
  transform: scale(0.9);
  transition: all 0.2s;
}

.todos-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.todo-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s;
}

.todo-item[draggable="true"] {
  cursor: grab;
}

.todo-item[draggable="true"]:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-color);
}

.todo-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.todo-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-color);
}

.todo-item.completed {
  opacity: 0.6;
  background: var(--bg-tertiary);
}

.todo-item.completed .todo-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.todo-item.overdue {
  border-color: #f87171;
  background: #fef2f2;
}

.todo-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.todo-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.4;
}

.todo-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.todo-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.todo-metadata {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
}

.due-date {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 6px;
  background: var(--bg-accent);
  border-radius: 4px;
}

.due-date.overdue {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 600;
}

.priority {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.priority-high {
  background: #fee2e2;
  color: #dc2626;
}

.priority-medium {
  background: #fef3c7;
  color: #d97706;
}

.priority-low {
  background: #e0e7ff;
  color: #4f46e5;
}

.complete-btn {
  padding: 4px 12px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  flex-shrink: 0;
}

.complete-btn:hover:not(:disabled) {
  background: #059669;
  transform: scale(1.05);
}

.complete-btn.completing {
  background: #9ca3af;
  cursor: not-allowed;
  font-size: 11px;
}

.complete-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.completed-badge {
  font-size: 13px;
  color: #10b981;
  font-weight: 600;
  padding: 4px 8px;
  background: #d1fae5;
  border-radius: 6px;
}

/* Add todo button and input */
.todo-add-btn {
  display: block;
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.todo-add-btn:hover {
  background: var(--border-primary);
  color: var(--text-primary);
}

.todo-add-input {
  width: 100%;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 14px;
  border: 2px solid var(--accent-color);
  border-radius: 6px;
  font-family: inherit;
  outline: none;
}

.todo-add-input::placeholder {
  color: #999;
}

/* Responsive */
@media (max-width: 768px) {
  .todos-container {
    max-height: 300px;
  }

  .todo-item {
    padding: 10px;
  }

  .todo-title {
    font-size: 13px;
  }

  .todo-description {
    font-size: 12px;
  }
}

/* ==================== Widget Drag and Drop Styles ==================== */

/* Widget sections become draggable */
.widget-section {
  transition: opacity 0.2s, transform 0.2s;
}

.widget-section.dragging {
  opacity: 0.5;
  cursor: grabbing !important;
}

.widget-section.drag-over {
  border-top: 3px solid var(--accent-color);
  margin-top: 4px;
  transition: all 0.2s;
}

/* Drag handle indicator on column headers */
.widget-section .column-header {
  cursor: grab;
  user-select: none;
}

.widget-section .column-header:active {
  cursor: grabbing;
}

/* Column drop zones */
.left-column,
.right-column {
  position: relative;
  min-height: 100px;
}

.left-column.drag-over-column,
.right-column.drag-over-column {
  background: var(--accent-lighter);
  transition: background 0.2s;
}

/* Drag handle icon hint */
.widget-section .column-header::before {
  content: "⋮⋮";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.2s;
}

.widget-section .column-header:hover::before {
  opacity: 0.6;
}

/* Smooth animations for layout changes */
.widget-section {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ==================== Panel Resize and Collapse Styles ==================== */

/* Resize handles between columns */
.resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  cursor: col-resize;
  z-index: 100;
  transition: background 0.2s;
}

.resize-handle:hover {
  background: rgba(0, 0, 0, 0.15);
}

.resize-handle:active {
  background: rgba(0, 0, 0, 0.25);
}

.resize-handle-left {
  left: 20%;
  transform: translateX(-50%);
}

.resize-handle-right {
  right: 20%;
  transform: translateX(50%);
}

/* Panel collapse button */
.panel-collapse-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  border-radius: 4px;
}

.panel-collapse-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

/* Adjust position when other buttons exist */
.left-column .panel-collapse-btn {
  right: 16px;
}

.right-column .panel-collapse-btn {
  right: 80px; /* Make room for todos toggle */
}

/* Collapsed panel state */
.panel-collapsed {
  min-width: 0 !important;
  max-width: 0 !important;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.panel-collapsed .column-header,
.panel-collapsed .widget-wrapper {
  display: none;
}

/* ==================== Panel Hover/Pin Pattern ==================== */

/* Panel header (for pin button at panel level) */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  height: 32px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

/* Right panel header - pin button on left */
.panel-header-right {
  justify-content: flex-start;
}

/* Panel edge indicator (40px collapsed state) */
.panel-edge-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.left-edge-indicator {
  left: 0;
}

.right-edge-indicator {
  right: 0;
}

.edge-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 1px;
}

/* Panel content wrapper */
.panel-content {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Panel states - collapsed */
.left-column.panel-hover-collapsed .panel-content,
.right-column.panel-hover-collapsed .panel-content {
  opacity: 0;
  pointer-events: none;
}

.left-column.panel-hover-collapsed .panel-edge-indicator,
.right-column.panel-hover-collapsed .panel-edge-indicator {
  opacity: 1;
  pointer-events: auto;
}

.left-column.panel-hover-collapsed .resize-handle-left,
.right-column.panel-hover-collapsed .resize-handle-right {
  display: none !important;
}

/* Panel states - hovering (show panel) */
.left-column.panel-hover-expanding .panel-content,
.right-column.panel-hover-expanding .panel-content,
.left-column.panel-hover-expanded .panel-content,
.right-column.panel-hover-expanded .panel-content {
  opacity: 1;
  pointer-events: auto;
}

.left-column.panel-hover-expanding .panel-edge-indicator,
.right-column.panel-hover-expanding .panel-edge-indicator,
.left-column.panel-hover-expanded .panel-edge-indicator,
.right-column.panel-hover-expanded .panel-edge-indicator {
  opacity: 0;
  pointer-events: none;
}

/* Pin button with SVG icon */
.panel-pin-btn {
  background: transparent;
  color: var(--text-tertiary); /* Grey when unpinned */
  border: none;
  cursor: pointer;
  padding: 6px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.panel-pin-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent-color);
}

.panel-pin-btn .pin-icon {
  transition: all 0.3s ease;
  transform: rotate(90deg); /* Horizontal when unpinned */
}

.panel-pin-btn.pinned {
  color: var(--accent-color); /* Brand color when pinned */
  background: var(--accent-light);
}

.panel-pin-btn.pinned .pin-icon {
  transform: rotate(0deg); /* Vertical when pinned */
}


/* ==================== Connection List & Add Button Styles ==================== */

/* Connections list container */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin-top: 12px;
}

/* Individual connection item */
.connection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  transition: all 0.2s;
}

.connection-item:hover {
  background: var(--bg-accent);
  border-color: #d1d5db;
}

.connection-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.connection-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Add connection row at the bottom */
.add-connection-row {
  display: flex;
  justify-content: center;
  padding: 0;
  position: relative;
}

/* Add connection button (+) */
.add-connection-btn {
  display: block;
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.add-connection-btn:hover {
  background: var(--border-primary);
  color: var(--text-primary);
}

/* Position dropdown relative to + button */
.add-connection-row .connect-dropdown {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
}


/* ==================== Session Info Message ==================== */

#session-info-container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.message-session-info {
  text-align: left;
}

.session-info-content {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-accent);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
}

/* ==================== Message Feedback Controls ==================== */

.message-feedback {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-primary);
  opacity: 0.6;
  transition: opacity 0.2s;
  max-width: none;
  width: 100%;
  align-items: center;
}

.message-assistant:hover .message-feedback {
  opacity: 1;
}

.feedback-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1;
}

.feedback-btn:hover {
  background: var(--bg-accent);
  transform: scale(1.1);
}

.feedback-btn.feedback-submitted {
  cursor: not-allowed;
}

.feedback-btn.feedback-selected {
  animation: feedbackBounce 0.6s ease;
  opacity: 1 !important;
  transform: scale(1.2);
}

@keyframes feedbackBounce {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.3);
  }
  50% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(1.25);
  }
}

.feedback-btn[data-feedback-type="thumbs_up"]:hover:not(.feedback-submitted) {
  background: #dcfce7;
}

.feedback-btn[data-feedback-type="thumbs_down"]:hover:not(.feedback-submitted) {
  background: #fee2e2;
}

.feedback-btn[data-feedback-type="flag"]:hover:not(.feedback-submitted) {
  background: #fef3c7;
}

/* Dimension selection cards */
.dimension-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  animation: fadeIn 0.3s ease;
  align-items: center;
  width: 100%;
  max-width: none;
}

.dimension-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.dimension-card:hover:not(.dimension-selected) {
  background: #fee2e2;
  border-color: #fca5a5;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dimension-card.dimension-selected {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
  cursor: not-allowed;
  opacity: 0.8;
}

/* Feedback text input - takes remaining space on row with dimension card */
.feedback-text-input {
  flex: 1 0 0%;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  height: 36px;
}

.feedback-text-input::placeholder {
  font-style: italic;
}

.feedback-text-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.feedback-text-input:disabled {
  background: var(--bg-accent);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Force line break after text input using pseudo-element */
.feedback-text-input::after {
  content: "";
  flex-basis: 100%;
  height: 0;
}

/* Feedback submit button - right-aligned on new row */
.feedback-submit-btn {
  padding: 8px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  height: 36px;
  flex: 0 0 auto;
  margin-left: auto;
}

.feedback-submit-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--accent-light);
}

.feedback-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.feedback-submit-btn.feedback-submitted {
  background: #10b981;
}

.feedback-submit-btn.feedback-submitted:hover {
  background: #10b981;
  transform: none;
}

/* ==================== Markdown Rendering Styles ==================== */

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
  line-height: 1.3;
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.1em; }
.message-content h4 { font-size: 1em; }

.message-content code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 0.9em;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-content pre code {
  background: none;
  padding: 0;
}

.message-content ul,
.message-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.message-content li {
  margin: 4px 0;
  line-height: 1.6;
}

.message-content blockquote {
  border-left: 3px solid var(--border-primary);
  padding-left: 12px;
  margin: 12px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.message-content a {
  color: var(--accent-color);
  text-decoration: underline;
}

.message-content a:hover {
  opacity: 0.8;
}

.message-content p {
  margin: 8px 0;
}

.message-content p:first-child {
  margin-top: 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border-primary);
  margin: 16px 0;
}

.message-content table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
}

.message-content table th,
.message-content table td {
  border: 1px solid var(--border-primary);
  padding: 8px 12px;
  text-align: left;
}

.message-content table th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

/* Dark mode code block styling */
[data-theme="dark"] .message-content code {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .message-content pre {
  background: rgba(255, 255, 255, 0.05);
}

/* ==================== Typing Indicator ==================== */

.typing-indicator {
  animation: fadeIn 0.3s ease-in;
}

.typing-indicator .progress-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: flex-end;
}

.typing-dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--accent-color);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ==================== New Todo Modal Styles ==================== */

/* Header actions container for new todo button */
.todos-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

/* New todo button */
.new-todo-btn {
  width: 28px;
  height: 28px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
  line-height: 1;
}

.new-todo-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

/* Modal content */
.modal-content {
  background: var(--bg-primary);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-tertiary);
  border-radius: 16px 16px 0 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
}

/* Form styles */
#new-todo-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group label .required {
  color: #ef4444;
  margin-left: 2px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-color);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select {
  cursor: pointer;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-group select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Date input - just add larger calendar icon, inherit size from base styles */
.form-group input[type="date"]::-webkit-calendar-picker-indicator {
  width: 32px;
  height: 32px;
  cursor: pointer;
  transform: scale(1.5);
  margin-left: 4px;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
  transform: scale(1.7);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* Modal footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-primary);
}

.btn-secondary,
.btn-primary {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary {
  background: var(--bg-accent);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  min-width: 120px;
  justify-content: center;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== Welcome Modal Styles ==================== */
.welcome-modal-content {
  max-width: 600px;
}

.welcome-modal-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
}

.welcome-header-content {
  width: 100%;
}

.welcome-logo-headline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.welcome-logo-headline h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.welcome-modal-header h3 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.welcome-bullet-list {
  list-style: disc;
  padding-left: 24px;
  margin: 0;
}

.welcome-bullet-list li {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.welcome-bullet-list li:last-child {
  margin-bottom: 0;
}

.welcome-bullet-list a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.welcome-bullet-list a:hover {
  text-decoration: underline;
}

.welcome-modal-footer {
  padding: 20px 24px;
  margin: 0;
}

/* ==================== Flatpickr Custom Styles ==================== */

/* Enlarge the calendar popup */
.flatpickr-large.flatpickr-calendar {
  width: 268px !important;
  font-size: 11px;
}

.flatpickr-large .flatpickr-months {
  padding: 11px 8px;
}

.flatpickr-large .flatpickr-current-month {
  font-size: 12px;
  padding: 5px 0;
}

.flatpickr-large .flatpickr-monthDropdown-months,
.flatpickr-large .numInputWrapper input {
  font-size: 11px;
  padding: 4px 5px;
}

.flatpickr-large .flatpickr-weekdays {
  padding: 8px 0;
  height: auto;
}

.flatpickr-large .flatpickr-weekday {
  font-size: 9px;
  font-weight: 600;
  padding: 5px 0;
}

.flatpickr-large .flatpickr-days {
  padding: 5px;
}

.flatpickr-large .flatpickr-day {
  height: 32px;
  line-height: 32px;
  max-width: 32px;
  font-size: 11px;
  border-radius: 5px;
  margin: 1px;
}

.flatpickr-large .flatpickr-day:hover {
  background: var(--bg-accent);
  border-color: var(--accent-color);
}

.flatpickr-large .flatpickr-day.selected,
.flatpickr-large .flatpickr-day.selected:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.flatpickr-large .flatpickr-day.today {
  border-color: var(--accent-color);
  font-weight: 600;
}

/* Month navigation arrows */
.flatpickr-large .flatpickr-prev-month,
.flatpickr-large .flatpickr-next-month {
  padding: 5px;
}

.flatpickr-large .flatpickr-prev-month svg,
.flatpickr-large .flatpickr-next-month svg {
  width: 11px;
  height: 11px;
}

/* Make the flatpickr responsive with the form */
.form-group .flatpickr-input {
  cursor: pointer;
}

.form-group .flatpickr-input:read-only {
  background-color: var(--bg-primary);
  cursor: pointer;
}

/* ==================== Conversation Modal Styles ==================== */

/* Modal uses standard .message, .message-role, .message-content classes from main chat */
.conversation-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conversation-meta {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-primary);
}
