/* Premium Supply Chain Dashboard Styling */

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.2s;
}

a.brand:hover {
  opacity: 0.85;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  padding: 8px 12px;
  border-radius: 6px;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-links a.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.35);
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #0f172a;
    padding: 12px;
    gap: 4px;
    box-shadow: 0 8px 12px -4px rgba(0, 0, 0, 0.3);
    z-index: 20;
  }

  .nav-links.open {
    display: flex;
  }

  .topbar {
    position: relative;
  }
}

.button, .btn {
  color: white;
  text-decoration: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease-in-out;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button:hover, .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.container {
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 24px;
}

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

.page-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

/* Dashboard Tabs Navigation */
.dashboard-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 10px;
  gap: 6px;
  margin-bottom: 24px;
}

.tab-link {
  flex: 1;
  text-align: center;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #64748b;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-link:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.5);
}

.tab-link.active {
  color: #2563eb;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Filter Form */
.filter-form {
  background: #fff;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.filter-form label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 12px;
}

select, input[type="text"], input[type="file"] {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #fff;
  font-size: 0.9rem;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s;
}

select:focus, input[type="text"]:focus {
  border-color: #2563eb;
}

/* KPI Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.summary-card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.2s;
}

.summary-card:hover {
  transform: translateY(-2px);
}

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.kpi-icon.text-success {
  background: #ecfdf5;
  color: #10b981;
}

.kpi-icon.text-warning {
  background: #fff7ed;
  color: #f59e0b;
}

.kpi-icon.text-info {
  background: #f0f9ff;
  color: #0ea5e9;
}

.kpi-body h3 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-body p {
  margin: 4px 0 0 0;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Charts Grid */
.charts-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
}

.chart-card h3 {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.chart-container {
  position: relative;
  height: 350px;
  width: 100%;
}

/* Data Table Card */
.card {
  background: white;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.card.wide {
  max-width: 650px;
  margin: 0 auto;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.table-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  font-size: 0.9rem;
}

#table-search {
  padding: 8px 12px 8px 36px;
  border-radius: 8px;
  width: 260px;
  font-size: 0.9rem;
}

.table-wrapper {
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.88rem;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
  border-bottom: 2px solid #cbd5e1;
}

th:hover {
  background: #f1f5f9;
}

th.sorted {
  color: #2563eb;
  background: #eff6ff;
}

.sort-icon {
  margin-left: 4px;
  font-size: 0.75rem;
  color: #94a3b8;
}

th.sorted .sort-icon {
  color: #2563eb;
}

tbody tr {
  transition: background-color 0.15s;
}

tbody tr:hover {
  background-color: #f8fafc;
}

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

.font-bold {
  font-weight: 600;
}

.text-warning {
  color: #d97706 !important;
}

.text-success {
  color: #059669 !important;
}

.text-primary {
  color: #2563eb !important;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Upload & Stacked Forms */
.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
}

.flash-list {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 14px 20px;
  border-radius: 10px;
  margin-bottom: 24px;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.empty-state {
  padding: 50px 24px;
  text-align: center;
  color: #64748b;
}

.empty-state i {
  font-size: 3rem;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 0.95rem;
}

/* Responsiveness */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .table-header {
    flex-direction: column;
    align-items: stretch;
  }
  #table-search {
    width: 100%;
  }
}

/* Dashboard Sub-Tabs */
.dashboard-subtabs {
  display: flex;
  background: #f8fafc;
  padding: 6px;
  border-radius: 10px;
  gap: 8px;
  margin-bottom: 24px;
  border: 1px solid #e2e8f0;
}

.subtab-link {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #64748b;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subtab-link:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.subtab-link.active {
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

/* Summary and Expanded Detail Rows */
.summary-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.summary-row:hover {
  background-color: #f1f5f9 !important;
}

.summary-row.expanded {
  background-color: #eff6ff !important;
}

