/* Productivity Dashboard Styles */

/* CSS Custom Properties for Theming */
:root {
  --primary-bg: #f5f5f5;
  --secondary-bg: #ffffff;
  --text-primary: #333333;
  --text-secondary: #666666;
  --accent: #4a90e2;
  --accent-hover: #357abd;
  --border: #e0e0e0;
  --completed: #999999;
  --shadow: rgba(0, 0, 0, 0.1);
}

/* Dark Mode Theme */
body.dark-mode {
  --primary-bg: #1a1a1a;
  --secondary-bg: #2d2d2d;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --border: #404040;
  --completed: #666666;
  --shadow: rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 1rem;
}

/* Container - Mobile First */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Storage Warning Banner */
.storage-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.storage-warning strong {
  font-weight: 600;
}

/* Section Card Styles */
section {
  background-color: var(--secondary-bg);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Greeting Section */
.greeting-section {
  text-align: center;
  grid-column: 1;
}

#greeting {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

#time {
  font-size: 3rem;
  font-weight: 300;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

#date {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Timer Section */
.timer-section {
  text-align: center;
}

#timer-display {
  font-size: 4rem;
  font-weight: 300;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  margin: 1.5rem 0;
}

.timer-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Button Styles */
button {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Input Styles */
input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

input[type="text"]::placeholder {
  color: var(--text-secondary);
}

/* Input Error State */
input[type="text"].input-error {
  border-color: #e74c3c;
  animation: shake 0.5s ease-in-out;
}

/* Shake Animation for Invalid Input */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Form Styles */
form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-direction: column;
}

form button {
  width: 100%;
}

/* Todo Section */
.todo-section ul {
  list-style: none;
  max-height: 320px; /* Height for approximately 4 tasks (4 * 80px) */
  overflow-y: auto;
  padding: 0.75rem; /* Add padding around all sides */
  border-radius: 6px;
  background-color: var(--primary-bg);
  margin: 0; /* Reset any default margin */
}

/* Custom Scrollbar Styling */
.todo-section ul::-webkit-scrollbar {
  width: 6px; /* Make scrollbar thinner */
}

.todo-section ul::-webkit-scrollbar-track {
  background: transparent; /* Make track transparent */
  border-radius: 3px;
}

.todo-section ul::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.todo-section ul::-webkit-scrollbar-thumb:hover {
  background: var(--text-primary);
}

/* Firefox scrollbar styling */
.todo-section ul {
  scrollbar-width: thin;
  scrollbar-color: var(--text-secondary) transparent;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem; /* Increase spacing between items */
  background-color: var(--secondary-bg);
  transition: background-color 0.2s ease;
  border: 1px solid var(--border);
}

.todo-item:last-child {
  margin-bottom: 0; /* Remove margin from last item */
}

.todo-item:hover {
  background-color: var(--border);
}

.todo-item.completed {
  opacity: 0.7;
}

.todo-item.completed .todo-text {
  color: var(--completed);
  text-decoration: line-through;
}

.todo-text {
  flex: 1;
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  padding: 0.25rem;
  margin: -0.25rem;
}

.todo-text:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.todo-edit,
.todo-delete {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  background-color: var(--text-secondary);
}

.todo-delete {
  background-color: #e74c3c;
}

.todo-edit:hover {
  background-color: var(--text-primary);
}

.todo-delete:hover {
  background-color: #c0392b;
}

/* Quick Links Section */
#links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.link-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary-bg);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.link-item:hover {
  background-color: var(--border);
  transform: translateY(-1px);
}

.link-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-item button {
  padding: 0.25rem 0.5rem;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1;
  background-color: #e74c3c;
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-item button:hover {
  background-color: #c0392b;
}

/* Links Form Specific Styles */
#links-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* Desktop Responsive Breakpoint (≥768px) */
@media (min-width: 768px) {
  /* Two Column Grid Layout */
  .container {
    padding: 2rem;
    gap: 2rem;
    grid-template-columns: repeat(2, 1fr);
  }

  /* Greeting spans full width */
  .greeting-section {
    grid-column: 1 / -1;
  }

  /* Typography adjustments */
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  #greeting {
    font-size: 3rem;
  }

  #time {
    font-size: 4rem;
  }

  #date {
    font-size: 1.25rem;
  }

  #timer-display {
    font-size: 5rem;
  }

  /* Form layouts for desktop */
  #todo-form {
    flex-direction: row;
  }

  #todo-form button {
    width: auto;
    min-width: 100px;
  }

  #links-form {
    grid-template-columns: 1fr 1fr auto;
  }

  #links-form button {
    width: auto;
    min-width: 100px;
  }

  /* Section padding */
  section {
    padding: 2rem;
  }
}

/* Additional hover states for better interactivity */
.timer-controls button {
  min-width: 100px;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Visually hidden class for screen reader only content */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Smooth transitions */
* {
  transition-property: background-color, border-color, color, transform;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* Settings Section */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}

.setting-label {
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 30px;
  transition: background-color 0.3s ease;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #a8e063;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(30px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(168, 224, 99, 0.3);
}

/* Statistics Container */
.stats-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: 'Courier New', monospace;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.5rem;
  color: #a8e063;
  font-weight: 600;
}

.stat-unit {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #2d2d2d;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 400px;
  word-wrap: break-word;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  background-color: #e74c3c;
}

.toast-success {
  background-color: #27ae60;
}

.toast-info {
  background-color: #3498db;
}

.toast-warning {
  background-color: #f39c12;
}

/* Dark mode toast adjustments */
body.dark-mode .toast {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
/* Task Controls */
.task-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
}

.filter-tab {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab:hover {
  background-color: var(--border);
  color: var(--text-primary);
}

.filter-tab.active {
  background-color: #a8e063;
  color: #1a1a1a;
  border-color: #a8e063;
}

.sort-dropdown select {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.sort-dropdown select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Dark mode adjustments for controls */
body.dark-mode .sort-dropdown select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%9ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .task-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-tabs {
    justify-content: center;
  }
  
  .sort-dropdown {
    align-self: stretch;
  }
  
  .sort-dropdown select {
    width: 100%;
  }
}