/* ===== Tracking Screen ===== */
.tracking-screen {
  padding: 0 1rem 1rem 1rem;
}

/* Header with title and close button */
.tracking-header {
  position: relative;
  margin-bottom: 1.5rem;
  padding-top: 1.25rem;
}

.tracking-header h2 {
  margin-top: 0;
  margin-bottom: 0;
}

.close-x-button {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 1.5rem;
  color: #7f8c8d;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
  z-index: 1600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.close-x-button:hover {
  background-color: #ffffff;
  color: #2c3e50;
}

/* Week controls: scrollable chips + access button */
.week-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.week-chips-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.625rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-width: 0;
}

.week-chips-scroll::-webkit-scrollbar {
  display: none;
}

.access-icon-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.access-icon-btn:hover {
  border-color: #a5b4fc;
  color: #4f46e5;
  background: #f5f3ff;
}

/* Week chips */
.week-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}

.week-chip {
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: transparent;
  color: #374151;
  border: 1px solid #d1d5db;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.week-chip:hover {
  border-color: #9ca3af;
}

.week-chip.selected {
  background: white;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-color: #e5e7eb;
}

.week-chip.current:not(.selected) {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 2px rgba(165, 180, 252, 0.3);
}

/* User tracking cards */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.user-tracking-card {
  background: white;
  border-radius: 1.5rem;
  padding: 1.125rem 1.5rem;
  border: none;
}

.user-tracking-card.current-user {
  border: 1px solid #a5b4fc;
  background: white;
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #d1d5db;
}

.user-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.user-total {
  font-size: 1.5rem;
  font-weight: 700;
}

.percent-green {
  color: #10b981;
}

.percent-blue {
  color: #3b82f6;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.project-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
}

.project-name {
  color: #374151;
}

.project-score {
  font-weight: 500;
}

/* Access link section */
.access-link-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.access-link-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  color: #374151;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.access-link-button:hover {
  border-color: #a5b4fc;
  color: #4f46e5;
}

/* ===== Tracking Access Screen ===== */
.tracking-access-screen {
  padding: 0 1rem 1rem 1rem;
}

.screen-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.access-section {
  background: white;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
}

.access-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.section-hint {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.create-invite-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(to right, #4f46e5, #7c3aed);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.create-invite-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.create-invite-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.create-invite-btn.copied {
  background: #10b981;
}

.empty-list {
  color: #9ca3af;
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

.access-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.access-item:last-child {
  border-bottom: none;
}

.access-item-name {
  font-weight: 500;
}

.remove-btn {
  padding: 0.5rem;
  color: #9ca3af;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.remove-btn:hover {
  color: #ef4444;
  background: #fef2f2;
}

/* ===== Tracking Invite Screen ===== */
.tracking-invite-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.invite-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  max-width: 24rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.invite-card.error-card {
  border: 1px solid #fecaca;
}

.invite-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.invite-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.invite-info {
  margin-bottom: 1.5rem;
}

.user-name-large {
  font-size: 1.125rem;
  font-weight: 600;
  color: #4f46e5;
  margin-top: 0.5rem;
}

.accept-btn {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(to right, #4f46e5, #7c3aed);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1rem;
}

.accept-btn:disabled {
  opacity: 0.7;
}

.cancel-link {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.875rem;
}

.cancel-link:hover {
  color: #374151;
}

.error-text {
  color: #ef4444;
  margin-bottom: 1rem;
}

.error-inline {
  color: #ef4444;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.secondary-btn {
  padding: 0.75rem 1.5rem;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

/* Loading */
.loading-container {
  text-align: center;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 4px solid #e0e7ff;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.error-message {
  text-align: center;
  padding: 2rem;
  color: #ef4444;
}
