/* Journal Prompt - Component Styles */

/* Mood Check-in Components */
.mood-checkin {
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.mood-checkin h3 {
  text-align: center;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.mood-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.mood-btn {
  background: var(--surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  font-weight: 500;
}

.mood-btn:hover {
  border-color: var(--primary-color);
  background: rgb(99 102 241 / 0.05);
}

.mood-btn.selected {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.mood-intensity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.mood-intensity label {
  font-weight: 500;
  color: var(--text-primary);
}

.mood-intensity input[type="range"] {
  width: 200px;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.mood-intensity input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow);
}

.mood-intensity input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow);
}

/* Writing Interface */
.writing-section {
  margin-bottom: var(--space-2xl);
}

.writing-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.writing-stats {
  display: flex;
  gap: var(--space-lg);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.writing-stats span {
  font-weight: 500;
}

.auto-save-status {
  color: var(--secondary-color);
  font-weight: 600;
}

.auto-save-status.saving {
  color: var(--accent-color);
}

.writing-actions {
  display: flex;
  gap: var(--space-sm);
}

.editor-container {
  background: var(--surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
  min-height: 400px;
}

.editor-container:focus-within {
  border-color: var(--primary-color);
}

.editor {
  width: 100%;
  min-height: 400px;
  padding: var(--space-xl);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
}

.editor:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  font-style: italic;
}

.editor.focus-mode {
  font-size: 1.25rem;
  line-height: 1.8;
}

.editor.full-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  background: var(--background);
  border-radius: 0;
  padding: var(--space-2xl);
}

.writing-actions-bottom {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* History Components */
.history-controls {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  justify-content: center;
  flex-wrap: wrap;
}

.history-controls input,
.history-controls select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.history-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-2xl);
  align-items: start;
}

.calendar-container {
  position: sticky;
  top: calc(80px + var(--space-md));
}

.calendar {
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.calendar-nav-btn {
  background: none;
  border: none;
  padding: var(--space-sm);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.calendar-title {
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--surface);
  padding: var(--space-sm);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.calendar-day {
  background: var(--background);
  padding: var(--space-sm);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

.calendar-day:hover {
  background: var(--surface);
}

.calendar-day.other-month {
  color: var(--text-muted);
  background: var(--border-light);
}

.calendar-day.today {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

.calendar-day.has-entry {
  background: rgb(16 185 129 / 0.1);
  border: 2px solid var(--secondary-color);
}

.calendar-day.has-entry.today {
  background: var(--primary-color);
}

.calendar-day.selected {
  background: var(--primary-color);
  color: white;
}

.entry-viewer {
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  min-height: 400px;
}

.entry-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.entry-display {
  animation: fadeInUp 0.3s ease;
}

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

.entry-date {
  font-weight: 600;
  color: var(--text-primary);
}

.entry-prompt-ref {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
}

.entry-content {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.entry-stats {
  display: flex;
  gap: var(--space-lg);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

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

.mood-indicator {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Statistics Components */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.stats-card {
  background: rgba(51, 65, 85, 1);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 180px;
}

.stats-card.full-width {
  grid-column: 1 / -1;
  margin-top: 48px;
}

.stats-card h3 {
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  width: 100%;
  text-align: center;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

.metric-value {
  font-size: 64px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
  margin-bottom: 16px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.7;
  line-height: 1.4;
}

.category-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
  flex: 1;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
}

.category-name {
  font-weight: 500;
  color: var(--text-primary);
}

.category-count {
  background: var(--primary-color);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
}

.mood-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  flex: 1;
}

.mood-trend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  background: var(--surface);
  border-radius: var(--radius);
}

.heatmap-container {
  overflow-x: auto;
  padding: 32px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 2px;
  min-width: 800px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--border-light);
  transition: all var(--transition-fast);
}

.heatmap-cell.level-1 { background: rgb(16 185 129 / 0.3); }
.heatmap-cell.level-2 { background: rgb(16 185 129 / 0.6); }
.heatmap-cell.level-3 { background: rgb(16 185 129 / 0.8); }
.heatmap-cell.level-4 { background: var(--secondary-color); }

/* Settings Components */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-2xl);
}

.settings-section {
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.settings-section h3 {
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-md);
}

.setting-item {
  margin-bottom: var(--space-lg);
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.setting-item input[type="checkbox"] {
  margin-right: var(--space-sm);
}

.setting-item select,
.setting-item input[type="range"] {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.setting-item input[type="range"] {
  padding: 0;
  height: 6px;
}

/* Modal Components */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  animation: slideInUp 0.3s ease;
}

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

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: var(--space-sm);
  border-radius: var(--radius);
}

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

.modal-content {
  padding: var(--space-lg);
  max-height: 70vh;
  overflow-y: auto;
}

/* Notification Components */
.notifications-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.notification {
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow);
  min-width: 300px;
  animation: slideInRight 0.3s ease;
  position: relative;
}

.notification.success {
  border-left: 4px solid var(--secondary-color);
}

.notification.error {
  border-left: 4px solid var(--danger-color);
}

.notification.info {
  border-left: 4px solid var(--primary-color);
}

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

/* Responsive Adjustments for Components */
@media (max-width: 768px) {
  .history-layout {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
  
  .calendar-container {
    position: static;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .mood-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .writing-tools {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .writing-stats {
    justify-content: center;
  }
  
  .writing-actions {
    justify-content: center;
  }
  
  .editor {
    padding: var(--space-lg);
    font-size: 1rem;
  }
  
  .notifications-container {
    top: var(--space-sm);
    right: var(--space-sm);
    left: var(--space-sm);
  }
  
  .notification {
    min-width: auto;
  }
  
  .modal {
    margin: var(--space-md);
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .metric-value {
    font-size: 48px;
  }
  
  .stats-card {
    padding: 24px;
    min-height: 150px;
  }
}