/* css/style.css */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #cbd5e1;
  --accent-color: #4f46e5;
  --accent-hover: #4338ca;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --tooltip-bg: #0f172a;
  --tooltip-text: #f8fafc;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 1rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
  color: #334155;
}

header p {
  color: var(--text-secondary);
}

.form-section,
.members-section,
.duration-section,
.share-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  border: 1px solid var(--border-color);
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: #334155;
}

#member-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#member-form input[type="text"],
#member-form select,
#member-form input[type="time"] {
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: #f8fafc;
}

.weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.weekdays label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  background: #f1f5f9;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.weekdays input[type="checkbox"] {
  margin-right: 0.25rem;
}

.time-range label {
  display: block;
  margin-top: 0.5rem;
  font-weight: 500;
}

.time-range input[type="time"] {
  width: fit-content;
  margin: 0 0.25rem;
}

button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s, transform 0.1s;
  font-size: 0.95rem;
}

button:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

#members-list {
  list-style: none;
}

#members-list li {
  padding: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbff;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

#members-list li:last-child {
  border-bottom: none;
}

#members-list li div:first-child {
  flex: 1;
}

.duration-section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.duration-section label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#heatmap-container {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  grid-template-rows: auto repeat(7, 36px);
  gap: 1px;
  background-color: #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
  padding: 6px;
  margin-top: 0.5rem;
  background: #f1f5f9;
}

#heatmap-container .day-header {
  background: var(--bg-secondary);
  font-weight: 700;
  font-size: 0.7rem;
  text-align: center;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #475569;
}

#heatmap-container .hour-cell {
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

/* 🔥 Brighter, more visible heatmap colors */
.hour-cell.count-0 { background-color: #e2e8f0; }
.hour-cell.count-1 { background-color: #bfdbfe; }
.hour-cell.count-2 { background-color: #93c5fd; }
.hour-cell.count-3 { background-color: #60a5fa; }
.hour-cell.count-4 { background-color: #3b82f6; }
.hour-cell.count-5 { background-color: #1d4ed8; }

.tooltip {
  position: absolute;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2);
  max-width: 320px;
  line-height: 1.4;
}

.tooltip.hidden {
  display: none;
}

.link-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#share-link {
  flex: 1;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #f8fafc;
}

#copy-link.success {
  background-color: var(--success-color);
}

/* Edit mode button */
#save-edit-btn {
  display: none;
  background-color: #059669;
  margin-top: 0.5rem;
}

#save-edit-btn.shown {
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .form-section,
  .members-section,
  .duration-section,
  .share-section {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  #heatmap-container {
    grid-template-columns: repeat(24, 30px);
    grid-template-rows: auto repeat(7, 40px);
  }

  .tooltip {
    font-size: 0.8rem;
  }

  button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}