/* ===================================
   Habits Section
   =================================== */

/* Habits Header */
.habits-header {
    margin-bottom: 24px;
}

/* Add Habit Form */
.add-habit-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.add-habit-form input[type="text"] {
    flex: 1;
    min-width: 150px;
    height: 36px;
    padding: 8px 12px;
}

.add-habit-form input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    -webkit-appearance: none;
    border: none;
}

.add-habit-form input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.add-habit-form input[type="color"]::-webkit-color-swatch {
    border-radius: 50%;
    border: none;
}

.habit-target-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.habit-target-group input[type="number"] {
    width: 80px;
    height: 36px;
    padding: 8px 12px;
    text-align: center;
}

/* Habits List */
#habitsList {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

/* Habit Item */
.habit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.habit-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

/* Habit Info */
.habit-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.habit-info .color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.habit-name {
    font-weight: 600;
    font-size: 1rem;
}

.habit-target {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Habit Progress */
.habit-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
}

.habit-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.habit-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.habit-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

/* Habit Actions */
.habit-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.habit-quick-add {
    display: flex;
    gap: 4px;
}

.habit-quick-btn {
    padding: 4px 8px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.habit-quick-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    border-color: var(--accent);
    transform: scale(1.05);
}

.habit-delete-btn {
    padding: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.habit-delete-btn:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Completion Level Colors */
.habit-progress-fill.level-0 {
    background: var(--text-muted);
}

.habit-progress-fill.level-1 {
    background: #f59e0b; /* Amber - >5min */
}

.habit-progress-fill.level-2 {
    background: #8b5cf6; /* Purple - >50% */
}

.habit-progress-fill.level-3 {
    background: #10b981; /* Green - 100% */
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

/* Habits Calendar */
#habitsCalendar {
    margin-top: 32px;
}

 .calendar-header {
     display: flex;
     flex-direction: column;
     gap: 12px;
     margin-bottom: 16px;
 }
 
 .calendar-controls {
     display: flex;
     gap: 16px;
     align-items: center;
     flex-wrap: wrap;
 }
 
  .calendar-controls select {
      padding: 8px 12px;
      background: var(--card-bg);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-sm);
      color: var(--text-primary);
      cursor: pointer;
      transition: all 0.2s ease;
      font-size: 0.9rem;
  }
 
 .calendar-controls select:hover {
     border-color: var(--accent);
 }
 
 .calendar-controls select:focus {
     outline: none;
     border-color: var(--accent);
     box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
 }

.calendar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

 .calendar-nav button {
     padding: 6px 12px;
     background: var(--card-bg);
     border: 1px solid var(--border-color);
     border-radius: var(--radius-sm);
     color: var(--text-primary);
     cursor: pointer;
     transition: all 0.2s ease;
 }

.calendar-nav button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

/* Calendar Heat Map */
.heatmap {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

 .heatmap-day {
      aspect-ratio: 1;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-color);
      transition: all 0.2s ease;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 2px;
      position: relative;
  }

 .heatmap-day .date-label {
     font-size: 0.65rem;
     color: var(--text-muted);
     font-weight: 600;
     line-height: 1;
 }

  .heatmap-day .status-text {
      font-size: 0.7rem;
      font-weight: 700;
      line-height: 1;
      color: var(--text-primary);
  }
  
  .heatmap-day .habit-tags {
      display: flex;
      gap: 2px;
      margin-top: 2px;
      flex-wrap: wrap;
      justify-content: center;
  }
  
  .heatmap-day .habit-tag {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      display: inline-block;
  }

 .heatmap-day.level-0 .status-text {
     color: var(--text-muted);
 }

 .heatmap-day.level-1 .status-text {
     color: #f59e0b;
 }

 .heatmap-day.level-2 .status-text {
     color: #8b5cf6;
 }

 .heatmap-day.level-3 .status-text {
     color: #10b981;
     text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
 }

.heatmap-day:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.heatmap-day.level-0 {
    background: rgba(255, 255, 255, 0.05);
}

.heatmap-day.level-1 {
    background: rgba(245, 158, 11, 0.4);
    border-color: rgba(245, 158, 11, 0.6);
}

.heatmap-day.level-2 {
    background: rgba(139, 92, 246, 0.6);
    border-color: rgba(139, 92, 246, 0.8);
}

.heatmap-day.level-3 {
    background: rgba(16, 185, 129, 0.8);
    border-color: rgba(16, 185, 129, 1);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* Legend */
.calendar-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.level-0 {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-color.level-1 {
    background: #f59e0b;
}

.legend-color.level-2 {
    background: #8b5cf6;
}

.legend-color.level-3 {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

/* Empty State */
.habits-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Retro theme overrides */
[data-theme="retro"] .habit-item {
    border-radius: 0;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="retro"] .habit-item:hover {
    transform: translateX(2px);
}

[data-theme="retro"] .habit-progress-bar {
    border-radius: 0;
}

[data-theme="retro"] .habit-progress-fill {
    border-radius: 0;
}

[data-theme="retro"] .heatmap-day {
    border-radius: 0;
}

[data-theme="retro"] .heatmap-day.level-3 {
    box-shadow: 2px 2px 0 rgba(16, 185, 129, 0.5);
}

[data-theme="retro"] .legend-color.level-3 {
    box-shadow: 1px 1px 0 rgba(16, 185, 129, 0.5);
}

/* Leather theme overrides */
[data-theme="leather"] .habit-item {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="leather"] .habit-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="leather"] .heatmap-day {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="leather"] .heatmap-day.level-3 {
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="retro"] .habit-quick-btn {
    border-radius: 0;
}

[data-theme="retro"] .habit-quick-btn:hover {
    box-shadow: 2px 2px 0 var(--accent);
}