/* Project management styles for the Flow State app */

#projectCard {
  grid-column: 1 / -1;
  margin-bottom: 10px;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Project Dropdown - Theme-style */
.project-dropdown {
  position: relative;
  flex: 1;
  margin-right: 10px; /* Space between dropdown and button */
}

.project-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
  justify-content: space-between;
  transition: border-color var(--transition);
}

.project-dropdown-btn:hover {
  border-color: var(--accent);
}

.project-name-display {
  display: flex;
  align-items: center;
}

.project-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 10px;
}

.project-dropdown-content {
  position: absolute;
  left: 0;
  top: calc(100% + 5px);
  width: 100%;
  background: var(--bg-alt);
  border-radius: var(--radius);
  box-shadow: 0 3px 8px var(--shadow);
  z-index: 100;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  max-height: 300px;
  overflow-y: auto;
}

.project-dropdown.active .project-dropdown-content {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.project-option {
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between; /* Space between name and delete button */
}

.project-name-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 40px); /* Leave space for the delete button */
}

.project-name-wrapper span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-project-name {
  max-width: 180px; /* Adjust based on your layout */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* Make sure project options also clip text */
.project-option span:not(.project-color-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 30px); /* Account for the dot */
}

.project-name-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-delete-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0.7;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.project-delete-btn:hover {
  background-color: rgba(var(--danger-rgb, 255, 59, 48), 0.1);
  color: rgb(var(--danger-rgb, 255, 59, 48));
  opacity: 1;
}

/* Define danger color variable for themes */
:root {
  --danger-rgb: 255, 59, 48;
}

/* Old project selector (kept for fallback) */
.project-selector-container {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  margin-right: 20px;
  display: none; /* Hidden in favor of the new dropdown */
}

#projectSelector {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius);
  background-color: var(--bg);
  border: 1px solid var(--muted);
  color: var(--fg);
  font-size: 0.9rem;
}

#newProjectBtn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap; /* Prevent button text from wrapping */
}

#newProjectBtn i {
  font-size: 0.8rem;
}

#projectFormContainer {
  margin-top: 10px;
  background-color: var(--bg-alt);
  padding: 12px;
  border-radius: var(--radius);
  display: none;
}

.project-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#projectNameInput {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--muted);
  background-color: var(--bg);
  color: var(--fg);
}

#saveProjectBtn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  align-self: flex-end;
}

/* Color picker styles */
.color-picker-container {
  margin-top: 5px;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.color-option {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
  border: 2px solid transparent;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border: 2px solid var(--fg);
  box-shadow: 0 0 0 2px var(--bg);
}

/* Modal Dialog Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  justify-content: center;
  align-items: center;
}

/* Ensures the modal is properly displayed */
#projectModal.modal.active {
  display: flex !important;
}

.modal-content {
  position: relative;
  background-color: var(--bg);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  padding: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  max-height: 85vh;
  overflow-y: auto;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.close-modal:hover {
  color: var(--fg);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.form-group label {
  font-weight: 500;
}

#modalProjectName {
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--muted);
  background-color: var(--bg-alt);
  color: var(--fg);
  font-size: 1rem;
}

/* Enhanced color options display */
.modal-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-alt);
  border-radius: var(--radius);
  justify-content: center;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, border 0.2s;
  border: 2px solid transparent;
}

.color-option:hover {
  transform: scale(1.15);
}

.color-option.selected {
  border: 3px solid var(--fg);
  box-shadow: 0 0 0 2px var(--bg);
}

.modal-save-btn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 12px 15px;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  margin-top: 15px;
  transition: background-color 0.2s;
}

.modal-save-btn:hover {
  background-color: #0056b3;
}

/* Project color indicator in selector */
.project-color-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* Goal card project styling */
#goalCard .project-header {
  margin-top: 5px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--shadow);
  padding-bottom: 15px;
}

/* Target focus time and daily check-in styles */
.daily-target-indicator {
  margin-top: 12px;
  padding: 10px 15px;
  background: var(--bg-alt);
  transition: all 0.3s ease;
}

.daily-target-indicator.target-complete {
  background: rgba(50, 180, 50, 0.15);
  border-left: 3px solid var(--green, #4CAF50);
}

.target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.streak-counter {
  font-weight: 500;
  color: var(--fg);
}

.target-progress-container {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.target-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease;
}

.target-complete .target-progress-bar {
  background: var(--green, #4CAF50);
}

/* Target settings section */
.target-settings {
  margin-top: 15px;
  padding: 15px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
}

.target-header-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.target-header-group h3 {
  font-size: 1rem;
  margin: 0;
  font-weight: 500;
}

.target-progress {
  font-size: 0.9rem;
  color: var(--fg);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.target-progress .target-complete {
  color: var(--green, #4CAF50);
}

/* Project Focus Target card specific styling */
.project-focus-target {
  background-color: var(--bg-alt);
  border-radius: var(--radius);
  padding: 15px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  border-left: 3px solid var(--accent);
}

.project-focus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-focus-header h3 {
  font-size: 1rem;
  margin: 0;
  font-weight: 500;
  color: var(--fg);
}

.project-focus-value {
  display: flex;
  align-items: center;
  gap: 15px;
}

.focus-target-display {
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
}

#editTargetBtn {
  background-color: var(--bg);
  border: 1px solid var(--muted);
  color: var(--fg);
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

#editTargetBtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Target input field */
.target-input-container {
  display: flex;
  gap: 8px;
  margin-top: 5px;
}

.target-input {
  flex: 1;
  max-width: 80px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.9rem;
  text-align: center;
  box-sizing: border-box;
}

.target-input:focus {
  outline: none;
  border-color: var(--accent);
}

.target-save-btn {
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.target-save-btn:hover {
  filter: brightness(1.1);
}

.target-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 8px 0 0 0;
  line-height: 1.4;
}

/* Target value display */
#targetValueDisplay {
  font-size: 1.125rem;
  margin-bottom: 12px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* Target input mode */
.target-input-container {
  margin-bottom: 12px;
  display: none;
}

.compact-target-input {
  display: flex;
  align-items: center;
  max-width: 200px;
  margin-bottom: 10px;
}

.target-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--fg);
  font-family: inherit;
  -moz-appearance: textfield; /* Firefox */
}

/* Hide spinner buttons in webkit browsers */
.target-input::-webkit-inner-spin-button, 
.target-input::-webkit-outer-spin-button { 
  -webkit-appearance: none;
  margin: 0;
}

.target-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.target-save-btn {
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.target-save-btn:hover {
  background: var(--accent-hover, var(--accent));
  opacity: 0.9;
}

/* Target edit button */
#editTargetBtn {
  background-color: var(--bg);
  border: 1px solid var(--muted);
  color: var(--fg);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

#editTargetBtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.target-description {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 5px 0 0 0;
}

/* Check-in section */
.checkin-container {
  margin-top: 15px;
  padding: 15px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
}

.checkin-container h3 {
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 12px;
}

.checkin-input {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  margin-bottom: 12px;
  resize: vertical;
  font-family: inherit;
}

.checkin-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkin-btn:hover {
  background: var(--accent-hover, var(--accent));
  transform: translateY(-1px);
}

/* Check-in history list */
.checkin-history {
  margin-top: 15px;
}

.checkin-history-item {
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
}

.checkin-history-item.target-met {
  border-left-color: var(--green, #4CAF50);
}

.checkin-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.checkin-reflection {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Streak record styling */
.streak-record {
  margin-top: 15px;
}

.streak-record-container {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  gap: 20px;
}

.current-streak, .highest-streak, .streak-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 15px 10px;
  border-radius: 10px;
  position: relative;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
}

.current-streak {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-hover));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.highest-streak {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-hover));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.streak-stats {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-hover));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.streak-record h3 {
  margin: 0 0 5px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.streak-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 10px 0;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.streak-flame {
  font-size: 1.8rem;
  margin-left: 2px;
}

.streak-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: lowercase;
}

.streak-date {
  font-size: 0.8rem;
  margin-top: 5px;
  color: var(--text-secondary);
}

.streak-progress-container {
  width: 100%;
  margin: 15px 0 5px;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.streak-progress-bar {
  height: 100%;
  background-color: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.streak-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 15px;
  width: 100%;
}

.calendar-day {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background-color: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  margin: 0 auto;
  position: relative;
}

.calendar-day.target-met {
  background-color: var(--accent);
  color: white;
}

.streak-info {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.streak-info i {
  color: var(--accent);
}

.streak-details {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  width: 100%;
}

.streak-message {
  text-align: center;
  margin: 10px 0;
  padding: 8px;
  border-radius: 5px;
  background-color: var(--bg-light);
  font-size: 0.9rem;
  color: var(--text-color);
}

.streak-milestone {
  font-weight: bold;
  color: var(--accent);
}

/* Row for additional stats below main streak metrics */
.streak-additional-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-item {
  flex: 1;
  min-width: 120px;
  background-color: var(--bg-light);
  padding: 10px;
  border-radius: 8px;
  text-align: center;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Responsive layout for smaller screens */
@media (max-width: 768px) {
  .streak-record-container {
    flex-direction: column;
    gap: 15px;
  }
  
  .current-streak, .highest-streak, .streak-stats {
    width: 100%;
  }
}

/* Responsive layout for tablet screens */
@media (min-width: 800px) and (max-width: 1024px) {
  .streak-record-container {
    flex-direction: column;
    gap: 15px;
  }
  
  .current-streak, .highest-streak, .streak-stats {
    width: 100%;
    max-width: 100%;
  }
}

/* Add a divider between the streak records */
.current-streak {
  border-right: 1px solid var(--border);
}

/* Highlight when there's an active streak */
.current-streak .streak-value:not(:contains('0')) {
  color: var(--accent);
}

/* Auto-checkin info styling */
.auto-checkin-info {
  display: flex;
  background: var(--bg-alt);
  padding: 15px;
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
}

.info-icon {
  font-size: 24px;
  color: var(--accent);
  margin-right: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.info-content {
  flex: 1;
}

.info-content p {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.info-content p:last-child {
  margin-bottom: 0;
}

/* Mobile styles */
@media (max-width: 1200px) {
  .project-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .project-dropdown {
    margin-right: 0;
    margin-bottom: 10px;
  }
}

/* Mobile styles */
@media (max-width: 600px) {
  .project-option {
    padding: 0px 10px;
  }
  
  .project-selector-container {
    margin-right: 0; /* Remove spacing on mobile */
    margin-bottom: 10px;
  }
  
  .project-form {
    flex-direction: column;
  }
  
  #projectNameInput, #saveProjectBtn {
    width: 100%;
  }
  
  .modal-content {
    width: 90%;
    margin: 0 auto;
    padding: 20px;
    max-height: 80vh;
  }
  
  .modal-color-options {
    gap: 10px;
    padding: 10px;
  }
  
  .color-option {
    width: 30px;
    height: 30px;
  }

  .project-delete-btn {
    opacity: 1;
    padding: 8px 10px; /* Larger touch target on mobile */
  }
}