/**
 * CHS TSA Wait Times Plugin
 * Public CSS Styles
 */

/* Brandon Grotesque font is loaded through Elementor */

/* Common styles */
.chs-tsa-widget {
  font-family: 'Brandon Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  color: #0F0F10;
  box-sizing: border-box;
}

.chs-tsa-widget * {
  box-sizing: border-box;
}

.chs-tsa-widget h2 {
  margin: 0 0 1rem;
  padding: 0;
  text-align: center;
  font-weight: bold;
  font-size: 1.5rem;
  line-height: 1.2;
}

.chs-tsa-widget a {
  text-decoration: none;
  color: inherit;
}

/* Wait time colors */
.chs-tsa-wait-time.chs-tsa-low {
  color: #008A60; /* Dark Green - under 20 minutes */
}

.chs-tsa-wait-time.chs-tsa-medium {
  color: #008A60; /* Dark Green - under 20 minutes */
}

.chs-tsa-wait-time.chs-tsa-high {
  color: #FF9955; /* Orange - 21-50 minutes (was Yellow #FFD100) */
}

.chs-tsa-wait-time.chs-tsa-very-high {
  color: #DF4661; /* Red - over 50 minutes (was Orange #FF9955) */
}

.chs-tsa-wait-time.chs-tsa-closed {
  color: #DF4661; /* Red - closed */
}

/* Home page widget */
.chs-tsa-home-widget {
  padding: 1.5rem;
  text-align: center;
  background-color: #ffffff;
  border-radius: 0.25rem;
  transition: transform 0.3s ease;
}

.chs-tsa-home-widget:hover {
  transform: translateY(-2px);
}

.chs-tsa-main-checkpoint,
.chs-tsa-precheck {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  text-align: center;
}

.chs-tsa-main-checkpoint {
  border-bottom: 1px solid #CDD3D9;
}

.chs-tsa-wait-time {
  font-size: 29px;
  font-weight: 500;
  line-height: 29px;
  margin-bottom: 0.5rem;
}

.chs-tsa-checkpoint-name {
  font-family: 'Brandon Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 28px;
  color: #0F0F10;
}

.chs-tsa-precheck-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
}

.chs-tsa-precheck-label {
  font-size: 29px;
  line-height: 29px;
  font-weight: 500;
  color: #0F0F10;
}

.chs-tsa-precheck .chs-tsa-wait-time {
  font-size: 29px;
  line-height: 29px;
  font-weight: 500;
  margin-bottom: 0;
}

.chs-tsa-precheck-label sup {
  font-size: 60%;
  vertical-align: super;
  line-height: 0;
}

/* Detailed widget */
.chs-tsa-detailed-widget {
  padding: 2rem;
  background-color: #ffffff;
  border-radius: 0.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chs-tsa-current-times {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  gap: 2rem;
}

.chs-tsa-checkpoint-card {
  flex: 1;
  min-width: 250px;
  padding: 1.5rem;
  background-color: #F8F8F8;
  border-radius: 0.25rem;
  text-align: center;
}

.chs-tsa-checkpoint-card h3 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: #0F0F10;
  font-weight: 500;
}

.chs-tsa-checkpoint-card .chs-tsa-wait-time {
  font-size: 3rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.chs-tsa-checkpoint-description {
  color: #75787B;
  font-size: 0.9rem;
}

.chs-tsa-hourly-forecast-title {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: #0F0F10;
  font-weight: 500;
}

.chs-tsa-forecast-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
  background-color: #f8f8f8;
  padding: 1rem;
  border-radius: 0.25rem;
}

.chs-tsa-forecast-date-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chs-tsa-forecast-message {
  font-size: 0.9rem;
  color: #555;
  margin: 0.5rem 0 0;
  font-style: italic;
}

.chs-tsa-date-picker {
  padding: 0.5rem;
  border: 1px solid #CDD3D9;
  border-radius: 0.25rem;
  background-color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
}

/* Bar Chart Style Hourly Forecast */
.chs-tsa-hourly-forecast-container {
  margin: 0 0 2rem;
}

.chs-tsa-hourly-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chs-tsa-hourly-bar-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.chs-tsa-hourly-bar-label {
  min-width: 4rem;
  text-align: right;
  padding-right: 1rem;
  font-weight: 500;
  color: #0F0F10;
}

.chs-tsa-hourly-bar-container {
  flex: 1;
  background-color: #F8F8F8;
  height: 1.5rem;
  border-radius: 0.25rem;
  position: relative;
  overflow: hidden;
}

.chs-tsa-hourly-bar {
  height: 100%;
  border-radius: 0.25rem;
}

.chs-tsa-hourly-bar.chs-tsa-low {
  background-color: #008A60; /* Dark Green - under 20 minutes */
}

.chs-tsa-hourly-bar.chs-tsa-medium {
  background-color: #008A60; /* Dark Green - under 20 minutes */
}

.chs-tsa-hourly-bar.chs-tsa-high {
  background-color: #FF9955; /* Orange - 21-50 minutes */
}

.chs-tsa-hourly-bar.chs-tsa-very-high {
  background-color: #DF4661; /* Red - over 50 minutes */
}

.chs-tsa-hourly-bar-value {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #ffffff; /* White text for better contrast */
  font-weight: 500;
  font-size: 0.9rem;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.5); /* Text shadow for better readability */
}

.chs-tsa-no-forecast {
  text-align: center;
  padding: 2rem;
  color: #75787B;
  font-style: italic;
  background-color: #F8F8F8;
  border-radius: 0.25rem;
}

.chs-tsa-future-forecast-placeholder {
  text-align: center;
  padding: 2rem;
  background-color: #F8F8F8;
  border-radius: 0.25rem;
  margin-bottom: 2rem;
}

.chs-tsa-future-forecast-message {
  color: #75787B;
  font-style: italic;
}

.chs-tsa-legend {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.chs-tsa-legend-item {
  display: flex;
  align-items: center;
  margin: 0 0.5rem;
}

.chs-tsa-legend-color {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.chs-tsa-legend-color.chs-tsa-low {
  background-color: #008A60;
}

.chs-tsa-legend-color.chs-tsa-high {
  background-color: #FF9955;
}

.chs-tsa-legend-color.chs-tsa-very-high {
  background-color: #DF4661;
}

.chs-tsa-updated-time {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: #75787B;
}

/* For text that needs to appear outside the bar */
.chs-tsa-bar-text-outside {
  color: #0F0F10 !important;
  text-shadow: none !important;
  left: 100% !important;
  padding-left: 8px !important;
  white-space: nowrap !important;
}

/* Improved mobile styles for hourly forecast bars */
@media screen and (max-width: 768px) {
  .chs-tsa-current-times {
    flex-direction: column;
    gap: 1rem;
  }
  
  .chs-tsa-hourly-forecast {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  /* Make the hourly bar row more compact */
  .chs-tsa-hourly-bar-row {
    margin-bottom: 12px;
  }
  
  /* Adjust the time label width */
  .chs-tsa-hourly-bar-label {
    min-width: 3rem;
    font-size: 0.9rem;
  }
  
  /* Ensure bar value is always visible */
  .chs-tsa-hourly-bar-value {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-weight: 500;
    font-size: 0.85rem;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
    z-index: 2;
    white-space: nowrap;
  }
  
  /* Style for very short bars to ensure text visibility */
  .chs-tsa-hourly-bar-container {
    position: relative;
    min-height: 1.8rem;
  }
  
  /* For extremely short bars, position the text outside */
  .chs-tsa-hourly-bar[style*="width: 5%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 6%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 7%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 8%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 9%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 10%"] + .chs-tsa-hourly-bar-value {
    color: #0F0F10;
    text-shadow: none;
    padding-left: 12px;
  }
  
  /* Add a bit more spacing for the legend items */
  .chs-tsa-legend {
    margin-top: 2rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .chs-tsa-legend-item {
    margin: 0;
    padding: 3px 0;
  }
}

/* Extra small devices */
@media screen and (max-width: 480px) {
  /* Make everything more compact */
  .chs-tsa-widget {
    padding: 1rem;
  }
  
  .chs-tsa-hourly-forecast-title {
    font-size: 1.25rem;
    margin: 1.5rem 0 1rem;
  }
  
  /* Ensure the bars have enough height for text */
  .chs-tsa-hourly-bar-container {
    min-height: 2rem;
  }
  
  /* Reduce time label width further */
  .chs-tsa-hourly-bar-label {
    min-width: 2.5rem;
    font-size: 0.85rem;
  }
  
  /* Make the forecast message text smaller */
  .chs-tsa-updated-time {
    font-size: 0.75rem;
    line-height: 1.4;
  }
}

/* Accessibility enhancements */
.chs-tsa-widget a:focus {
  outline: 2px solid #1B365D;
  outline-offset: 2px;
}

.chs-tsa-widget button:focus {
  outline: 2px solid #1B365D;
  outline-offset: 2px;
}

/* Screen reader text */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: #f1f1f1;
  border-radius: 3px;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
  clip: auto !important;
  clip-path: none;
  color: #0F0F10;
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* Mobile-specific fixes for bar text visibility */

/* Ensure all bar container heights are consistent */
.chs-tsa-hourly-bar-container {
  min-height: 2rem !important;
  position: relative;
  overflow: visible !important; /* Critical - allows text to display outside */
}

/* Special styling for very short bars - position ALL text outside by default on mobile */
@media screen and (max-width: 768px) {
  /* All bar text starts outside by default on mobile */
  .chs-tsa-hourly-bar-value {
    left: auto !important;
    right: -45px !important;
    color: #0F0F10 !important;
    text-shadow: none !important;
  }
  
  /* For very wide bars, position text inside the bar */
  .chs-tsa-hourly-bar[style*="width: 20%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 30%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 40%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 50%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 60%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 70%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 80%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 90%"] + .chs-tsa-hourly-bar-value,
  .chs-tsa-hourly-bar[style*="width: 100%"] + .chs-tsa-hourly-bar-value {
    right: auto !important;
    left: 10px !important;
    color: #ffffff !important;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7) !important;
  }
  
  /* Make sure rows have enough space */
  .chs-tsa-hourly-bar-row {
    position: relative;
    margin-bottom: 15px;
    height: 36px;
  }
}