/* ==========================================================================
   NRS LOGISTICS SINGAPORE - CORPORATE DESIGN SYSTEM & STYLESHEET
   Accurately reflecting the visual identity of https://sg.nrsgr.com/
   Primary Colors: #002F68 (Navy), #003B83 (Royal Blue), #E79900 (Corporate Orange)
   ========================================================================== */

:root {
  --nrs-navy: #002F68;
  --nrs-navy-dark: #001F45;
  --nrs-blue: #003B83;
  --nrs-blue-light: #2355A5;
  --nrs-blue-subtle: #EBF3FC;
  --nrs-blue-hover: #013586;
  --nrs-orange: #E79900;
  --nrs-orange-dark: #DD8607;
  --nrs-orange-subtle: #FFF8EB;
  --nrs-orange-border: #F6C878;
  --nrs-silver: #989898;
  --nrs-silver-dark: #777777;

  --bg-page: #F4F6F9;
  --bg-card: #FFFFFF;
  --border-color: #DCE4EC;
  --border-light: #EDF2F7;

  --text-main: #1A2533;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --text-white: #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(0, 47, 104, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 47, 104, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 47, 104, 0.12);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 9999px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--nrs-blue);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover {
  color: var(--nrs-orange);
}

/* ==========================================================================
   Header Components (Accurate to sg.nrsgr.com)
   ========================================================================== */

#header {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  background: var(--nrs-navy);
  color: #ffffff;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-top a {
  color: #ffffff;
  font-size: 12px;
  padding: 0 12px;
  opacity: 0.85;
}

.header-top a:hover {
  opacity: 1;
  color: #ffd27a;
}

.header-top .top-links span:not(:last-child)::after {
  content: "|";
  color: rgba(255, 255, 255, 0.3);
  margin-left: 12px;
}

.header-main {
  background: #ffffff;
  padding: 14px 0;
}

.header-main .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-img {
  height: 48px;
  width: auto;
  max-width: 380px;
  object-fit: contain;
  display: block;
}

.system-badge {
  background: var(--nrs-blue-subtle);
  border-left: 3px solid var(--nrs-blue);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--nrs-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-contact {
  display: flex;
  align-items: center;
  gap: 20px;
}

.contact-tel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}

.contact-tel svg {
  color: var(--nrs-orange);
}

.contact-tel span {
  font-size: 14px;
  font-weight: 700;
  color: var(--nrs-navy);
  letter-spacing: 0.5px;
}

/* Corporate Navigation Bar */
.corporate-nav {
  background: linear-gradient(to bottom, #ffffff 0%, #f1f4f8 100%);
  border-top: 1px solid #e2e8f0;
  border-bottom: 2px solid var(--nrs-navy);
}

.corporate-nav .container {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
}

.nav-links {
  display: flex;
  list-style: none;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  border-right: 1px solid #e2e8f0;
  position: relative;
  transition: all 0.2s ease;
}

.nav-item a:hover {
  background: #ffffff;
  color: var(--nrs-blue);
}

.nav-item.active a {
  background: var(--nrs-blue);
  color: #ffffff;
}

.nav-item.active a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--nrs-orange);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  flex: 1;
  padding: 0px 0 48px;
}

/* Topic Path / Breadcrumb */
.breadcrumb-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb-bar .container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-bar a {
  color: var(--nrs-blue);
  font-weight: 500;
}

.breadcrumb-bar a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #cbd5e1;
}

/* ==========================================================================
   Buttons (Matching sg.nrsgr.com styles)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
  text-align: center;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-orange {
  background: var(--nrs-orange);
  background: linear-gradient(to bottom, #e79900 0%, #dd8607 100%);
  color: #ffffff !important;
  border-color: #c77800;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-orange:hover {
  background: linear-gradient(to bottom, #f3a408 0%, #cf7b02 100%);
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(231, 153, 0, 0.35);
}

.btn-blue {
  background: var(--nrs-blue-light);
  background: linear-gradient(to bottom, #2355a5 0%, #013586 100%);
  color: #ffffff !important;
  border-color: #012b6f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-blue:hover {
  background: linear-gradient(to bottom, #2b63be 0%, #002b6d 100%);
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(1, 53, 134, 0.35);
}

.btn-silver {
  background: #f1f4f8;
  color: var(--text-secondary) !important;
  border-color: var(--border-color);
  height: 36px;
}

.btn-silver:hover {
  background: #e2e8f0;
  color: var(--text-main) !important;
}

.btn-outline-blue {
  background: transparent;
  color: var(--nrs-blue) !important;
  border-color: var(--nrs-blue);
}

.btn-outline-blue:hover {
  background: var(--nrs-blue-subtle);
}

/* ==========================================================================
   KPI Summary Statistics Cards
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--nrs-blue);
}

.stat-card.accent-orange::before {
  background: var(--nrs-orange);
}

.stat-card.accent-navy::before {
  background: var(--nrs-navy);
}

.stat-card.accent-teal::before {
  background: #0284c7;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--nrs-navy);
  line-height: 1.1;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==========================================================================
   Filter & Query Control Panel
   ========================================================================== */

.filter-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.filter-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--nrs-navy);
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-title-icon {
  color: var(--nrs-orange);
}

.filter-body {
  padding: 20px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 16px;
  justify-content: space-between;
  width: 100%;
}

.filter-grid--main {
  flex: 1;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  width: 100%;
}

.filter-toggle-container {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  flex-shrink: 0;
  white-space: nowrap;
}

.advanced-filters-panel {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.advanced-filters-panel.open {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

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

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group:not(.filter-group-submit) {
flex: 1;
  min-width: 150px;
}

.filter-group-submit {
  flex: 0 0 auto;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--nrs-blue);
  box-shadow: 0 0 0 3px rgba(0, 59, 131, 0.12);
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 12px;
}

.filter-buttons-left,
.filter-buttons-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Table & Presentation Elements
   ========================================================================== */

.table-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.table-toolbar {
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.table-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.table-info strong {
  color: var(--nrs-navy);
}

.view-switcher {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f8fafc;
}

.view-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-btn.active {
  background: var(--nrs-blue);
  color: #ffffff;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.corporate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.corporate-table thead {
  background: var(--nrs-navy);
  color: #ffffff;
}

.corporate-table thead th {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.corporate-table thead th:last-child {
  border-right: none;
}

.corporate-table thead th a {
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.corporate-table thead th a:hover {
  color: #ffd27a;
}

.corporate-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s ease;
}

.corporate-table tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

.corporate-table tbody tr:hover {
  background-color: #f0f6ff;
}

.corporate-table td {
  padding: 14px 16px;
  vertical-align: middle;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-carrier {
  background: #e8f1fc;
  color: #003b83;
  border: 1px solid #bfdbfe;
  font-weight: 600;
  font-size: 12px;
}

.badge-port {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
}

.badge-size-20 {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 700;
}

.badge-size-40 {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  font-weight: 700;
}

.badge-rate-count {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 11px;
}

.badge-empty {
  background: #f3f4f6;
  color: #9ca3af;
  border: 1px dashed #d1d5db;
}

/* Route Display */
.route-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.route-arrow {
  color: var(--nrs-orange);
  font-weight: 700;
}

/* Price / Currency */
.price-tag {
  font-family: var(--font-family);
  font-weight: 700;
  color: var(--nrs-navy);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.price-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

/* Expandable Rate Card Subtable */
.rates-details-row {
  display: none;
  background-color: #f8fafc !important;
}

.rates-details-row.open {
  display: table-row;
}

.rates-expanded-container {
  padding: 16px 24px;
  border-left: 4px solid var(--nrs-blue);
  background: #ffffff;
  margin: 8px 12px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  overflow-x: auto;
}

.subtable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.subtable-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--nrs-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.subtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  border: 1px solid var(--border-color);
}

.subtable th {
  background: #edf2f7;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  text-align: right;
}

.subtable th:first-child,
.subtable th:nth-child(2) {
  text-align: left;
}

.subtable td {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.subtable td:first-child,
.subtable td:nth-child(2) {
  text-align: left;
}

.subtable tr:hover td {
  background: #fff8eb;
}

.subtable .total-col {
  font-weight: 700;
  color: var(--nrs-blue);
  background: #f0f6ff;
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 31, 69, 0.6);
  z-index: 999;
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  border-top: 5px solid var(--nrs-orange);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--nrs-navy);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--nrs-navy);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Alerts / Flash Messages */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  color: #cbd5e1;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
}

/* ==========================================================================
   Footer Component
   ========================================================================== */

#footer {
  background: var(--nrs-navy);
  color: #ffffff;
  border-top: 3px solid var(--nrs-orange);
  margin-top: auto;
  font-size: 13px;
}

.footer-top {
  padding: 32px 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.footer-company-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.footer-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 12px;
}

.footer-info {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.8;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: #ffd27a;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  color: #cbd5e1;
  font-size: 12px;
}

.footer-col a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-bottom {
  background: var(--nrs-navy-dark);
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #94a3b8;
}

.footer-bottom .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   Responsive adjustments
   ========================================================================== */

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-buttons-left,
  .filter-buttons-right {
    justify-content: space-between;
    width: 100%;
  }
}

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

  .nav-links {
    flex-wrap: wrap;
  }

  .nav-item a {
    padding: 10px 14px;
    font-size: 13px;
  }
}