/* Timeline and Project Selector Styling */

/* CSS Custom Properties for Layout */
:root {
  --footer-space: 180px;
  /* 100px base + 80px for container/timeline spacing */
  /* Reserved space for future footer - adjust this value when footer is added */
  --header-height: 220px;
  /* Approximate header height including logo and project selector */
}

/* Global Font Family */
* {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
}

/* Site Header Styles */
.site-header {
  padding: 4px 0;
  margin-bottom: 0px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.site-logo {
  height: 150px;
  width: auto;
  max-width: 600px;
  object-fit: contain;
}

.site-title {
  font-size: 24px;
  font-weight: 600;
  color: #2d3748;
  margin: 0;
  text-align: center;
  line-height: 1.2;
}

/* Responsive Header Styles */
@media (max-width: 1024px) {
  .site-header {
    padding: 3px 0;
    margin-bottom: 0px;
  }

  .header-container {
    padding: 0 15px;
    gap: 3px;
  }

  .site-logo {
    height: 120px;
    max-width: 500px;
  }

  .site-title {
    font-size: 20px;
  }

  .project-selector {
    margin: 3px 0;
  }

  .project-details {
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 2px 0;
    margin-bottom: 0px;
  }

  .header-container {
    padding: 0 10px;
    gap: 2px;
  }

  .site-logo {
    height: 110px;
    max-width: 450px;
  }

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

  .project-selector {
    margin: 2px 0;
  }

  .project-info {
    margin-top: 2px;
    overflow: hidden;
  }

  .project-details {
    gap: 3px;
    flex-wrap: nowrap;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    flex-direction: row !important;
    align-items: center !important;
  }

  .project-category,
  .project-status {
    font-size: 9px;
    padding: 1px 4px;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}



/* Project Selector Styles */
.project-selector {
  margin: 4px 0;
}



.project-selector label {
  font-weight: bold;
  color: #333;
  margin: 0;
}

.dropdown-container {
  position: relative;
  width: 100%;
}

.project-dropdown {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  margin-bottom: 0px;
}

.project-dropdown:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Project Category Grouping in Dropdown */
.project-dropdown optgroup {
  font-weight: bold;
  color: #2d3748;
  background-color: #f7fafc;
}

.project-dropdown option {
  padding: 8px 12px;
  color: #4a5568;
}

.project-dropdown option:disabled {
  color: #a0aec0;
  font-style: italic;
}

/* Project Information Display */
.project-info {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
}

.project-details {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

/* Project Category Badge */
.project-category {
  display: inline-block;
  padding: 4px 8px;
  background-color: #edf2f7;
  color: #2d3748;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #cbd5e0;
}

/* Project Status Indicators */
.project-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.project-status.completed {
  background-color: #c6f6d5;
  color: #22543d;
  border: 1px solid #9ae6b4;
}

.project-status.completed::before {
  content: '✓';
  font-weight: bold;
}

.project-status.in-progress {
  background-color: #fef5e7;
  color: #744210;
  border: 1px solid #f6e05e;
}

.project-status.in-progress::before {
  content: '⏳';
}

.project-status.not-started {
  background-color: #fed7d7;
  color: #742a2a;
  border: 1px solid #feb2b2;
}

.project-status.not-started::before {
  content: '○';
}

/* Loading States */
.loading {
  display: inline-block;
  margin-left: 10px;
  color: #666;
  font-style: italic;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

  0%,
  20% {
    content: '';
  }

  40% {
    content: '.';
  }

  60% {
    content: '..';
  }

  80%,
  100% {
    content: '...';
  }
}

/* Timeline Container */
.timeline-container {
  margin: 20px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: white;
  height: calc(100vh - var(--header-height) - var(--footer-space));
  /* Full viewport minus header and footer space */
  min-height: 300px;
  max-height: calc(100vh - 200px);
  /* Allow more height on larger screens */
}

/* Utility class to adjust footer space when footer is added */
.timeline-container.with-footer {
  --footer-space: 150px;
  /* Larger footer space when footer is present */
}

.timeline-container.no-footer {
  --footer-space: 20px;
  /* Minimal space when no footer */
}

/* Timeline Cards - Party-based styling */
.timeline-card {
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 4px 0;
}

/* Override vis-timeline item sizing */
.vis-item.vis-box {
  width: 200px !important;
  max-width: 200px !important;
  min-width: 200px !important;
  white-space: initial !important;
}

.vis-item .vis-item-content {
  width: 200px !important;
  max-width: 200px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  white-space: initial !important;
}





.timeline-card.party-podemos {
  border-left-color: #6f2c91;
}

.timeline-card.party-psoe {
  border-left-color: #e53e3e;
}

.timeline-card.party-pp {
  border-left-color: #3182ce;
}

.timeline-card.party-ciudadanos {
  border-left-color: #ff8c00;
}

.timeline-card.party-vox {
  border-left-color: #38a169;
}

.timeline-card.party-default {
  border-left-color: #718096;
}





/* Party Badges */
.party-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  color: white;
  margin-right: 8px;
}

.party-badge.podemos {
  background-color: #6f2c91;
}

.party-badge.psoe {
  background-color: #e53e3e;
}

.party-badge.pp {
  background-color: #3182ce;
}

.party-badge.ciudadanos {
  background-color: #ff8c00;
}

.party-badge.vox {
  background-color: #38a169;
}

.party-badge.default {
  background-color: #718096;
}



/* Media Cards - Enhanced styling for different media types */
.media-card {
  padding: 16px;
  border-radius: 8px;
  background-color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 8px 0;
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s ease;
}

.media-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-card.error {
  background-color: #fed7d7;
  border-color: #feb2b2;
  color: #c53030;
}

/* Media-specific card styling */
.media-card.media-twitter {
  border-left: 4px solid #1da1f2;
}

.media-card.media-news {
  border-left: 4px solid #2d3748;
}

.media-card.media-youtube {
  border-left: 4px solid #ff0000;
}

.media-card.media-facebook {
  border-left: 4px solid #1877f2;
}

.media-card.media-instagram {
  border-left: 4px solid #e4405f;
}

.media-card.media-unknown {
  border-left: 4px solid #718096;
}

/* Media Card Header */
.media-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.media-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.media-type {
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-date {
  font-size: 11px;
  color: #718096;
  font-weight: 500;
}

/* Media Type Icons */
.media-icon {
  display: inline-block;
  font-size: 18px;
  margin-right: 8px;
  vertical-align: middle;
}

.media-icon-twitter {
  color: #1da1f2;
}

.media-icon-news {
  color: #2d3748;
}

.media-icon-youtube {
  color: #ff0000;
}

.media-icon-facebook {
  color: #1877f2;
}

.media-icon-instagram {
  color: #e4405f;
}

.media-icon-unknown {
  color: #718096;
}

/* Media Card Content */
.media-content {
  margin-bottom: 12px;
}

.media-headline {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px 0;
  color: #2d3748;
}

.media-headline a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.media-headline a:hover {
  color: #3182ce;
  text-decoration: underline;
}

.media-description {
  font-size: 13px;
  line-height: 1.5;
  color: #4a5568;
  margin: 0;
}

/* Media Card Footer */
.media-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  margin-top: 12px;
}

.media-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #3182ce;
  text-decoration: none;
  transition: color 0.2s ease;
}

.media-link:hover {
  color: #2c5aa0;
  text-decoration: underline;
}

/* Party Badges - Enhanced */
.party-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.party-badge.party-podemos {
  background-color: #6f2c91;
}

.party-badge.party-psoe {
  background-color: #e53e3e;
}

.party-badge.party-pp {
  background-color: #3182ce;
}

.party-badge.party-ciudadanos {
  background-color: #ff8c00;
}

.party-badge.party-vox {
  background-color: #38a169;
}

.party-badge.party-equo {
  background-color: #22c55e;
}

.party-badge.party-podemos-equo {
  background: linear-gradient(45deg, #6f2c91, #22c55e);
}

/* Default party styling for unknown parties */
.party-badge:not([class*="party-"]) {
  background-color: #718096;
}

/* Card Content */
.card-headline {
  font-weight: bold;
  margin-bottom: 8px;
  color: #2d3748;
  line-height: 1.3;
}

.card-description {
  color: #4a5568;
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #718096;
  margin-top: 8px;
}

.card-date {
  font-weight: 500;
}

.card-link {
  color: #3182ce;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

/* Error States */
.error-message {
  padding: 15px;
  background-color: #fed7d7;
  border: 1px solid #feb2b2;
  border-radius: 6px;
  color: #c53030;
  margin: 20px 0;
}

/* Enhanced User Feedback System */
.user-feedback {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 10px 0;
  font-size: 14px;
  font-weight: 500;
  display: none;
  position: relative;
  animation: slideIn 0.3s ease-out;
}

.user-feedback.success {
  background-color: #c6f6d5;
  border: 1px solid #9ae6b4;
  color: #22543d;
}

.user-feedback.error {
  background-color: #fed7d7;
  border: 1px solid #feb2b2;
  color: #c53030;
}

.user-feedback.warning {
  background-color: #fef5e7;
  border: 1px solid #f6e05e;
  color: #744210;
}

.user-feedback.info {
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Global Loading Indicator */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 8px 16px;
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.global-loading .loading-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-loading .loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.global-loading .loading-message {
  font-size: 14px;
  font-weight: 500;
}

.no-data-message {
  padding: 20px;
  text-align: center;
  color: #718096;
  font-style: italic;
}

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

/* Timeline Loading States */
.timeline-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  color: #718096;
}

.timeline-loading .loading {
  font-size: 16px;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid #3182ce;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: #4a5568;
  font-size: 14px;
  font-weight: 500;
}

/* Enhanced Error States */
.error-state {
  background-color: #fed7d7;
  border: 1px solid #feb2b2;
  border-radius: 8px;
  padding: 20px;
}

.error-state h3 {
  color: #c53030;
  margin-bottom: 10px;
}

.error-details {
  color: #742a2a;
  font-size: 14px;
  margin: 10px 0;
}

.retry-button {
  background-color: #3182ce;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
}

.retry-button:hover {
  background-color: #2c5aa0;
}

.empty-state {
  color: #a0aec0;
  font-style: italic;
  font-size: 14px;
}

/* Project Selector Disabled State */
.project-dropdown:disabled {
  background-color: #f7fafc;
  color: #a0aec0;
  cursor: not-allowed;
}

/* Enhanced No Data Message */
.no-data-message h3 {
  color: #2d3748;
  margin-bottom: 10px;
}

.no-data-message p {
  margin: 5px 0;
  color: #4a5568;
}

/* Incomplete Event Styling */
.timeline-card.incomplete-event {
  border-left: 4px solid #f6ad55;
  background-color: #fffaf0;
  border-color: #fbd38d;
}

.timeline-card.incomplete-event .card-headline.incomplete {
  color: #c05621;
  font-style: italic;
}

.timeline-card.incomplete-event .card-description.incomplete {
  color: #9c4221;
  font-style: italic;
}

.timeline-card.incomplete-event .card-footer.incomplete {
  border-top: 1px solid #fbd38d;
  background-color: #fef5e7;
  padding: 8px 12px;
  margin: 12px -16px -16px -16px;
  border-radius: 0 0 8px 8px;
}

.incomplete-notice {
  font-size: 12px;
  color: #c05621;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.incomplete-notice::before {
  content: '⚠️';
  font-size: 14px;
}

/* Timeline Group Styling */
.timeline-group-label {
  font-weight: 600;
  font-size: 14px;
  color: #2d3748;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: #f7fafc;
}

.timeline-group-podemos .timeline-group-label {
  background-color: #f3e8ff;
  color: #6f2c91;
}

.timeline-group-psoe .timeline-group-label {
  background-color: #fed7d7;
  color: #e53e3e;
}

.timeline-group-pp .timeline-group-label {
  background-color: #dbeafe;
  color: #3182ce;
}

.timeline-group-ciudadanos .timeline-group-label {
  background-color: #fef5e7;
  color: #ff8c00;
}

.timeline-group-vox .timeline-group-label {
  background-color: #c6f6d5;
  color: #38a169;
}

.timeline-group-equo .timeline-group-label {
  background-color: #dcfce7;
  color: #22c55e;
}

.timeline-group-podemos-equo .timeline-group-label {
  background: linear-gradient(45deg, #f3e8ff, #dcfce7);
  color: #553c9a;
}

.timeline-group-other .timeline-group-label {
  background-color: #f1f5f9;
  color: #718096;
}

/* vis-timeline custom styling */
.vis-timeline {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
}

.vis-item {
  border-radius: 6px;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

.vis-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.vis-item.vis-selected {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  border: 2px solid #3b82f6;
}

/* Party-specific timeline item styling */
.vis-item.party-podemos {
  background-color: #f3e8ff;
  border-left: 4px solid #6f2c91;
}

.vis-item.party-psoe {
  background-color: #fed7d7;
  border-left: 4px solid #e53e3e;
}

.vis-item.party-pp {
  background-color: #dbeafe;
  border-left: 4px solid #3182ce;
}

.vis-item.party-ciudadanos {
  background-color: #fef5e7;
  border-left: 4px solid #ff8c00;
}

.vis-item.party-vox {
  background-color: #c6f6d5;
  border-left: 4px solid #38a169;
}

.vis-item.party-equo {
  background-color: #dcfce7;
  border-left: 4px solid #22c55e;
}

.vis-item.party-podemos-equo {
  background: linear-gradient(135deg, #f3e8ff, #dcfce7);
  border-left: 4px solid #553c9a;
}

.vis-item.party-other {
  background-color: #f1f5f9;
  border-left: 4px solid #718096;
}

/* Timeline axis styling */
.vis-time-axis {
  border-top: 1px solid #e2e8f0;
}

.vis-text {
  color: #4a5568;
  font-size: 12px;
}

.vis-text.vis-major {
  font-weight: 600;
  color: #2d3748;
}

/* Timeline background */
.vis-panel.vis-background {
  background-color: #fafafa;
}

.vis-panel.vis-center {
  background-color: white;
}

/* Group labels */
.vis-labelset .vis-label {
  background-color: #f8fafc;
  border-right: 1px solid #e2e8f0;
  color: #2d3748;
  font-weight: 500;
}



/* Timeline Performance Warning */
.timeline-performance-warning {
  margin: 10px 0;
  background-color: #fef3cd;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
}

.warning-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #92400e;
}

.warning-icon {
  font-size: 16px;
}

.warning-text {
  flex: 1;
}

.warning-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #92400e;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.warning-close:hover {
  background-color: #fbbf24;
  color: #ffffff;
}



/* Enhanced Timeline Interactions */
.vis-timeline {
  position: relative;
  overflow: hidden;
}

/* Smooth zoom indicator */
.timeline-zoom-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.timeline-zoom-indicator.visible {
  opacity: 1;
}

/* Timeline loading overlay for large datasets */
.timeline-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.timeline-loading-overlay .loading-content {
  text-align: center;
  color: #4a5568;
}

.timeline-loading-overlay .loading-spinner {
  width: 24px;
  height: 24px;
  margin: 0 auto 8px;
}

/* Enhanced keyboard navigation indicators */
.timeline-container:focus-within {
  outline: 2px solid #3182ce;
  outline-offset: 2px;
}

.timeline-keyboard-help {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1000;
  max-width: 200px;
}

.timeline-container:focus .timeline-keyboard-help {
  opacity: 1;
}

.keyboard-shortcut {
  display: block;
  margin: 2px 0;
}

.keyboard-shortcut .key {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 1px 4px;
  border-radius: 2px;
  font-family: monospace;
  font-size: 10px;
}

/* Touch gesture indicators for mobile */
.timeline-touch-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

.timeline-touch-indicator.visible {
  opacity: 1;
}

/* Enhanced Responsive Design and Mobile Support */

/* Tablet and small desktop (768px - 1024px) */
@media (max-width: 1024px) {
  :root {
    --header-height: 200px;
    /* Smaller header on tablets */
    --footer-space: 150px;
    /* 80px base + 70px for container/timeline spacing */
  }

  .container {
    padding: 15px;
  }

  .timeline-container {
    height: calc(100vh - var(--header-height) - var(--footer-space));
    min-height: 280px;
  }

  .timeline-navigation-indicator {
    padding: 10px;
  }

  .nav-controls {
    gap: 4px;
  }

  .nav-btn {
    min-width: 26px;
    height: 26px;
    font-size: 13px;
  }
}

/* Mobile landscape and small tablets (1024px and below) */
@media (max-width: 1024px) {
  :root {
    --header-height: 180px;
    /* Mobile header */
    --footer-space: 120px;
    /* 60px base + 40px for container/timeline spacing + 20px extra mobile padding */
  }

  .container {
    padding: 10px;
  }

  .project-selector {
    margin: 10px 0;
    padding: 12px;
  }



  .project-dropdown {
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 12px;
  }

  .project-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .timeline-container {
    margin: 10px 0;
    height: calc(100vh - var(--header-height) - var(--footer-space));
    min-height: 280px;
    max-height: calc(100vh - 120px);
    border-radius: 6px;
  }

  /* Enhanced timeline navigation for mobile */
  .timeline-navigation-indicator {
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background-color: #f8fafc;
    border-radius: 6px;
  }

  .nav-track {
    height: 10px;
    border-radius: 5px;
  }

  .nav-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-btn {
    min-width: 32px;
    height: 32px;
    font-size: 14px;
    touch-action: manipulation;
    /* Improve touch responsiveness */
  }

  .nav-position-text {
    font-size: 13px;
    min-width: 36px;
  }

  /* Mobile-optimized timeline cards */
  .timeline-card {
    padding: 12px;
    margin: 6px 0;
    border-radius: 6px;
  }

  .card-headline {
    font-size: 12px;
    line-height: 1.3;
  }

  .card-description {
    font-size: 11px;
    line-height: 1.4;
  }

  /* Mobile vis-item font reductions */
  .vis-item {
    font-size: 9px !important;
  }

  .vis-item div {
    font-size: 9px !important;
  }

  .vis-item strong {
    font-size: 10px !important;
  }

  .vis-item em {
    font-size: 8px !important;
  }

  .vis-item a {
    font-size: inherit !important;
  }



  .card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 10px;
  }

  .party-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* Mobile-optimized media cards */
  .media-card {
    padding: 12px;
    margin: 8px 0;
  }

  .media-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .media-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .vis-item h4 {
    font-size: 12px !important;
    line-height: 1.3;
  }

  .vis-item p {
    font-size: 11px !important;
  }

  /* Mobile feedback and loading */
  .user-feedback {
    padding: 10px 12px;
    font-size: 13px;
    margin: 8px 0;
  }

  .global-loading {
    padding: 10px 16px;
  }

  .global-loading .loading-message {
    font-size: 13px;
  }

  /* Mobile error states */
  .error-message {
    padding: 12px;
    font-size: 14px;
    margin: 15px 0;
  }

  .no-data-message {
    padding: 16px;
    font-size: 14px;
  }

  /* Mobile timeline interactions */
  .timeline-keyboard-help {
    display: none;
    /* Hide keyboard help on mobile */
  }

  .timeline-touch-indicator {
    font-size: 11px;
    padding: 6px 10px;
  }

  .timeline-zoom-indicator {
    top: 8px;
    right: 8px;
    font-size: 10px;
    padding: 3px 6px;
  }
}

/* Mobile portrait and small screens (768px and below) */
@media (max-width: 768px) {
  :root {
    --header-height: 160px;
    /* Compact mobile header */
    --footer-space: 112px;
    /* 50px base + 32px for container/timeline spacing + 30px extra mobile padding */
  }

  .container {
    padding: 8px;
  }

  .project-selector {
    margin: 8px 0;
    padding: 10px;
  }

  .project-dropdown {
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 10px;
  }

  .project-category,
  .project-status {
    font-size: 10px;
    padding: 2px 6px;
  }

  .timeline-container {
    margin: 8px 0;
    height: calc(100vh - var(--header-height) - var(--footer-space));
    min-height: 250px;
    max-height: calc(100vh - 100px);
  }

  /* Compact navigation for small screens */
  .timeline-navigation-indicator {
    padding: 8px;
  }

  .nav-controls {
    gap: 6px;
  }

  .nav-btn {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
    padding: 2px 4px;
  }

  .nav-position-text {
    font-size: 11px;
    min-width: 30px;
  }

  /* Compact timeline cards */
  .timeline-card {
    padding: 10px;
    margin: 4px 0;
  }

  .card-headline {
    font-size: 11px;
  }

  .card-description {
    font-size: 10px;
  }

  /* Very small mobile vis-item font reductions */
  .vis-item {
    font-size: 8px !important;
  }

  .vis-item div {
    font-size: 8px !important;
  }

  .vis-item strong {
    font-size: 9px !important;
  }

  .vis-item em {
    font-size: 7px !important;
  }

  .vis-item a {
    font-size: inherit !important;
  }

  .party-badge {
    font-size: 8px;
    padding: 2px 4px;
  }

  /* Compact media cards */
  .media-card {
    padding: 10px;
    margin: 6px 0;
  }

  .vis-item h4 {
    font-size: 11px !important;
  }

  .vis-item p {
    font-size: 10px !important;
  }

  .vis-item span {
    font-size: 8px !important;
  }

  /* Compact feedback */
  .user-feedback {
    padding: 8px 10px;
    font-size: 12px;
    margin: 6px 0;
  }

  .error-message {
    padding: 10px;
    font-size: 13px;
    margin: 12px 0;
  }

  .no-data-message {
    padding: 12px;
    font-size: 13px;
  }

  /* Compact loading states */
  .loading-container {
    padding: 16px;
    gap: 10px;
  }

  .loading-text {
    font-size: 13px;
  }

  .loading-spinner {
    width: 24px;
    height: 24px;
  }
}

/* Large mobile landscape (up to 667px height) */
@media (max-height: 667px) and (orientation: landscape) {
  :root {
    --header-height: 120px;
    /* Compact landscape header */
    --footer-space: 92px;
    /* 40px base + 32px for container/timeline spacing + 20px extra mobile padding */
  }

  .timeline-container {
    height: calc(100vh - var(--header-height) - var(--footer-space));
    min-height: 200px;
    max-height: calc(100vh - 80px);
  }

  .project-selector {
    margin: 6px 0;
    padding: 8px;
  }

  .timeline-navigation-indicator {
    padding: 6px;
  }

  .nav-btn {
    min-width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* Touch-specific enhancements */
@media (pointer: coarse) {

  /* Larger touch targets */
  .project-dropdown {
    min-height: 44px;
    /* iOS recommended minimum */
  }

  .nav-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .card-link,
  .media-link {
    padding: 8px 4px;
    margin: -8px -4px;
  }

  .retry-button {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Improve touch scrolling */
  .timeline-container {
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent text selection on touch */
  .nav-btn,
  .party-badge,
  .timeline-navigation-indicator {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
  .loading-spinner {
    border-width: 1px;
  }

  .timeline-card,
  .media-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  }
}

/* Dark mode support (if system preference is dark) */
@media (prefers-color-scheme: dark) {
  .container {
    background-color: #1a202c;
    color: #e2e8f0;
  }

  .project-selector {
    background-color: #2d3748;
    border-color: #4a5568;
  }

  .project-dropdown {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .timeline-container {
    background-color: #2d3748;
    border-color: #4a5568;
  }

  .timeline-card,
  .media-card {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .no-data-message {
    color: #a0aec0;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

  .timeline-card,
  .media-card,
  .nav-btn,
  .user-feedback {
    transition: none;
  }

  .loading-spinner {
    animation: none;
  }

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

  .loading-spinner {
    animation: spin 2s linear infinite;
  }

  @keyframes slideIn {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }
}

/* Print styles */
@media print {

  .global-loading,
  .timeline-navigation-indicator,
  .nav-controls,
  .timeline-keyboard-help,
  .timeline-touch-indicator,
  .timeline-zoom-indicator {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .timeline-container {
    border: 1px solid #000;
    min-height: auto;
  }

  .timeline-card,
  .media-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Target emojis in vis-timeline items directly - desktop size */
.vis-item a[href*="http"] {
  font-size: 24px !important;
  line-height: 1 !important;
  text-decoration: none !important;
  display: inline-block !important;
  padding: 4px !important;
}

/* Alternative approach - target all links in timeline cards that contain common emojis */
.vis-item a[href]:contains("📰"),
.vis-item a[href]:contains("🐦"),
.vis-item a[href]:contains("📱"),
.vis-item a[href]:contains("💬"),
.vis-item a[href]:contains("📺"),
.vis-item a[href]:contains("🌐") {
  font-size: 24px !important;
  line-height: 1 !important;
  text-decoration: none !important;
  display: inline-block !important;
  padding: 4px !important;
}

/* Mobile emoji overrides - larger than desktop but still compact */
@media (max-width: 1024px) {
  .vis-item a[href*="http"] {
    font-size: 14px !important;
  }

  .vis-item a[href]:contains("📰"),
  .vis-item a[href]:contains("🐦"),
  .vis-item a[href]:contains("📱"),
  .vis-item a[href]:contains("💬"),
  .vis-item a[href]:contains("📺"),
  .vis-item a[href]:contains("🌐") {
    font-size: 14px !important;
  }
}

@media (max-width: 768px) {
  .vis-item a[href*="http"] {
    font-size: 14px !important;
  }

  .vis-item a[href]:contains("📰"),
  .vis-item a[href]:contains("🐦"),
  .vis-item a[href]:contains("📱"),
  .vis-item a[href]:contains("💬"),
  .vis-item a[href]:contains("📺"),
  .vis-item a[href]:contains("🌐") {
    font-size: 14px !important;
  }
}