/* =============================================
   Shamirik Cargo — Main Stylesheet
   All colors via CSS variables only
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&display=swap');

:root {
  --color-primary:          #284796;
  --color-primary-dark:     #1a2f63;
  --color-primary-light:    #3a5db5;
  --color-secondary:        #F3E15E;
  --color-text-on-primary:  #ffffff;
  --color-text-on-secondary:#1a1a1a;
  --sidebar-width:          240px;
  --topbar-height:          60px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  background: #f4f6fb;
  margin: 0;
  padding: 0;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-on-primary);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--color-secondary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-on-secondary);
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-nav { padding: 10px 0; flex: 1; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  border-radius: 0;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background: var(--color-primary-light);
  color: var(--color-text-on-primary);
}

.sidebar-nav .nav-link.active {
  background: var(--color-secondary);
  color: var(--color-text-on-secondary);
  border-left-color: var(--color-primary-dark);
  font-weight: 600;
}

.sidebar-nav .nav-link.active i {
  color: var(--color-text-on-secondary);
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-footer .nav-link {
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  text-decoration: none;
}

.sidebar-footer .nav-link:hover { color: #fff; }

/* ---- Main layout ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid #e5e9f2;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar .page-title {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

.topbar .topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  font-weight: 500;
}

.topbar .user-avatar {
  width: 32px; height: 32px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

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

/* ---- KPI Cards ---- */
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid #e8edf5;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kpi-card .kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-card .kpi-icon.primary   { background: rgba(40,71,150,0.12); color: var(--color-primary); }
.kpi-card .kpi-icon.success   { background: rgba(25,135,84,0.12);  color: #198754; }
.kpi-card .kpi-icon.warning   { background: rgba(255,193,7,0.15);  color: #d39e00; }
.kpi-card .kpi-icon.info      { background: rgba(13,202,240,0.12); color: #0dcaf0; }

.kpi-card .kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: 12px;
  color: #8a94a6;
  font-weight: 500;
  margin-top: 2px;
}

/* ---- Charts ---- */
.chart-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8edf5;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chart-card .chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 16px;
}

/* ---- Tables / DataTables ---- */
.table-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8edf5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow: hidden;
}

.table-card .table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e8edf5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-card .table-card-header h6 {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

.table-card .table-card-body { padding: 0; }

.table-card table { margin-bottom: 0; font-size: 13px; }
.table-card table th { background: #f8f9fc; font-weight: 600; color: #4a5568; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; border-top: none; }
.table-card table td { vertical-align: middle; color: #2d3748; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
  border-radius: 6px;
  border: 1px solid #dde3ec;
  font-size: 13px;
  padding: 5px 10px;
  font-family: 'Barlow', sans-serif;
}

.dataTables_wrapper .dataTables_length select {
  border-radius: 6px;
  border: 1px solid #dde3ec;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
  border-radius: 5px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--color-primary-light) !important;
  border-color: var(--color-primary-light) !important;
  color: #fff !important;
  border-radius: 5px;
}

div.dt-buttons { margin-bottom: 4px; }

/* ---- Buttons ---- */
.btn-primary-custom {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border: none;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
}

.btn-primary-custom:hover {
  background: var(--color-primary-dark);
  color: var(--color-text-on-primary);
}

/* ---- Import drag-drop zone ---- */
.drop-zone {
  border: 2px dashed #c8d0e0;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafbfe;
}

.drop-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(40,71,150,0.05);
}

.drop-zone .drop-icon {
  font-size: 48px;
  color: #b0bac9;
  margin-bottom: 12px;
}

.drop-zone.dragover .drop-icon {
  color: var(--color-primary);
}

.drop-zone .drop-text {
  font-size: 15px;
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 6px;
}

.drop-zone .drop-hint {
  font-size: 12px;
  color: #8a94a6;
}

/* ---- Status badges ---- */
.badge-confirmed { background: #d4edda; color: #155724; font-weight: 600; }
.badge-pending   { background: #fff3cd; color: #856404; font-weight: 600; }
.badge-failed    { background: #f8d7da; color: #721c24; font-weight: 600; }
.badge-collected { background: #d4edda; color: #155724; font-weight: 600; }
.badge-uncollected { background: #f8d7da; color: #721c24; font-weight: 600; }
.cursor-pointer  { cursor: pointer; }
.badge-status.cursor-pointer:hover { opacity: .8; }

/* ---- Uncollected row highlight ---- */
tr.row-uncollected { background: #fff5f5 !important; }
tr.row-uncollected:hover { background: #fee2e2 !important; }
tr.row-uncollected td { color: #4a1a1a; }
.text-balance-due { color: #dc3545; font-weight: 700; }

/* ---- Password toggle ---- */
.password-wrap { position: relative; }
.password-wrap .btn-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #8a94a6;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.password-wrap .btn-eye:hover { color: var(--color-primary); }

/* ---- Login page ---- */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon {
  width: 64px; height: 64px;
  background: var(--color-secondary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: var(--color-text-on-secondary);
  margin: 0 auto 12px;
}

.login-logo h4 {
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  font-size: 20px;
}

.login-logo p {
  color: #8a94a6;
  font-size: 13px;
  margin: 4px 0 0;
}

/* ---- Utilities ---- */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 16px;
}

.text-tzs { font-weight: 600; color: #1a1a2e; }
.text-muted-sm { font-size: 12px; color: #8a94a6; }

/* ---- Sidebar toggle (mobile) ---- */
.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: #444;
  cursor: pointer;
  margin-right: 12px;
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle-btn { display: block; }
  .main-content { padding: 16px; }
  .kpi-card .kpi-value { font-size: 17px; }
}

/* ---- Sidebar overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }
