/* ChicagoBus.org Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: #333;
}

a {
  color: #00509e;
  text-decoration: underline;
}

a:hover {
  color: #003d7a;
}

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

/* Header */
#main-header {
  background: #003366;
  color: white;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

#main-header .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
}

.site-branding {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#main-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: bold;
  line-height: 1;
}

#main-header h1 a {
  color: white;
  text-decoration: none;
}

.tagline {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  text-transform: uppercase;
  line-height: 1;
}

#main-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

#main-header nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

#main-header nav a:hover,
#main-header nav a.active {
  background: #0055aa;
  border-radius: 3px;
}

#main-header nav a.external-link {
  background: #2d6541;
  border-bottom: 3px solid #d97330;
  border-radius: 3px;
  color: white;
}

#main-header nav a.external-link:hover {
  background: #3a7d52;
  border-bottom-color: #e88740;
}

@media (max-width: 768px) {
  #main-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-branding {
    gap: 0.25rem;
  }

  #main-header h1 {
    font-size: 1.5rem;
  }

  .tagline {
    font-size: 0.6rem;
  }

  #main-header nav {
    width: 100%;
  }

  #main-header nav a {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
  }
}

/* Home page header */
#home_header {
  background: #fff5f5;
  padding: 1rem;
  margin-bottom: 2rem;
  border-left: 4px solid #dc3545;
  border-right: 4px solid #dc3545;
  text-align: center;
}

#home_header b {
  color: #dc3545;
}

/* Bus grid */
.bus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.bus-card {
  border: 1px solid #ddd;
  border-radius: 5px;
  overflow: hidden;
  transition: box-shadow 0.3s;
}

.bus-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bus-card a {
  text-decoration: none;
  color: inherit;
}

.bus-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.bus-card .photo-placeholder {
  width: 100%;
  height: 200px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-style: italic;
}

.bus-info {
  padding: 1rem;
}

.bus-info h3 {
  color: #003366;
  margin-bottom: 0.5rem;
}

.bus-info .series {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.bus-card .garages {
  margin-top: 1rem;
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bus-card .garages .label {
  color: #666;
  font-weight: normal;
}

.bus-card .garages .garage-badge {
  display: inline-block;
}

.bus-card .garages .garage-badge a {
  display: inline-block;
  background: #003366;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  text-decoration: none;
  font-weight: bold;
}

.bus-card .garages .garage-badge a:hover {
  background: #0055aa;
}

/* View Complete Roster Link */
#current_roster footer {
  margin-top: 2rem;
  text-align: center;
}

.view-complete-roster {
  display: inline-block;
  background: #003366;
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.3s;
}

.view-complete-roster:hover {
  background: #0055aa;
  color: white;
  text-decoration: none;
}

/* Home Page Layout */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  margin-top: 2rem;
}

.home-main {
  min-width: 0; /* Prevents grid blowout */
}

.home-sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.home-sidebar section {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.home-sidebar h3 {
  color: #003366;
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  border-bottom: 2px solid #003366;
  padding-bottom: 0.5rem;
}

.home-sidebar .feed-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.home-sidebar .feed-list li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
}

.home-sidebar .feed-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.home-sidebar .feed-list a {
  display: block;
  color: #00509e;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
}

.home-sidebar .feed-list a:hover {
  color: #003d7a;
  text-decoration: underline;
}

.home-sidebar .feed-date {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.25rem;
}

.home-sidebar .feed-loading {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 1rem 0;
}

.home-sidebar footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ddd;
}

.home-sidebar footer a {
  font-size: 0.85rem;
}

#recent_forum_topics footer a {
  color: #2d6541;
  font-weight: 600;
}

#recent_forum_topics footer a:hover {
  color: #3a7d52;
}

#recent_forum_topics footer a::after {
  content: ' ↗';
  font-size: 0.9em;
}

/* Responsive home layout */
@media (max-width: 1024px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .home-sidebar {
    position: static;
    max-height: none;
  }
}

/* Bus roster table */
.bus-roster {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.bus-roster th,
.bus-roster td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.bus-roster th {
  background: #003366;
  color: white;
}

.bus-roster tr:hover {
  background: #f5f5f5;
}

.bus-roster a {
  color: #003366;
  text-decoration: none;
}

.bus-roster a:hover {
  text-decoration: underline;
}

.status {
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

.status-Active {
  background: #28a745;
  color: white;
}

.status-Retired {
  background: #6c757d;
  color: white;
}

.status-On\ Order {
  background: #ffc107;
  color: #333;
}

/* Bus details */
.bus-details {
  margin: 2rem 0;
}

.featured-photo {
  margin: 2rem 0;
}

.featured-photo img {
  max-width: 100%;
  height: auto;
}

.specifications dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.specifications dt {
  font-weight: bold;
}

.specifications dd {
  margin: 0;
}

.garage-list {
  list-style: none;
  margin: 1rem 0;
}

.garage-list li {
  margin: 0.5rem 0;
}

.garage-list a {
  color: #003366;
  text-decoration: none;
}

.garage-list a:hover {
  text-decoration: underline;
}

/* Photo gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.gallery-item img {
  width: 100%;
  height: auto;
}

.gallery-item .credit {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
}

/* Garages */
.garages-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.garage-item {
  border: 1px solid #ddd;
  padding: 1.5rem;
  border-radius: 5px;
}

.garage-item h2 a {
  color: #003366;
  text-decoration: none;
}

.garage-item h2 a:hover {
  text-decoration: underline;
}

/* News */
.news-list {
  margin: 2rem 0;
}

.news-item {
  border-bottom: 1px solid #ddd;
  padding: 1.5rem 0;
}

.news-item h2 a {
  color: #003366;
  text-decoration: none;
}

.news-item h2 a:hover {
  text-decoration: underline;
}

.news-item .meta {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.news-article {
  max-width: 800px;
  margin: 2rem 0;
}

.news-article .meta {
  color: #666;
  margin-bottom: 2rem;
}

.news-article .content {
  line-height: 1.8;
}

.news-article .content img {
  max-width: 100%;
  height: auto;
}

/* Footer */
#main-footer {
  background: #f5f5f5;
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid #ddd;
  text-align: center;
}

/* Login */
.login-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.login-container h1 {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.form-group textarea {
  resize: vertical;
}

button,
.btn {
  padding: 0.75rem 1.5rem;
  background: #003366;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover,
.btn:hover {
  background: #0055aa;
}

.error {
  background: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 3px;
}

/* Bus roster thumbnails */
.roster-thumbnail {
  width: 60px;
  height: 45px;
  object-fit: cover;
  border-radius: 3px;
}

.bus-roster tbody td {
  vertical-align: middle;
}

.bus-roster tbody tr {
  height: 60px;
}

.text-right {
  text-align: right !important;
}

.bus-link {
  color: #003366;
  text-decoration: none;
}

.bus-link:hover {
  color: #0055aa;
  text-decoration: underline;
}

.clickable-rows tbody tr {
  cursor: pointer;
}

.clickable-rows tbody tr:hover {
  background: #f0f8ff;
}

.bus-status-section {
  margin: 1rem 0 3rem 0;
}

.bus-status-section h2 {
  color: #003366;
  margin-bottom: 1rem;
}

/* Bus show page layout */
.bus-title-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.title-thumbnail {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid #003366;
}

.bus-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (max-width: 968px) {
  .bus-layout {
    grid-template-columns: 1fr;
  }
}

.bus-sidebar {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  height: fit-content;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.specs-table tbody tr:nth-child(even) {
  background: #ffffff;
}

.specs-table tbody tr:nth-child(odd) {
  background: #f0f0f0;
}

.specs-table th {
  text-align: left;
  padding: 0.75rem;
  font-weight: bold;
  width: 40%;
  border-bottom: 1px solid #ddd;
}

.specs-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #ddd;
}

.assigned-garages {
  margin-bottom: 2rem;
}

.assigned-garages h3 {
  margin-bottom: 1rem;
  color: #003366;
}

.cta-service-info {
  margin-bottom: 2rem;
}

.cta-service-info h3 {
  margin-bottom: 1rem;
  color: #003366;
}

.specifications h3 {
  margin-bottom: 1rem;
  color: #003366;
}

.garage-badge-inline {
  display: inline-block;
  margin-right: 0.25rem;
}

.garage-badge-inline a {
  display: inline-block;
  background: #003366;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9em;
}

.garage-badge-inline a:hover {
  background: #0055aa;
}

.garage-badges {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.garage-badge-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.garage-badge-link:hover {
  border-color: #003366;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.garage-code {
  background: #003366;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-weight: bold;
  font-size: 1.1em;
  min-width: 50px;
  text-align: center;
}

.garage-name {
  color: #333;
  font-weight: 500;
}

.bus-main-content {
  background: white;
}

.notes-content {
  line-height: 1.8;
}

.notes-content p {
  margin-bottom: 16px;
}

.notes-content ul,
.notes-content ol {
  margin: 16px 0;
  padding-left: 2rem;
}

.notes-content h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: #003366;
}

.photo-gallery {
  margin-top: 3rem;
}

.photo-info {
  padding: 0.5rem 0;
}

.photo-info .caption {
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 0.25rem;
}

/* Garages layout */
.garages-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  margin: 2rem 0;
  align-items: start;
}

@media (max-width: 968px) {
  .garages-layout {
    grid-template-columns: 1fr;
  }
}

.garages-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.garage-card {
  display: block;
  padding: 1rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.garage-card:hover {
  border-color: #003366;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateX(4px);
}

.garage-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.garage-card .garage-code {
  background: #003366;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-weight: bold;
  font-size: 1.1em;
  min-width: 50px;
  text-align: center;
}

.garage-card .garage-name {
  color: #003366;
  font-weight: bold;
  font-size: 1.1em;
}

.garage-location {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
}

.garage-map-container {
  position: sticky;
  top: 20px;
  height: 100%;
}

#garage_map {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Garage show page */
.garage-header {
  margin-bottom: 2rem;
}

.garage-title {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.garage-title-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  justify-content: center;
}

.garage-title-text h1 {
  margin: 0;
  line-height: 1.2;
}

.garage-location {
  font-size: 1rem;
  color: #666;
  margin: 0;
  line-height: 1.3;
}

.garage-code-large {
  background: #003366;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1.5em;
  min-width: 60px;
  text-align: center;
  flex-shrink: 0;
}

.routes-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.routes-table thead th {
  background: #003366;
  color: white;
  padding: 0.75rem;
  text-align: left;
}

.routes-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid #ddd;
}

.routes-table tbody tr:hover {
  background: #f5f5f5;
}

.route-number {
  display: inline-block;
  background: #003366;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-weight: bold;
  min-width: 50px;
  text-align: center;
}

.garage-code-small {
  display: inline-block;
  background: #003366;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-weight: bold;
  text-decoration: none;
}

.garage-code-small:hover {
  background: #0055aa;
}

.garage-routes,
.garage-buses {
  margin: 3rem 0;
}

.garage-routes h2,
.garage-buses h2 {
  color: #003366;
  margin-bottom: 1.5rem;
}

/* Operations page layout */
.operations-layout {
  max-width: 900px;
}

.operations-layout #operations_header h2 {
  display: none;
}

.operations-layout p {
  margin-bottom: 16px;
}

.operations-layout aside,
.operations-layout figure.sidebar_media {
  float: right;
  margin: 0 0 1.5rem 2rem;
  max-width: 350px;
  clear: right;
}

.operations-layout aside audio {
  width: 100%;
  margin-bottom: 0.5rem;
}

.operations-layout figure img,
.operations-layout a.zsingle img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.operations-layout figcaption,
.operations-layout aside p {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.operations-layout section {
  margin-bottom: 2rem;
}

.operations-layout::after {
  content: '';
  display: table;
  clear: both;
}

/* History page layout */
.history-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  position: relative;
}

.history-layout section,
.history-layout .primary_content {
  grid-column: 1;
}

.history-layout p {
  margin-bottom: 16px;
}

.history-layout figure,
.history-layout a.zsingle {
  margin: 0 1.5rem 1rem 0;
  max-width: 250px;
}

.history-layout figure.left {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

.history-layout figure.right {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.history-layout figure img,
.history-layout a.zsingle img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 0;
}

.history-layout figcaption {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  margin-top: -16px;
  line-height: 1.3;
}

.history-layout aside,
.history-layout table {
  grid-column: 2;
  grid-row: 1 / span 10;
  position: sticky;
  top: 20px;
  align-self: start;
}

.history-layout aside h3:first-of-type {
  /* margin-top: 0; */
}

.history-layout aside h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.history-layout table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: white;
  border: 1px solid #ddd;
}

.history-layout table caption {
  font-weight: bold;
  font-size: 1.1rem;
  padding: 0.75rem;
  background: #f5f5f5;
  border-bottom: 2px solid #003366;
}

.history-layout table th,
.history-layout table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.history-layout table thead th {
  background: #003366;
  color: white;
  font-weight: bold;
}

.history-layout table tbody tr:hover {
  background: #f9f9f9;
}

.history-layout h2,
.history-layout h3,
.history-layout h4 {
  clear: both;
}

@media (max-width: 968px) {
  .operations-layout aside,
  .operations-layout figure.sidebar_media {
    float: none;
    margin: 1rem 0;
    max-width: 100%;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-layout aside,
  .history-layout table {
    grid-column: 1;
    grid-row: auto;
    position: static;
    margin-bottom: 2rem;
  }

  .history-layout figure,
  .history-layout figure.left,
  .history-layout figure.right,
  .history-layout a.zsingle {
    float: none;
    margin: 1rem 0;
    max-width: 100%;
  }
}
