/* Journal Module Styles */
.journal-layout {
  display: flex;
  height: 100%;
  position: relative;
}

/* Sidebar */
.journal-sidebar {
  width: 240px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.journal-layout.sidebar-collapsed .journal-sidebar {
  width: 0;
  opacity: 0;
  overflow: hidden;
  border-right: none;
}

.journal-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.journal-today-btn {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--accent-primary);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.journal-today-btn:hover {
  opacity: 0.9;
}

.journal-sidebar-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.journal-sidebar-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.journal-sidebar-actions button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Sidebar toggle */
.journal-sidebar-toggle {
  position: absolute;
  left: 240px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 4px 4px 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: left 0.2s ease, background var(--transition-fast);
  z-index: 10;
}

.journal-layout.sidebar-collapsed .journal-sidebar-toggle {
  left: 0;
}

.journal-sidebar-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Search */
.journal-search-container {
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.journal-search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: var(--font-system);
  outline: none;
  box-sizing: border-box;
}

.journal-search-input::placeholder {
  color: var(--text-muted);
}

.journal-search-input:focus {
  background: var(--bg-secondary);
}

.journal-search-results {
  flex: 1;
  overflow-y: auto;
}

.journal-search-empty {
  padding: var(--spacing-md);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.journal-search-result {
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.journal-search-result:hover {
  background: var(--bg-secondary);
}

.journal-search-result-date {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-primary);
  margin-bottom: 2px;
}

.journal-search-result-snippet {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.journal-search-result-snippet mark {
  background: var(--accent-primary);
  color: white;
  border-radius: 2px;
  padding: 0 2px;
}

/* Calendar */
.journal-calendar-container {
  padding: var(--spacing-sm) var(--spacing-md);
}

.journal-calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.journal-cal-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.journal-cal-prev,
.journal-cal-next {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.journal-cal-prev:hover,
.journal-cal-next:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.journal-cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: var(--spacing-xs);
}

.journal-cal-header span {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 2px 0;
}

.journal-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.journal-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
}

.journal-cal-day:hover:not(.other-month) {
  background: var(--bg-tertiary);
}

.journal-cal-day.other-month {
  visibility: hidden;
  cursor: default;
}

.journal-cal-day.today {
  color: var(--accent-primary);
  font-weight: 700;
}

.journal-cal-day.selected {
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
}

.journal-cal-day.selected.today {
  color: white;
}

.journal-cal-day.has-entry::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.journal-cal-day.selected.has-entry::after {
  background: white;
}

/* Sidebar footer */
.journal-sidebar-footer {
  padding: var(--spacing-sm) var(--spacing-md);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--spacing-xs);
}

.journal-export-btn,
.journal-import-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.journal-export-btn:hover,
.journal-import-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Main content */
.journal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Editor */
.journal-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.journal-date-header {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.journal-view-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.journal-view-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.journal-view-toggle span {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Content area */
.journal-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  justify-content: center;
}

.journal-textarea {
  width: 100%;
  max-width: 700px;
  padding: var(--spacing-lg) var(--spacing-xl);
  border: none;
  background: var(--bg-window);
  color: var(--text-primary);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.8;
  resize: none;
  outline: none;
}

.journal-textarea::placeholder {
  color: var(--text-muted);
}

/* Preview */
.journal-preview {
  width: 100%;
  max-width: 700px;
  padding: var(--spacing-lg) var(--spacing-xl);
  overflow-y: auto;
  display: none;
}

.journal-preview h1,
.journal-preview h2,
.journal-preview h3,
.journal-preview h4,
.journal-preview h5,
.journal-preview h6 {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--text-primary);
  margin: 1.5em 0 0.5em;
  line-height: 1.3;
}

.journal-preview h1 {
  font-size: 2em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

.journal-preview h2 { font-size: 1.5em; }
.journal-preview h3 { font-size: 1.25em; }

.journal-preview p {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-primary);
  margin: 1em 0;
}

.journal-preview ul,
.journal-preview ol {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-primary);
  margin: 1em 0;
  padding-left: 2em;
}

.journal-preview li { margin: 0.5em 0; }

.journal-preview blockquote {
  border-left: 4px solid var(--accent-primary);
  padding-left: var(--spacing-md);
  margin: 1em 0;
  color: var(--text-secondary);
  font-style: italic;
}

.journal-preview code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.journal-preview pre {
  background: var(--bg-tertiary);
  padding: var(--spacing-md);
  border-radius: 4px;
  overflow-x: auto;
  margin: 1em 0;
}

.journal-preview pre code {
  background: none;
  padding: 0;
}

.journal-preview a {
  color: var(--accent-primary);
  text-decoration: underline;
}

.journal-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.journal-preview hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

/* Status bar */
.journal-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-md);
  border-top: 1px solid var(--border-color);
  background: var(--bg-window-header);
}

.journal-word-count {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.journal-save-status {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}
