/* ============================================================
   DEALER PORTAL — Complete Stylesheet v2.0
   Fixed: Responsive navbar, mobile sidebar, avatar display
   ============================================================ */

:root {
  --sidebar-width:         240px;
  --navbar-height:         56px;
  --sidebar-bg:            #1a1d21;
  --sidebar-text:          #adb5bd;
  --sidebar-active-bg:     rgba(13,110,253,0.18);
  --sidebar-active-text:   #4d9fff;
  --sidebar-hover-bg:      rgba(255,255,255,0.06);
  --sidebar-section-color: #6c757d;
  --card-radius:           12px;
  --card-shadow:           0 1px 4px rgba(0,0,0,.08);
  --card-border:           1px solid rgba(0,0,0,.07);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  font-size: 14px;
  color: #212529;
  margin: 0;
}
a { text-decoration: none; }

/* ============================================================
   CUSTOM NAVBAR  (replaces Bootstrap's .navbar)
   ============================================================ */
.admin-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: #0d6efd;
  z-index: 1050;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.admin-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
}

/* Brand */
.admin-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
  text-decoration: none;
}
.admin-brand i { font-size: 20px; }
.admin-brand:hover { color: rgba(255,255,255,.85); }

/* Hamburger button (mobile) */
.sidebar-hamburger {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
}
.sidebar-hamburger:hover { background: rgba(255,255,255,.15); }

/* Navbar icon button (bell) */
.navbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  transition: background .15s;
  text-decoration: none;
}
.navbar-icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Notification dot */
.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #dc3545;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid #0d6efd;
  line-height: 1;
}

/* User button */
.navbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 4px 10px 4px 4px;
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}
.navbar-user-btn:hover { background: rgba(255,255,255,.2); }
.navbar-user-btn::after { display: none; } /* remove BS caret — we use our own */

/* Avatar */
.navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.5);
  flex-shrink: 0;
  display: block;
}
.navbar-avatar-initials {
  background: #fff;
  color: #0d6efd;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  /* width/height/border-radius inherited from .navbar-avatar */
}
.navbar-username {
  font-size: 13.5px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar-chevron {
  font-size: 11px;
  opacity: .7;
}

/* Navbar dropdown */
.navbar-dropdown {
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 200px;
  margin-top: 6px;
}
.navbar-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.navbar-dropdown .dropdown-item {
  padding: 9px 16px;
  font-size: 13.5px;
  border-radius: 6px;
  margin: 2px 6px;
  width: auto;
}
.navbar-dropdown .dropdown-item:hover { background: #f0f4ff; }

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-wrapper {
  display: flex;
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1040;
  transition: transform .25s ease, box-shadow .25s ease;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  flex-shrink: 0;
  /* Desktop: always visible */
  transform: translateX(0);
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* Sidebar header strip (desktop only) */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

/* ============================================================
   SIDEBAR NAV LINKS
   ============================================================ */
.sidebar-nav { padding: 12px 0 60px; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--sidebar-section-color);
  padding: 12px 20px 4px;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 400;
  transition: background .15s, color .15s, border-left-color .15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}
.sidebar-link span { flex: 1; }
.sidebar-link i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-link:hover { background: var(--sidebar-hover-bg); color: #e9ecef; text-decoration: none; }
.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: #0d6efd;
  font-weight: 600;
}
.sidebar-logout { color: #f87171; }
.sidebar-logout:hover { background: rgba(220,53,69,.12); color: #ff8080; }

/* ============================================================
   USER SIDEBAR INFO
   ============================================================ */


.sidebar-user-info {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #6d636336;
  margin: 10px 5px;
  color: #fff;

}
.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.5);
  flex-shrink: 0;
}
.sidebar-user-initials {
  background: #fff;
  color: #0d6efd;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;  
  justify-content: center;
  line-height: 1;
}
/* ============================================================
   MAIN CONTENT
   ============================================================ */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  min-height: calc(100vh - var(--navbar-height));
}

/* ============================================================
   DARK OVERLAY (mobile sidebar backdrop)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(1px);
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   RESPONSIVE — Tablet & Mobile  (< 992px)
   ============================================================ */
@media (max-width: 991.98px) {
  /* Sidebar hidden off-screen by default */
  .admin-sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  /* Sidebar slides in when JS adds .open */
  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0,0,0,.3);
  }
  /* Main content fills full width */
  .admin-main {
    margin-left: 0;
  }
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.11); }
.icon-wrap {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; margin-bottom: 2px; }
.stat-label { font-size: 12px; color: #6c757d; margin: 0; text-transform: uppercase; letter-spacing: .4px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 16px 24px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
  border: var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h4 { margin: 0; font-weight: 700; font-size: 17px; }

/* ============================================================
   TABLE CARD
   ============================================================ */
.table-card { background: #fff; border-radius: var(--card-radius); box-shadow: var(--card-shadow); border: var(--card-border); overflow: hidden; }
.table-card .table-toolbar { padding: 14px 20px; border-bottom: 1px solid #f0f0f0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.table-card .table-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; background: #fafafa; }
.table-card .table { margin: 0; font-size: 13.5px; }
.table-card .table th { background: #f8f9fa; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #6c757d; border-bottom: 2px solid #e9ecef; padding: 11px 16px; white-space: nowrap; }
.table-card .table td { padding: 12px 16px; vertical-align: middle; border-color: #f5f5f5; }
.table-card .table tbody tr:hover { background: #fafeff; }

/* ============================================================
   FORM CARD
   ============================================================ */
.form-card { background: #fff; border-radius: var(--card-radius); box-shadow: var(--card-shadow); border: var(--card-border); padding: 24px 28px; }
.form-card .form-label { font-weight: 600; font-size: 12.5px; color: #495057; margin-bottom: 5px; }
.form-card .form-control, .form-card .form-select { border-radius: 8px; border: 1.5px solid #dee2e6; font-size: 13.5px; padding: 9px 14px; transition: border-color .18s, box-shadow .18s; }
.form-card .form-control:focus, .form-card .form-select:focus { border-color: #86b7fe; box-shadow: 0 0 0 3px rgba(13,110,253,.12); outline: none; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0d6efd 0%,#0a58ca 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; padding: 40px 38px; width: 100%; max-width: 420px; box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.auth-logo { font-size: 36px; color: #0d6efd; text-align: center; margin-bottom: 4px; }
.auth-sub { color: #6c757d; text-align: center; margin-bottom: 28px; font-size: 13.5px; }
.auth-card .form-control { border-radius: 9px; padding: 11px 14px; border: 1.5px solid #dee2e6; font-size: 14px; }
.auth-card .form-control:focus { border-color: #86b7fe; box-shadow: 0 0 0 3px rgba(13,110,253,.12); }
.btn-auth { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; border-radius: 9px; }

/* ============================================================
   BADGES, BUTTONS, TABS
   ============================================================ */
.badge { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.btn { border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.btn-sm { border-radius: 6px; font-size: 12.5px; }
.nav-tabs { border-bottom: 2px solid #dee2e6; }
.nav-tabs .nav-link { color: #6c757d; border: none; border-bottom: 2px solid transparent; padding: 10px 18px; font-weight: 500; font-size: 13.5px; margin-bottom: -2px; border-radius: 0; }
.nav-tabs .nav-link:hover { color: #0d6efd; border-bottom-color: #86b7fe; }
.nav-tabs .nav-link.active { color: #0d6efd; border-bottom-color: #0d6efd; font-weight: 600; }

/* ============================================================
   PRODUCT / BROCHURE CARDS
   ============================================================ */
.product-card { background: #fff; border-radius: var(--card-radius); overflow: hidden; box-shadow: var(--card-shadow); border: var(--card-border); transition: transform .18s, box-shadow .18s; height: 100%; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.product-card .product-img { width: 100%; height: 185px; object-fit: cover; flex-shrink: 0; }
.product-card .product-body { padding: 16px; flex-grow: 1; }
.product-card .product-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.product-card .product-sku { font-size: 11.5px; color: #6c757d; margin-bottom: 6px; }
.product-card .product-price { font-size: 18px; font-weight: 700; color: #0d6efd; margin-top: 6px; }
.product-card .product-actions { padding: 12px 16px; border-top: 1px solid #f0f0f0; display: flex; gap: 6px; flex-shrink: 0; }
.brochure-card { background: #fff; border-radius: var(--card-radius); padding: 18px 20px; box-shadow: var(--card-shadow); border: var(--card-border); display: flex; align-items: flex-start; gap: 16px; transition: transform .18s; }
.brochure-card:hover { transform: translateY(-2px); }
.brochure-card .pdf-icon { font-size: 38px; color: #dc3545; flex-shrink: 0; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-item { padding: 14px 20px; border-bottom: 1px solid #f5f5f5; transition: background .15s; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f0f7ff; border-left: 3px solid #0d6efd; }
.notif-item:hover { background: #fafafa; }
.notif-item .notif-title { font-weight: 600; font-size: 13.5px; }
.notif-item .notif-body { font-size: 12.5px; color: #6c757d; }
.notif-item .notif-time { font-size: 11px; color: #adb5bd; }
.log-action-badge { font-size: 10.5px; border-radius: 20px; padding: 3px 9px; font-weight: 600; }

/* ============================================================
   MISC
   ============================================================ */
.img-preview { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 2px dashed #dee2e6; display: none; }
.upload-group { text-align: center; }
.perm-item { transition: background .15s, border-color .15s; cursor: pointer; }
.perm-item:hover { background: #f8f9fa; }
.progress { border-radius: 10px; overflow: hidden; }
.progress-bar { border-radius: 10px; transition: width .4s ease; }
.alert { border-radius: 10px; border: none; font-size: 13.5px; }

/* DataTables */
div.dataTables_wrapper div.dataTables_filter input { border-radius: 8px; border: 1.5px solid #dee2e6; padding: 6px 12px; font-size: 13px; }
div.dataTables_wrapper div.dataTables_length select { border-radius: 8px; border: 1.5px solid #dee2e6; padding: 5px 10px; font-size: 13px; }
table.dataTable thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #6c757d; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ced4da; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #adb5bd; }

/* ============================================================
   SMALL MOBILE  (< 576px)
   ============================================================ */
@media (max-width: 575.98px) {
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 22px; }
  .form-card { padding: 16px; }
  .page-header { padding: 12px 16px; }
  .page-header h4 { font-size: 15px; }
  .auth-card { padding: 28px 20px; }
  .table-card .table th, .table-card .table td { padding: 9px 12px; }
}

/* Print */
@media print {
  .admin-sidebar, .admin-navbar, .btn { display: none !important; }
  .admin-main { margin-left: 0 !important; }
}