/* Setup Screen Styles */
.setup-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  z-index: 1000;
  overflow-y: auto;
}

.setup-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.setup-header {
  text-align: center;
  margin-bottom: 40px;
}

.setup-header h1 {
  color: #FC4C02;
  margin-bottom: 10px;
  font-size: 2.5em;
}

.setup-header p {
  color: #666;
  font-size: 1.2em;
  margin: 0;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.step-number {
  background: #FC4C02;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2em;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content h3 {
  margin: 0 0 10px 0;
  color: #333;
}

.step-content p {
  margin: 0 0 15px 0;
  color: #666;
  line-height: 1.5;
}

.step-content ul {
  margin: 15px 0;
  padding-left: 20px;
}

.step-content li {
  margin-bottom: 8px;
  color: #666;
  line-height: 1.5;
}

.step-content code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.9em;
}

.credential-form {
  margin-top: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #FC4C02;
}

.form-group small {
  color: #888;
  font-size: 0.9em;
  margin-top: 5px;
  display: block;
}

.setup-btn {
  background: #FC4C02;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
}

.setup-btn:hover {
  background: #e63900;
}

.setup-footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  background: #e8f4fd;
  border-radius: 8px;
  border-left: 4px solid #2196F3;
}

.setup-footer p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

/* Demo mode styles */
.demo-divider {
  text-align: center;
  margin: 30px 0;
  position: relative;
}

.demo-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #ddd;
}

.demo-divider span {
  position: relative;
  background: #f5f5f5;
  padding: 0 20px;
  color: #888;
  font-weight: 600;
  font-size: 14px;
}

.demo-section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  text-align: center;
}

.demo-section h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.5em;
}

.demo-section p {
  margin: 0 0 20px 0;
  color: #666;
  line-height: 1.5;
}

.demo-btn {
  background: #2196F3;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
  max-width: 300px;
}

.demo-btn:hover {
  background: #1976D2;
}

/* Data mode toggle in controls panel */
.data-mode-container {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
}

.data-mode-label {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin-bottom: 8px;
}

.data-mode-toggle {
  display: flex;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  border: 1px solid #ddd;
}

.mode-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #666;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background-color: #2196F3;
  color: white;
  box-shadow: 0 2px 4px rgba(33, 150, 243, 0.2);
}

.mode-btn:hover:not(.active) {
  background-color: #f0f0f0;
  color: #333;
}

.data-mode-info {
  margin-top: 8px;
  font-size: 12px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 4px;
  font-weight: 500;
}

.data-mode-info.demo-mode {
  background: #e3f2fd;
  color: #1976D2;
}

.data-mode-info.user-mode {
  background: #fff3e0;
  color: #f57c00;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  background: white;
  padding: 40px 60px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #FC4C02;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* General styling */
html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 20px;
  color: #333;
  min-height: 100vh;
}

/* Main container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Main content layout */
.content-layout {
  display: flex;
  gap: 30px;
  min-height: calc(100vh - 40px);
  position: relative;
}

.activities-section {
  flex: 1;
  max-width: 800px;
}

/* Controls sidebar */
.controls-sidebar {
  width: 280px;
  flex-shrink: 0;
}

/* Summary section within controls panel */
.summary-section-container {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

/* Best Efforts section */
.best-efforts-container {
  margin-top: 20px;
  padding-top: 20px;
  padding-bottom: 40px;
  border-top: 1px solid #e0e0e0;
}

.best-efforts-container.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.best-efforts-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.best-efforts-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.info-icon-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-icon {
  color: #888;
  cursor: help;
  transition: color 0.2s ease;
}

.info-icon:hover {
  color: #fc4c02;
}

.info-tooltip {
  position: fixed;
  top: auto;
  left: auto;
  background: #333;
  color: white;
  padding: 16px 20px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  width: 400px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: normal;
  word-wrap: break-word;
}

.info-icon-container:hover .info-tooltip {
  opacity: 1;
  visibility: visible;
}

.best-efforts-content {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.best-effort-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

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

.best-effort-item:hover {
  background-color: #f8f9fa;
}

.best-effort-item.clickable:hover {
  background-color: #e8f4fd;
  border-left: 3px solid #fc4c02;
}

.best-effort-distance {
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

.best-effort-time {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

.best-effort-time.no-effort {
  color: #999;
  font-style: italic;
}

/* Enhanced scrollbar for controls panel - always reserve space */
.controls-panel {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent; /* Invisible but space reserved */
}

.controls-panel::-webkit-scrollbar {
  width: 8px; /* Always reserve 8px width */
  background: transparent;
}

.controls-panel::-webkit-scrollbar-track {
  background: transparent;
}

.controls-panel::-webkit-scrollbar-thumb {
  background-color: transparent; /* Invisible by default */
  border-radius: 4px;
  border: none;
}

/* Show scrollbar on hover */
.controls-panel:hover {
  scrollbar-color: #c1c1c1 transparent;
}

.controls-panel:hover::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
}

.controls-panel:hover::-webkit-scrollbar-thumb:hover {
  background-color: #a8a8a8;
}

/* Activity highlighting */
.activity-title.highlighted {
  color: #fc4c02 !important;
  transition: color 0.3s ease;
}

.activity-card.highlighted {
  box-shadow: 0 4px 16px rgba(252, 76, 2, 0.3) !important;
  transition: box-shadow 0.3s ease;
}

.best-effort-distance.highlighted {
  color: #fc4c02 !important;
  font-weight: 600;
  transition: color 0.3s ease;
}

.controls-panel {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
  position: -webkit-sticky;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  z-index: 10;
  bottom: 40px;
}

.summary-section-container.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.summary-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 16px 0;
}

.selected-activities {
  background-color: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.selected-activities-label {
  font-weight: 500;
  color: #666;
  margin-bottom: 6px;
}

.selected-activities-list {
  color: #333;
  font-weight: 500;
}

.summary-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-dropdown {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.summary-dropdown.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f8f9fa;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-weight: 500;
  color: #333;
}

.dropdown-header:hover:not(.disabled) {
  background-color: #e9ecef;
}

.dropdown-arrow {
  transition: transform 0.2s ease;
}

.summary-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-content {
  display: none;
  padding: 16px;
  background-color: white;
}

.summary-dropdown.open .dropdown-content {
  display: block;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.stat-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.stat-value {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

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

.controls-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.settings-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.settings-btn:hover {
  opacity: 1;
  background-color: rgba(0,0,0,0.05);
}

.control-group {
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin-bottom: 8px;
  display: block;
}

/* Unit toggle buttons */
.unit-toggle {
  display: flex;
  background-color: #f5f5f5;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.unit-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #666;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-btn.active {
  background-color: #fc4c02;
  color: white;
  box-shadow: 0 2px 4px rgba(252, 76, 2, 0.2);
}

.unit-btn:hover:not(.active) {
  background-color: #e0e0e0;
  color: #333;
}

/* Activity filters */
.activity-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.select-all-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.select-all-btn:hover {
  border-color: #fc4c02;
  color: #fc4c02;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #fc4c02;
  cursor: pointer;
}

.filter-checkbox label {
  font-size: 14px;
  color: #555;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.filter-checkbox:hover label {
  color: #333;
}

/* Activity count badge */
.activity-count {
  font-size: 12px;
  color: #888;
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

/* Header section */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px 10px;
  background-color: #f5f5f5;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 5;
  border-radius: 8px;
  margin-top: -10px;
}

.header h2 {
  margin: 0;
  color: #333;
  font-size: 28px;
  font-weight: 600;
}

/* Export button */
.export-btn {
  background-color: #fc4c02;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s ease;
  box-shadow: 0 2px 4px rgba(252, 76, 2, 0.2);
}

.export-btn:hover {
  background-color: #e63d00;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(252, 76, 2, 0.3);
}

/* Activity cards */
.activity-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #e0e0e0;
}

.activity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Activity card header */
.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.activity-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
  flex: 1;
  padding-right: 16px;
}

.activity-date {
  font-size: 14px;
  color: #666;
  font-weight: 500;
  white-space: nowrap;
}

/* Activity data grid */
.activity-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.data-item {
  display: flex;
  flex-direction: column;
}

.data-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.data-value {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* Activity type badge */
.activity-type {
  display: inline-block;
  background-color: #fc4c02;
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* No activities message */
.no-activities {
  text-align: center;
  color: #666;
  font-size: 16px;
  padding: 40px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Scroll to top button */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: max(20px, calc((100vw - 1200px) / 2 - 70px)); /* Responsive positioning */
  width: 50px;
  height: 50px;
  background-color: #fc4c02;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(252, 76, 2, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-top:hover {
  background-color: #e63d00;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(252, 76, 2, 0.4);
}

.scroll-to-top svg {
  transition: transform 0.2s ease;
}

.scroll-to-top:hover svg {
  transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 1300px) {
  .scroll-to-top {
    right: 20px; /* Start overlaying when container gets close to viewport edges */
  }
}

@media (max-width: 900px) {
  .content-layout {
    flex-direction: column;
    gap: 20px;
  }

  .controls-sidebar {
    width: 100%;
    order: -1;
  }

  .controls-panel {
    position: static;
  }

  .activities-section {
    max-width: none;
  }

  .scroll-to-top {
    right: 20px; /* Overlay on smaller screens */
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  .header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .activity-header {
    flex-direction: column;
    gap: 8px;
  }

  .activity-title {
    padding-right: 0;
  }

  .activity-data {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .controls-panel {
    padding: 16px;
  }

  .controls-title {
    font-size: 16px;
  }
}