/* Base styling - More Apple-inspired minimalist design */
:root {
  --bg-color: #f5f5f7; /* Apple-like subtle gray */
  --widget-bg: #ffffff;
  --primary-color: #007aff; /* Apple blue instead of tomato red */
  --text-color: #1d1d1f;
  --text-secondary: #86868b;
  --border-color: #e5e5e7;
  --success-color: #34c759; /* Apple green */
  --danger-color: #ff3b30; /* Apple red */
  --shadow: 0 1px 5px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 2px 10px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  --widget-padding: 1.25rem; /* Reduced padding */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  padding: 1.5rem; /* Reduced padding */
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.dashboard-header {
  text-align: center;
  margin-bottom: 1.25rem; /* Reduced margin */
}

.dashboard-header h1 {
  font-size: 1.75rem; /* Smaller heading */
  font-weight: 600;
  color: var(--text-color);
}

/* Dashboard layout - more compact */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-areas:
    "timer notes"
    "activity activity"
    "archived archived";
  gap: 1rem; /* Reduced gap */
}

/* Widget styling - more compact */
.widget {
  background-color: var(--widget-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--widget-padding);
  transition: var(--transition);
  border: none;
}

.widget:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px); /* More subtle */
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem; /* Reduced margin */
}

.widget-title {
  font-size: 1rem; /* Smaller title */
  font-weight: 600;
  color: var(--text-color);
}

/* Pomodoro timer - more clean */
.pomodoro {
  text-align: center;
  grid-area: timer;
  align-self: start;
  min-height: 282px; /* Match notes height */
  display: flex;
  flex-direction: column;
}

.timer-mode {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.timer-display {
  font-size: 3rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0.25rem 0;
  color: var(--text-color); /* No tomato color */
}

.progress-container {
  width: 100%;
  height: 4px; /* Thinner progress */
  background-color: #f1f5f9;
  border-radius: 2px;
  margin: 0.75rem 0;
  overflow: hidden;
}

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

.timer-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: auto; /* Push to bottom */
  padding-top: 0.75rem;
}

/* Button styling - more Apple-like */
button {
  padding: 0.4rem 1rem;
  min-width: 70px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: none;
}

button:hover:not(:disabled) {
  transform: scale(1.02);
  background-color: #0070e8;
}

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

button.reset {
  background-color: #f1f5f9;
  color: var(--text-color);
}

button.reset:hover:not(:disabled) {
  background-color: #e5e7eb;
}

button.complete {
  background-color: var(--success-color);
}

button.complete:hover:not(:disabled) {
  background-color: #2eb350;
}

/* Notes widget */
.notes-widget {
  grid-area: notes;
  display: flex;
  flex-direction: column;
}

.notes-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Make new note button smaller */
.new-note-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  min-width: auto;
  background-color: #f1f5f9;
  color: var(--text-color);
}

.new-note-btn:hover {
  background-color: #e5e7eb;
}

#notes-area {
  width: 100%;
  min-height: 200px; /* Fixed height to match timer */
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  resize: none; /* Disable resize for cleaner look */
  font-size: 0.9rem;
  background-color: white;
  transition: var(--transition);
  flex-grow: 1;
  margin-top: 0.5rem;
}

#notes-area:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
  outline: none;
}

.save-status {
  font-size: 0.75rem;
  color: var(--success-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Activity list - more compact */
.activity-list-widget {
  grid-area: activity;
}

.activity-list-container {
  margin-top: 0.75rem;
  max-height: 250px; /* Reduced height */
  overflow-y: auto;
  border-radius: var(--radius-sm);
}

.activity-list {
  width: 100%;
  border-collapse: collapse;
}

.activity-list th {
  text-align: left;
  padding: 0.5rem 0.75rem; /* Reduced padding */
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background-color: #f9f9fb;
  position: sticky;
  top: 0;
}

.activity-list td {
  padding: 0.5rem 0.75rem; /* Reduced padding */
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.activity-list tr:hover td {
  background-color: #f5f5f7;
}

.pomodoro-count {
  font-weight: 500;
  color: var(--text-color); /* No color */
}

/* Edit button styling */
.edit-cell {
  width: 40px; /* Narrower */
  text-align: center;
}

.edit-btn {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  padding: 0.2rem;
  min-width: auto;
  cursor: pointer;
  box-shadow: none;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.edit-btn:hover {
  opacity: 1;
  background: transparent;
  transform: none;
  box-shadow: none;
}

/* Archived notes - more compact */
.archived-notes-widget {
  grid-area: archived;
  margin-top: -0.5rem;
}

.toggle-archived {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.toggle-icon {
  display: inline-block;
  transform: rotate(0);
  transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
  transform: rotate(-90deg);
}

.archived-notes-container {
  max-height: 250px; /* Reduced height */
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.archived-notes-container.collapsed {
  max-height: 0;
  overflow: hidden;
}

.archived-notes-list {
  list-style: none;
  margin-top: 0.5rem;
}

.archived-note-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem; /* Reduced padding */
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem; /* Reduced margin */
  background-color: #f9f9fb;
  transition: var(--transition);
  cursor: pointer;
}

.archived-note-item:hover {
  background-color: #f1f5f9;
  transform: translateX(2px);
}

.note-info {
  display: flex;
  flex-direction: column;
}

.note-title {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-color);
}

.note-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Note actions */
.note-actions {
  display: flex;
  gap: 0.3rem;
}

.note-action-btn {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem;
  opacity: 0.5;
  transition: var(--transition);
}

.note-action-btn:hover {
  opacity: 1;
  transform: scale(1.05);
}

.restore-btn:hover {
  color: var(--success-color);
}

.delete-btn:hover {
  color: var(--danger-color);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --widget-bg: #2c2c2e;
    --text-color: #f5f5f7;
    --text-secondary: #a1a1a6;
    --border-color: #38383c;
    --shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
  }

  #notes-area {
    background-color: #38383c;
    border-color: #454549;
  }

  #notes-area:focus {
    background-color: #3a3a3c;
    border-color: var(--primary-color);
  }

  button.reset, .new-note-btn {
    background-color: #3a3a3c;
    color: var(--text-color);
  }

  button.reset:hover:not(:disabled), .new-note-btn:hover {
    background-color: #454549;
  }

  .activity-list th {
    background-color: #2c2c2e;
  }

  .activity-list tr:hover td {
    background-color: #38383c;
  }

  .archived-note-item {
    background-color: #2c2c2e;
  }

  .archived-note-item:hover {
    background-color: #38383c;
  }

  .progress-container {
    background-color: #38383c;
  }
}

/* Responsive layout */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "timer"
      "notes"
      "activity"
      "archived";
  }
}