/* Index Page Specific Styles */

.header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 40px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(211, 47, 47, 0.3);
  text-align: center;
  animation: slideDown 0.5s ease-out;
  position: relative;
}

.add-session-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9em;
  transition: all 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.add-session-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: clamp(1.8em, 5vw, 3em);
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: clamp(0.9em, 2.5vw, 1.2em);
  opacity: 0.9;
}

.controls {
  background: var(--surface-2);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
  animation: fadeIn 0.5s ease-out 0.1s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-box {
  flex: 1;
  min-width: 200px;
  padding: 12px;
  background: var(--surface-0);
  border: 2px solid var(--surface-4);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 1em;
  transition: border-color 0.3s;
}

.search-box:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 20px;
  background: var(--surface-4);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.filter-btn:hover {
  background: #4d4d4d;
  transform: translateY(-2px);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
}

.reset-btn {
  padding: 10px 20px;
  background: var(--warning);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.reset-btn:hover {
  background: #f57c00;
  transform: translateY(-2px);
}

.select-filter {
  padding: 10px 15px;
  background: var(--surface-0);
  border: 2px solid var(--surface-4);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 1em;
  min-width: 180px;
  transition: border-color 0.3s;
}

.select-filter:focus {
  outline: none;
  border-color: var(--primary);
}

.date-filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.date-input {
  padding: 10px;
  background: var(--surface-0);
  border: 2px solid var(--surface-4);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 1em;
  min-width: 150px;
  transition: border-color 0.3s;
}

.date-input:focus {
  outline: none;
  border-color: var(--primary);
}

.date-range {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.date-range span {
  color: #999;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--surface-2);
  padding: 20px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
  text-align: center;
  animation: fadeIn 0.5s ease-out 0.2s both;
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-label {
  color: #999;
  font-size: 0.9em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.filtered-stat-value {
  font-size: 2em;
  font-weight: bold;
  color: var(--accent);
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
  gap: 20px;
}

.session-card {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 25px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
  border-top: 4px solid var(--primary);
  animation: cardSlideIn 0.5s ease-out both;
  position: relative;
  overflow: hidden;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.session-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(244, 67, 54, 0.3);
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
  padding-right: 100px;
}

.driver-name {
  font-size: 1.5em;
  font-weight: bold;
  color: #fff;
}

.session-date {
  color: #999;
  font-size: 0.9em;
}

.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  margin-top: 5px;
}

.trend-improving {
  background: rgba(76, 175, 80, 0.2);
  color: var(--secondary);
}

.trend-declining {
  background: rgba(244, 67, 54, 0.2);
  color: var(--error);
}

.trend-stable {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.badge-container {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
  transition: transform 0.2s;
}

.badge:hover {
  transform: scale(1.05);
}

.pb-badge {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: var(--surface-0);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
  animation: pulse 2s infinite;
}

.track-pb-badge {
  background: linear-gradient(135deg, #9c27b0, #ba68c8);
  color: white;
  box-shadow: 0 2px 8px rgba(156, 39, 176, 0.4);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.session-stats {
  margin: 15px 0;
}

.session-stat {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-4);
}

.stat-name {
  color: #999;
}

.stat-val {
  font-weight: bold;
  color: var(--accent);
}

.view-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 15px;
}

.view-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.02);
}

.loading {
  text-align: center;
  padding: 50px;
  font-size: 1.5em;
  color: #999;
}

.no-results {
  text-align: center;
  padding: 50px;
  color: #999;
  animation: fadeIn 0.5s ease-out;
}

.error {
  background: linear-gradient(135deg, var(--error), #d32f2f);
  color: white;
  padding: 20px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
  text-align: center;
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-4) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 25px;
  border-top: 4px solid var(--surface-4);
}

.skeleton-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
}

.skeleton-date {
  height: 16px;
  width: 25%;
}

.skeleton-stat {
  height: 20px;
  margin: 12px 0;
}

.skeleton-button {
  height: 44px;
  margin-top: 15px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 40px;
  padding: 25px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
  min-width: 100px;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.pagination-btn:disabled {
  background: var(--surface-4);
  color: #666;
  cursor: not-allowed;
  transform: none;
}

.pagination-info {
  color: var(--text-primary);
  font-weight: 600;
  padding: 0 15px;
  min-width: 200px;
  text-align: center;
}

.info-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(244, 67, 54, 0.4);
  transition: all 0.3s;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(244, 67, 54, 0.6);
}

.legend-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.3s;
  backdrop-filter: blur(4px);
}

.legend-overlay.active {
  display: flex;
}

.legend-content {
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-0) 100%);
  border-radius: 16px;
  padding: 40px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--surface-4);
}

.legend-title {
  font-size: 1.8em;
  font-weight: bold;
  color: #fff;
}

.close-legend {
  background: var(--surface-4);
  border: none;
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2em;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-legend:hover {
  background: var(--primary);
  transform: rotate(90deg);
}

.legend-section {
  margin-bottom: 30px;
}

.legend-section-title {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 15px;
  background: #252525;
  border-radius: 8px;
  margin-bottom: 12px;
  transition: transform 0.2s;
}

.legend-item:hover {
  transform: translateX(5px);
  background: var(--surface-2);
}

.legend-icon {
  flex-shrink: 0;
}

.legend-text {
  flex: 1;
}

.legend-text-title {
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}

.legend-text-desc {
  color: #999;
  font-size: 0.9em;
  line-height: 1.5;
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  .header {
    padding: 20px;
  }
  .add-session-btn {
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    font-size: 0.8em;
  }
  .controls {
    padding: 15px;
    gap: 10px;
  }
  .search-box,
  .select-filter,
  .date-input {
    width: 100%;
    min-width: auto;
  }
  .filter-btn,
  .reset-btn {
    flex: 1;
    min-width: calc(50% - 5px);
  }
  .sessions-grid {
    grid-template-columns: 1fr;
  }
  .stats-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  .stat-card {
    padding: 15px;
  }
  .filtered-stat-value {
    font-size: 1.5em;
  }
}

@media (max-width: 480px) {
  .stats-summary {
    grid-template-columns: 1fr;
  }
  .session-header {
    flex-direction: column;
    align-items: flex-start;
    padding-right: 0;
  }
  .badge-container {
    position: static;
    flex-direction: row;
    margin-top: 10px;
  }
  .info-button {
    width: 48px;
    height: 48px;
    bottom: 20px;
    right: 20px;
  }
  .legend-content {
    padding: 25px;
    margin: 10px;
  }
  .legend-title {
    font-size: 1.4em;
  }
  .pagination {
    padding: 15px;
    gap: 8px;
  }
  .pagination-btn {
    padding: 10px 16px;
    min-width: 80px;
    font-size: 0.85em;
  }
  .pagination-info {
    width: 100%;
    padding: 10px 0;
    font-size: 0.9em;
    min-width: auto;
  }
}
