.route {
  /* display: inline-block;
  width: 25%;
  vertical-align: top;
  box-sizing: border-box; */
  flex: 1 1 calc(100% / var(--routes-per-row, 4));
  min-width: 300px;
  max-width: 100%;
  position: relative;
}

.with-map .route {
  flex: 1 1 calc(100% / var(--routes-per-row, 3));
  max-width: calc(100% / var(--routes-per-row, 3));
}

.route > div {
  padding: 1em;

  border-radius: 4px;
}

.route > div:hover {
  background: rgba(255, 255, 255, 0.6);

  cursor: move;
}

.hide-route {
  position: absolute;
  top: 5px;
  right: 5px;

  display: none;

  background: #cccccc;
  opacity: 0.5;

  border-radius: 4px;
  z-index: 9999;
}

.hide-route:hover {
  background: #cccccc;
  opacity: 1.0;
}

.route:hover .hide-route {
  display: block;
}

/* Font size classes */
.font-normal {
  --route-title-size: 2em;
  --route-time-size: 2em;
  --route-stop-size: 1.4em;
  --route-departure-size: 1.4em;
}

.font-large {
  --route-title-size: 2.4em;
  --route-time-size: 2.4em;
  --route-stop-size: 1.7em;
  --route-departure-size: 1.7em;
}

.font-large .route .realtime:before,
.font-large .route .realtime:after {
  width: 20px;
  height: 20px;
  margin-left: 5px;
}

.font-larger {
  --route-title-size: 3.5em;
  --route-time-size: 3.5em;
  --route-stop-size: 2em;
  --route-departure-size: 2em;
}

.font-larger .route .realtime:before,
.font-larger .route .realtime:after {
  width: 30px;
  height: 30px;
  margin-left: 5px;
}

.route h3 {
  font-size: var(--route-title-size, 2em);
  padding: 0.4em 0.35em 0.3em 0.35em;
  border-bottom: 1px solid rgba(255, 255, 255, .2);
}

.route .white h3 {
  border-bottom: 1px solid rgba(0, 0, 0, .2);
}

.route .img28 {
  max-height: 0.7em;
  vertical-align: baseline;
}

.route .img34 {
  max-height: 0.85em;
  margin-bottom: -2px;
}

.route i {
  font-size: 0.8em;
  font-style: normal;
}

.route small {
  color: inherit;

  font-family: Helvetica, Arial, serif;
  font-weight: lighter;
  font-size: 0.4em;
  line-height: 0.4em;

  display: block;

  margin-bottom: 0.4em;
  margin-top: 0.2em;
}

.route .direction {
  border-radius: 0.2em;
  margin-bottom: 1.3em;
}

.route .time h4 {
  font-size: var(--route-time-size, 1.4em);
  width: 33%;
  padding: 0.4em 0;
  text-align: center;
  display: inline-block;
  box-sizing: border-box;
}

.route .time h4 span {
  font-size: 1em;
}

.route .time h4 small {
  font-size: 0.4em;
  line-height: 1;
  display: block;
  margin-top: 0.2em;
}

.route .time h4:nth-child(n+4) {
  display: none;
}

.route .time h4:not(:first-of-type) {
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.route .white .time h4:not(:first-of-type) {
  border-left: 1px solid rgba(0, 0, 0, .2);
}

.route .departure {
  font-size: var(--route-departure-size, 1.4em);
  margin: 0.2em 0;
}

.route .stop_name {
  font-size: var(--route-stop-size, 1.4em);
  position: relative;
  background-repeat: no-repeat;
  background-position: 0 0.05em;
  background-size: auto 1em;
  padding-left: 1em;
  margin-bottom: 0.4em;
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.route .alert-icon {
  display: inline-block;
  font-size: 1.2em;
  cursor: help;
  position: absolute;
  right: .5em;
}

.route .alert-count {
  position: absolute;
  right: 1em;
  border-radius: 100%;
  background: #FFB957;
  color: #4A4351;
  border-radius: 100%;
  font-size: 1.5em;
  width: 30px;
  height: 30px;
  font-weight: bold;
  z-index: 1;
  border: 2px solid #3b3b3b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.route .white .alert-count {
  border: 1px solid rgba(0, 0, 0, 0.2);
}

@-webkit-keyframes realtimeAnim {
  0%   {opacity: 0.5;}
  25%  {opacity: 0.5;}
  50%  {opacity: 0.5;}
  75%  {opacity: 0.6;}
  100% {opacity: 1.0;}
}

@keyframes realtimeAnim {
  0%   {opacity: 0.5;}
  25%  {opacity: 0.5;}
  50%  {opacity: 0.5;}
  75%  {opacity: 0.6;}
  100% {opacity: 1.0;}
}

.route h4 {
  position: relative;
}

.route .realtime {
  width: 0.28em;
  height: 0.28em;

  position: absolute;
  margin-top: -4px;
}

.route .realtime:before,
.route .realtime:after {
  content: '';
  display: block;
  width: 9px;
  height: 9px;

  position: absolute;

  background-size: 100%;
}

.route .realtime:before {
  background-image: url('../../assets/images/real_time_wave_small-w@2x.png');

  -webkit-animation: realtimeAnim 1.4s linear 0s infinite alternate;
  animation: realtimeAnim 1.4s linear 0s infinite alternate;
}

.route .white .realtime:before {
  background-image: url('../../assets/images/real_time_wave_small@2x.png');
}

.route .realtime:after {
  background-image: url('../../assets/images/real_time_wave_big-w@2x.png');

  -webkit-animation: realtimeAnim 1.4s linear 0.3s infinite alternate;
  animation: realtimeAnim 1.4s linear 0.3s infinite alternate;
}

.route .white .realtime:after {
  background-image: url('../../assets/images/real_time_wave_big@2x.png');
}

.route-active{
  border: 6px solid #FFB657;
  padding: 2em 1em 0 1em;
  position: relative;
  border-radius: 4px;
  background-color: #ffe2be;
}

.route-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: repeating-linear-gradient(45deg, #FFB657, #FFB657 10px, #000000 10px, #000000 20px);
}

.route .inactive {
  display: block;

  background-image: url('../../assets/images/inactive-w@2x.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px auto;
}

.route .white .inactive {
  background-image: url('../../assets/images/inactive@2x.png');
}

@media (min-width: 2000px) {
  .route {
    width: 20%;
  }

  .with-map .route {
    width: 25%;
  }
}

@media (min-width: 2800px) {
  .route {
    width: 16.666%;
  }

  .with-map .route {
    width: 25%;
  }
}

/* Flip Card Styles */
.flip-card {
  perspective: 1000px;
  width: 100%;
  height: 100%;
  position: relative;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

/* Only apply animation to routes with alerts */
.flip-card.has-alerts .flip-card-inner {
  animation: flip 30s infinite;
}

.flip-card-front, .flip-card-back {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  padding: 15px;
  box-sizing: border-box;
  transition: height 0.4s ease-out;
  background-color: white;
}

.flip-card-back {
  transform: rotateY(180deg);
  align-items: flex-start;
  overflow-y: auto;
  height: 0;
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.has-severe-alert .flip-card-back{
  background-color: #ffe2be;
}

.flip-card.has-alerts .flip-card-inner[style*="rotateY(180deg)"] ~ .flip-card-back {
  height: 100%;
}

.flip-card.has-alerts .flip-card-inner[style*="rotateY(180deg)"] ~ .flip-card-front {
  height: 0;
  padding: 0;
}

/* .back-content {
  text-align: left;
  padding: 10px;
  max-height: 100%;
  overflow-y: auto;
} */
.back-content ul{
  position: relative;
  list-style-type: none;
}

.back-content h2.header {
  margin-bottom: 15px;
  color: #333;
  border-bottom: 3px solid black;
  padding-bottom: 10px;
}

.back-content li::marker{
  font-size: 2.5em;
  color: #3b3b3b;
}

.alert-title {
  font-weight: bold;
  margin-bottom: 1em;
  font-size: 1.6em;
  text-align: left;
  color: #3b3b3b !important;
}

.alert-description {
  color: #666;
  margin-bottom: 8px;
  font-size: 0.9em;
  line-height: 1.4;
}

.alert-time {
  color: #888;
  font-size: 0.8em;
  margin: 3px 0;
}
.alert-details{
  position: relative;
}

.alert-details hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 10px 0;
}
li.alert-details::after{
    content: "";
    width: 18px;
    height: 18px;
    position: absolute;
    left: 0;
    top: 0;
    background-color: white;
    border: 3px solid #3b3b3b;
    border-radius: 100%;
    top: 1.5em;
    transform: translateY(-50%);
    left: -2.5em;
}
li.alert-details.alert-severe,
li.alert-details.alert-warning,
li.alert-details.alert-info{
  background: none;
}
li.alert-details.alert-severe::after{
  background-color: #ff0f0f;
  border: 3px solid #760000;
  animation: severe-pulse 1.5s infinite;
  top: .5em;
}
li.alert-details.alert-warning::after{
  background-color: #FFB657;
  border: 3px solid #be6b00;
}
li.alert-details.alert-info::after{
  background-color: #696969;
  border: 3px solid #303030;
}

@keyframes flip {
  0% {
    transform: rotateY(0deg);
  }
  45% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(180deg);
  }
  95% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

@keyframes severe-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 15, 15, 0.7);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 10px 6px rgba(255, 15, 15, 0.3);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 15, 15, 0.1);
    transform: scale(1);
  }
}