/* FleetNow Client Portal — Modern SaaS Design */
:root {
  --fn-primary: #012880;
  --fn-primary-hover: #1a3fa0;
  --fn-accent: #3dba2b;
  --fn-danger: #dc2626;
  --fn-warning: #d97706;
  --fn-text: #111827;
  --fn-text-muted: #6b7280;
  --fn-border: #e5e7eb;
  --fn-bg: #f3f4f6;
  --fn-sidebar-w: 240px;
  --fn-radius: 10px;
  --fn-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

/* ── LAYOUT ────────────────────────────────────────────────── */
body.customers {
  background: var(--fn-bg) !important;
  padding-top: 0 !important;
  margin: 0;
  font-family: 'Inter', sans-serif;
}

nav.navbar.header { display: none !important; }
.customer-top-submenu { display: none !important; }

#wrapper {
  margin-left: var(--fn-sidebar-w) !important;
  min-height: 100vh;
  padding-top: 0 !important;
}

#content {
  padding: 0 !important;
}

.container { max-width: 100% !important; padding: 0 !important; }

/* hide bootstrap alerts container padding */
#content > .container:first-child { padding: 0 !important; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
#fn-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--fn-sidebar-w);
  height: 100vh;
  background: var(--fn-primary);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.fn-sidebar-logo {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.fn-sidebar-logo img,
.fn-sidebar-logo .navbar-brand img {
  max-height: 32px !important;
  filter: brightness(0) invert(1);
}

.fn-sidebar-logo .navbar-brand {
  padding: 0;
  margin: 0;
  float: none;
  display: block;
}

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

.fn-nav-section {
  padding: 14px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.fn-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-radius: 0;
  line-height: 1.4;
}

.fn-nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none !important;
}

.fn-nav-item.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.fn-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
  flex-shrink: 0;
}

.fn-nav-badge {
  margin-left: auto;
  background: var(--fn-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* sidebar footer */
.fn-sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.fn-user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.fn-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.fn-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fn-user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

.fn-user-actions {
  display: flex;
  gap: 12px;
}

.fn-user-actions a {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fn-user-actions a:hover {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}

/* ── MOBILE TOGGLE ─────────────────────────────────────────── */
.fn-mobile-toggle {
  display: none;
  position: fixed;
  top: 14px; right: 14px;
  z-index: 1100;
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--fn-primary);
  color: #fff;
  border: none;
  font-size: 15px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@media (max-width: 900px) {
  #fn-sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  #fn-sidebar.fn-open { transform: translateX(0); }
  #wrapper { margin-left: 0 !important; }
  .fn-mobile-toggle { display: flex; }
  .fn-page-header { padding-right: 56px !important; }
}

/* ── PAGE HEADER ───────────────────────────────────────────── */
.fn-page-header {
  padding: 24px 28px 0;
  margin-bottom: 20px;
}

.fn-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fn-text);
  margin: 0 0 6px;
}

.fn-page-subtitle {
  font-size: 13px;
  color: var(--fn-text-muted);
  margin: 0;
}

/* package badge */
.fn-pkg-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  vertical-align: middle;
}

/* ── KPI STATS ─────────────────────────────────────────────── */
.fn-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  padding: 0 28px;
  margin-bottom: 24px;
}

.fn-stat-card {
  background: #fff;
  border-radius: var(--fn-radius);
  padding: 18px 20px;
  box-shadow: var(--fn-shadow);
  border: 1px solid var(--fn-border);
}

.fn-stat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
}

.fn-stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.fn-stat-label {
  font-size: 12px;
  color: var(--fn-text-muted);
  font-weight: 500;
}

/* ── TABS (hidden, used by JS) ──────────────────────────────── */
.fn-tabs-nav {
  display: none !important;
}

.tab-pane {
  display: none;
}

.tab-pane.fn-active {
  display: block;
}

/* ── PANELS ────────────────────────────────────────────────── */
.fn-section {
  padding: 0 28px 28px;
}

.fn-panel {
  background: #fff;
  border-radius: var(--fn-radius);
  border: 1px solid var(--fn-border);
  box-shadow: var(--fn-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.fn-panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--fn-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.fn-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fn-text);
  margin: 0;
}

.fn-panel-body {
  padding: 20px;
}

/* ── TABLE ─────────────────────────────────────────────────── */
.fn-table-wrap { overflow-x: auto; }

.fn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fn-table th {
  padding: 9px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--fn-text-muted);
  background: #f9fafb;
  border-bottom: 1px solid var(--fn-border);
  white-space: nowrap;
}

.fn-table th.sortable { cursor: pointer; user-select: none; }
.fn-table th.sortable:hover { background: #f0f1f3; }
.fn-table th.sortable::after { content: ' ↕'; color: #ccc; font-size: 9px; }
.fn-table th.sortable.asc::after { content: ' ↑'; color: var(--fn-primary); }
.fn-table th.sortable.desc::after { content: ' ↓'; color: var(--fn-primary); }

.fn-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--fn-text);
  vertical-align: middle;
}

.fn-table tr:last-child td { border-bottom: none; }
.fn-table tr:hover td { background: #fafafa; }

@media (max-width: 768px) {
  .fn-table th, .fn-table td { font-size: 12px; padding: 7px 10px; }
  .col-mobile-hide { display: none !important; }
}

/* ── STATUS BADGES ─────────────────────────────────────────── */
.fn-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.fn-badge-success { background: #dcfce7; color: #16a34a; }
.fn-badge-danger  { background: #fee2e2; color: #dc2626; }
.fn-badge-warning { background: #fef3c7; color: #b45309; }
.fn-badge-info    { background: #dbeafe; color: #1d4ed8; }
.fn-badge-gray    { background: #f3f4f6; color: #6b7280; }
.fn-badge-blue    { background: #dbeafe; color: #1d4ed8; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.fn-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
  text-decoration: none !important;
  line-height: 1;
  white-space: nowrap;
}

.fn-btn-primary {
  background: var(--fn-primary);
  color: #fff !important;
}
.fn-btn-primary:hover { background: var(--fn-primary-hover); color: #fff !important; }

.fn-btn-secondary {
  background: #fff;
  color: var(--fn-text) !important;
  border: 1px solid var(--fn-border);
}
.fn-btn-secondary:hover { background: #f9fafb; }

.fn-btn-danger {
  background: #fee2e2;
  color: var(--fn-danger) !important;
}
.fn-btn-danger:hover { background: #fecaca; }

.fn-btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.fn-btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.fn-btn-icon { padding: 6px 7px; }

/* ── MODALS ────────────────────────────────────────────────── */
.fn-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  overflow-y: auto;
  padding: 32px 16px;
  backdrop-filter: blur(2px);
}

.fn-modal {
  background: #fff;
  border-radius: 14px;
  max-width: 580px;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  overflow: hidden;
}

.fn-modal-lg { max-width: 680px; }
.fn-modal-xl { max-width: 780px; }

.fn-modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--fn-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fn-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fn-text);
  margin: 0;
}

.fn-modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.12s;
}
.fn-modal-close:hover { background: #e5e7eb; color: var(--fn-text); }

.fn-modal-body {
  padding: 18px 22px;
  max-height: 70vh;
  overflow-y: auto;
}

.fn-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--fn-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── FORMS ─────────────────────────────────────────────────── */
.fn-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) { .fn-form-row { grid-template-columns: 1fr; } }

.fn-form-group {
  margin-bottom: 14px;
}

.fn-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fn-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.fn-form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--fn-border);
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--fn-text);
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-sizing: border-box;
  font-family: inherit;
}

.fn-form-control:focus {
  outline: none;
  border-color: var(--fn-primary);
  box-shadow: 0 0 0 3px rgba(1,40,128,0.08);
}

.fn-form-control::placeholder { color: #9ca3af; }

select.fn-form-control { -webkit-appearance: none; appearance: none; }

.fn-form-section {
  font-size: 12px;
  font-weight: 700;
  color: var(--fn-primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--fn-border);
}

/* ── ONBOARDING ────────────────────────────────────────────── */
.fn-onboarding {
  background: linear-gradient(135deg, #eff6ff 0%, #e8f0fe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--fn-radius);
  padding: 18px;
  margin-bottom: 20px;
}

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

.fn-onboarding-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--fn-primary);
  margin: 0;
}

.fn-onboarding-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.fn-onboarding-step {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--fn-border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fn-text);
}

.fn-onboarding-step.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #16a34a;
}

/* ── GROUP FILTER PILLS ────────────────────────────────────── */
.fn-group-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}

.fn-group-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.12s, box-shadow 0.12s;
}

.fn-group-pill:hover { opacity: 0.85; }
.fn-group-pill.all { background: #f3f4f6; color: var(--fn-text); border-color: var(--fn-border); }
.fn-group-pill.all.active { background: var(--fn-primary); color: #fff; border-color: var(--fn-primary); }

/* ── MAP ───────────────────────────────────────────────────── */
#fleetnow-map {
  border-radius: var(--fn-radius);
  height: 500px;
}

/* ── CALENDAR ──────────────────────────────────────────────── */
.fn-calendar th {
  background: var(--fn-primary);
  color: #fff;
  font-weight: 600;
  padding: 6px;
  text-align: center;
  font-size: 12px;
}

/* ── LIMIT WARNING ─────────────────────────────────────────── */
.fn-limit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #fee2e2;
  color: var(--fn-danger);
  font-size: 12px;
  font-weight: 600;
}

/* ── MISC ──────────────────────────────────────────────────── */
.fn-divider {
  border: none;
  border-top: 1px solid var(--fn-border);
  margin: 16px 0;
}

.fn-text-muted { color: var(--fn-text-muted); }
.fn-empty { padding: 32px 20px; text-align: center; color: var(--fn-text-muted); font-size: 13px; }

/* overrides for Bootstrap elements still used inside content */
.panel_s, .panel-body { /* keep Perfex panels working on other pages */ }

/* ── LOGIN PAGE — ukryj sidebar ───────────────────────────── */
body.customers_login #fn-sidebar,
body.customers_login .fn-mobile-toggle { display: none !important; }
body.customers_login #wrapper { margin-left: 0 !important; }

/* ── HIDE PERFEX DEFAULT HOME WIDGETS ─────────────────────── */
/* The greeting, project summary, and invoice chart sit above  */
/* our FleetNow dashboard — hide them so FN content fills page */
body.customers #greeting { display: none !important; }
body.customers .projects-summary-heading { display: none !important; }
body.customers .section-client-dashboard > dl { display: none !important; }
body.customers .section-client-dashboard > .tw-mb-3 { display: none !important; }
body.customers .section-client-dashboard > .panel_s { display: none !important; }
