/* CSS Custom Properties */
:root {
  --color-bg-primary: #faf9f7;
  --color-bg-secondary: #fffffe;
  --color-border: #e2e8f0;
  --color-border-light: #e5e5e5;
  --color-border-muted: #d4d4d4;
  --color-text-primary: #171717;
  --color-text-secondary: #374151;
  --color-text-muted: #737373;
  --color-text-light: #a3a3a3;
  --color-button-primary: #374151;
  --color-button-primary-hover: #1f2937;
  --color-button-secondary: #6b7280;
  --color-button-secondary-hover: #4b5563;
  --color-button-danger: #dc2626;
  --color-button-danger-hover: #b91c1c;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-xxl: 24px;
  --space-xxxl: 28px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
  --font-serif: 'Crimson Text', 'Charter', 'Georgia', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --color-brief: #3b82f6;
  --color-note: #f59e0b;
  --color-copy: #8b5cf6;
  --color-task: #10b981;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg-primary);
  min-height: 100vh;
  color: var(--color-text-secondary);
}

h1, h2, h3 {
  font-family: var(--font-serif);
  color: var(--color-text-primary);
}

.header {
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: 0;
}

.breadcrumb-bar {
  background: #f7f6f4;
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-sm) var(--space-xl);
  margin-bottom: var(--space-xl);
  overflow-x: auto;
  white-space: nowrap;
}

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

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: white;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.breadcrumb-item:hover {
  background: #f8f8f8;
  border-color: var(--color-border);
  transform: translateY(-1px);
}

.breadcrumb-item[data-brief-color] {
  border-left: 3px solid var(--item-color);
}

.breadcrumb-item-type {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.breadcrumb-item-title {
  color: var(--color-text-primary);
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-selector {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.project-selector h1 {
  font-size: 20px;
  font-weight: 600;
}

.input-group {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

input, textarea, select {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--color-bg-secondary);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-button-primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  background: var(--color-button-primary);
  color: white;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-secondary {
  background: var(--color-button-secondary);
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--color-button-danger);
  padding: var(--space-xs) var(--space-sm);
  font-size: 11px;
}

.btn-small {
  padding: var(--space-xs) var(--space-md);
  font-size: 12px;
  height: auto;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.panel {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-xl);
  min-height: 400px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.panel.drag-over {
  background: #f8f8f8;
  border: 2px dashed var(--color-button-primary);
  transform: scale(1.02);
}

/* File drag-over for briefs panel */
.panel-briefs.file-drag-over {
  background: #f0f7ff;
  border: 2px dashed #3b82f6;
}

.panel-briefs.file-drag-over::after {
  content: '📄 Drop Word doc to create brief';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(59, 130, 246, 0.95);
  color: white;
  padding: 20px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  pointer-events: none;
  z-index: 100;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.panel-header .icon {
  font-size: 14px;
  font-weight: 600;
}

.panel-briefs { grid-area: briefs; }
.panel-tasks { grid-area: tasks; }
.panel-notes { grid-area: notes; }
.panel-copy { grid-area: copy; }

/* Project color will be applied dynamically */
.panel[data-project-theme] {
  border-left: 3px solid var(--project-color, #3b82f6);
}

.item {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-lg) var(--space-xl) var(--space-lg) 40px;
  margin-bottom: var(--space-md);
  position: relative;
  cursor: grab;
}

.item:hover {
  box-shadow: var(--shadow-sm);
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  align-items: center;
}

.task-checkbox-container {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.item-title {
  font-weight: 600;
  flex: 1;
  word-break: break-word;
  overflow-wrap: break-word;
}

.item-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}

.item-preview {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  word-break: break-word;
  overflow-wrap: break-word;
}

.brief-item { border-left: 3px solid var(--color-brief); }
.note-item { border-left: 3px solid var(--color-note); }
.copy-item { border-left: 3px solid var(--color-copy); }
.task-item { border-left: 3px solid var(--color-task); }

.grab-handle {
  display: none;
}

.scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Briefs panel should be limited height so tasks always visible */
.panel-briefs .scrollable {
  max-height: 400px;
  flex: initial;
}

.dashboard {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-xl);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-xl);
  grid-template-areas: 
    "briefs notes copy"
    "tasks notes copy";
}

.panel-briefs { grid-area: briefs; }
.panel-tasks { grid-area: tasks; }
.panel-notes { grid-area: notes; }
.panel-copy { grid-area: copy; }

.project-overview {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-xl);
  display: none;
}

.overview-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--space-xl);
  align-items: start;
  height: calc(100vh - 80px); /* Full height minus header */
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-xl);
  overflow-y: auto;
  height: 100%;
}

.project-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-xxl);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  border-left: 4px solid var(--color-brief);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card.theme-blue { border-left-color: #3b82f6; }
.project-card.theme-green { border-left-color: #10b981; }
.project-card.theme-purple { border-left-color: #8b5cf6; }
.project-card.theme-pink { border-left-color: #ec4899; }
.project-card.theme-orange { border-left-color: #f97316; }
.project-card.theme-teal { border-left-color: #14b8a6; }
.project-card.theme-indigo { border-left-color: #6366f1; }
.project-card.theme-red { border-left-color: #ef4444; }

.project-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
}

.project-description {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.4;
}

.project-stats {
  display: flex;
  gap: var(--space-md);
  font-size: 12px;
  color: var(--color-text-secondary);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--color-border-light);
  margin-top: var(--space-md);
}

.project-stats span {
  padding: 2px 8px;
  background: #f8f8f8;
  border-radius: var(--radius-sm);
}

.project-updated {
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: var(--space-sm);
}

.global-tasks-panel {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.global-tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.global-tasks-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.global-tasks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  flex: 1;
}

.global-task-item {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-lg) var(--space-xl) var(--space-lg) 40px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  margin-bottom: var(--space-md);
}

.global-task-item:hover {
  box-shadow: var(--shadow-sm);
}

.global-task-item[data-project-theme] {
  border-left: 3px solid var(--project-color, #3b82f6);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-xxxl);
  width: 90%;
  max-width: 500px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  align-items: center;
}

.form-group {
  margin-bottom: var(--space-lg);
}

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
}

.modal-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

.editor-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1500;
}

.editor-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-bg-secondary);
  padding: var(--space-xxxl);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  align-items: center;
  flex-wrap: nowrap;
}

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

.editor-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-shrink: 0;
}

.pomodoro-timer {
  background: #374151;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  border: 1px solid #4b5563;
}

.pomodoro-display {
  font-size: 14px;
  font-weight: 600;
  font-family: 'Monaco', 'Menlo', monospace;
  min-width: 50px;
}

.pomodoro-status {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 500;
  min-width: 100px;
}

.pomodoro-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pomodoro-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #374151;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  cursor: pointer;
  font-weight: 500;
}

.pomodoro-btn:hover {
  background: white;
}

.pomodoro-stats {
  font-size: 10px;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Pomodoro states - Blue default, Red/Pink running, Green break */
.editor-header {
  background: #3b82f6; /* Blue by default */
  color: white;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin: calc(var(--space-xxxl) * -1) calc(var(--space-xxxl) * -1) var(--space-xl);
  padding: var(--space-xl) var(--space-xxxl) var(--space-md);
  transition: background 0.3s ease;
}

.editor-header h3,
.editor-header .close-btn {
  color: white;
}

.editor-header .pomodoro-timer {
  background: transparent;
  border: none;
  color: white;
}

.editor-header .pomodoro-btn {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  color: white;
}

.editor-header .pomodoro-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Pomodoro active state - Red/Pink when running */
.editor-header.pomodoro-active {
  background: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
}

/* Pomodoro break state - Green when completed/break */
.editor-header.pomodoro-break {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
}

.editor-header.pomodoro-break h3,
.editor-header.pomodoro-break .close-btn {
  color: white;
}

.editor-header.pomodoro-break .pomodoro-timer {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.editor-header.pomodoro-break .pomodoro-btn {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
  color: white;
}

.editor-toolbar {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  padding: var(--space-sm);
  background: #f9f8f6;
  border-radius: var(--radius-sm);
}

.editor-toolbar button {
  padding: var(--space-xs) var(--space-sm);
  font-size: 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}

.editor-textarea, #richEditor {
  width: 100%;
  min-height: 300px;
  padding: var(--space-lg);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-sm);
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none; }

@media (max-width: 1400px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
}

/* Rich Text Editor Styles */
.rich-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px 4px 0 0;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-btn {
  padding: 6px 12px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  font-family: Arial, sans-serif;
  display: inline-block;
  position: relative;
}

.toolbar-btn * {
  pointer-events: none; /* Make child elements not intercept clicks */
}

.toolbar-btn:hover {
  background: #e8e8e8;
  border-color: #999;
}

.toolbar-btn:active {
  background: #d0d0d0;
}

.toolbar-sep {
  color: #ccc;
  margin: 0 4px;
}

.rich-editor {
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  background: white;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
}

.rich-editor:focus {
  outline: none;
  border-color: var(--color-button-primary);
}

.rich-editor p {
  margin: 0 0 12px 0;
}

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

/* Ensure formatting works in editor */
.rich-editor strong,
.rich-editor b {
  font-weight: bold;
}

.rich-editor u {
  text-decoration: underline;
}

.rich-editor em,
.rich-editor i {
  font-style: italic;
}

.editor-modal-content {
  max-width: 900px;
  width: 90%;
}

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

#pomodoroTimerContainer {
  display: flex;
  align-items: center;
}

.rich-toolbar {
  gap: 4px;
  padding: 8px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  flex-wrap: wrap;
}

.rich-text-toolbar button {
  padding: 6px 12px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  font-family: Arial, sans-serif;
}

.rich-text-toolbar button:hover {
  background: #e8e8e8;
  border-color: #999;
}

.rich-text-toolbar button:active {
  background: #d0d0d0;
}

.toolbar-divider {
  width: 1px;
  background: #ccc;
  margin: 0 4px;
  align-self: stretch;
}

.rich-text-editor {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  background: white;
}

.rich-text-editor:focus {
  outline: none;
  border-color: var(--color-button-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.rich-text-editor p {
  margin: 0 0 12px 0;
}

.rich-text-editor ul, .rich-text-editor ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
}

.rich-text-editor li {
  margin-bottom: 4px;
}

.rich-text-editor h1, .rich-text-editor h2, .rich-text-editor h3 {
  margin: 16px 0 8px 0;
  font-weight: 600;
}

.editor-modal-content {
  max-width: 900px;
  width: 90%;
}

/* Completed tasks styling */
.task-item.completed,
.global-task-item.completed {
  opacity: 0.5;
  background: #f5f5f5;
}

.task-item.completed .item-title,
.global-task-item.completed .item-title {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* Deep Focus Mode - Fullscreen */
/* DEEP FOCUS MODE - Simple fullscreen with night mode option */
.modal.deep-focus-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.modal.deep-focus-mode .modal-content,
.modal.deep-focus-mode .editor-modal-content {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.modal.deep-focus-mode .editor-header {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding-left: 40px;
    padding-right: 40px;
}

.modal.deep-focus-mode .editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px !important;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Night Mode */
.modal.night-mode {
    background: #1a1a1a !important;
}

.modal.night-mode .modal-content,
.modal.night-mode .editor-modal-content {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
}

.modal.night-mode .editor-header {
    background: #2a2a2a !important;
    border-bottom-color: #3a3a3a !important;
    color: #e0e0e0 !important;
}

.modal.night-mode input,
.modal.night-mode textarea,
.modal.night-mode .rich-editor {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border-color: #3a3a3a !important;
}

.modal.night-mode .close-btn {
    color: #e0e0e0 !important;
}

.modal.night-mode label {
    color: #b0b0b0 !important;
}

.modal.night-mode .rich-toolbar {
    background: #2a2a2a !important;
    border-color: #3a3a3a !important;
}

.modal.night-mode .toolbar-btn {
    color: #e0e0e0 !important;
    background: transparent !important;
}

.modal.night-mode .toolbar-btn:hover {
    background: #3a3a3a !important;
    color: #ffffff !important;
}

.modal.night-mode .toolbar-btn.active {
    background: #4a4a4a !important;
    color: #ffffff !important;
}

.modal.night-mode .toolbar-sep {
    background: #4a4a4a !important;
}
