﻿html {
  font-size: 16px;
  height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: #f5f6f8;
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-container {
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  padding: 24px 16px;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  margin-bottom: 8px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.sidebar-header {
  margin-bottom: 24px;
}

.topbar {
  background-color: #ffffff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
}

.content-wrapper {
  background-color: #f5f6f8;
}

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.filing-footer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: inherit;
  flex-wrap: wrap;
  text-align: center;
}

.filing-footer__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: inherit;
  text-decoration: none;
  flex-wrap: wrap;
}

.filing-footer__link:hover,
.filing-footer__link:focus {
  text-decoration: underline;
}

.filing-footer__icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.filing-footer__text {
  white-space: normal;
  line-height: 1.35;
}

.public-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.public-layout__content {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.public-layout__footer {
  flex-shrink: 0;
}

.card {
  border-radius: 12px;
}

.btn-primary {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

.btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

.form-floating > label {
  color: #6c757d;
}

.form-control:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.navbar-nav .nav-link {
  padding: 0.5rem 1rem;
}

.traffic-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.traffic-title {
  margin: 0;
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
}

.traffic-subtitle {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.traffic-filter {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.traffic-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 160px;
}

.traffic-filter-field label {
  font-size: 0.85rem;
  color: #4b5563;
}

.traffic-filter-field input[type="date"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #ffffff;
}

.traffic-filter-field input[type="date"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.traffic-filter-submit {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  background-color: #2563eb;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.traffic-filter-submit:hover,
.traffic-filter-submit:focus {
  background-color: #1d4ed8;
}

.traffic-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.traffic-card {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 260px;
}

.traffic-card-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.traffic-card-header p {
  margin: 0.3rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.traffic-chart {
  position: relative;
  min-height: 240px;
  flex: 1;
}

.traffic-card-total {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.traffic-total {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.traffic-total-value {
  font-size: clamp(2rem, 4vw + 1rem, 3rem);
  font-weight: 700;
  color: #2563eb;
}

.traffic-total-caption {
  color: #6b7280;
  font-size: 0.95rem;
}

@media (max-width: 992px) {
  .app-container {
    position: relative;
  }

  .traffic-dashboard {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    max-width: 80vw;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.2);
    z-index: 1040;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1035;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .topbar {
    justify-content: flex-end;
  }
}

@media (max-width: 576px) {
  html {
    font-size: clamp(13px, 3vw + 6px, 14px);
  }

  body {
    font-size: 0.9rem;
  }

  h1,
  h2,
  h3 {
    font-size: 1.3rem;
  }

  h4,
  h5,
  h6 {
    font-size: 1.05rem;
  }

  .orders-table thead,
  .resources-table thead {
    display: none;
  }

  .orders-table tbody tr,
  .resources-table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    overflow: hidden;
  }

  .orders-table tbody tr td,
  .resources-table tbody tr td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .orders-table tbody tr td:last-child,
  .resources-table tbody tr td:last-child {
    border-bottom: none;
  }

  .orders-table tbody tr td::before,
  .resources-table tbody tr td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
    margin-right: 1rem;
    flex: 0 0 40%;
    text-align: left;
  }

  .order-filter-actions,
  .resource-filter-actions {
    flex-wrap: wrap;
  }

  .order-filter-actions .btn,
  .resource-filter-actions .btn {
    flex: 1 1 48%;
  }
}
