/* ==========================================================================
   Metronic 8 - Persian RTL Dashboard Theme (Blue Edition)
   100% Offline - No CDN or external dependencies
   Mobile-Optimized & Full Submenus
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Typography & Font Face (IRANSans)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2'),
       url('../fonts/IRANSansWeb_Light.woff') format('woff'),
       url('../fonts/IRANSansWeb_Light.ttf') format('truetype');
}

@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2'),
       url('../fonts/IRANSansWeb_Light.woff') format('woff'),
       url('../fonts/IRANSansWeb_Light.ttf') format('truetype');
}

@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2'),
       url('../fonts/IRANSansWeb_Light.woff') format('woff'),
       url('../fonts/IRANSansWeb_Light.ttf') format('truetype');
}

@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Bold.woff2') format('woff2'),
       url('../fonts/IRANSansWeb_Bold.woff') format('woff'),
       url('../fonts/IRANSansWeb_Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'IRANSans';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/IRANSansWeb_Bold.woff2') format('woff2'),
       url('../fonts/IRANSansWeb_Bold.woff') format('woff'),
       url('../fonts/IRANSansWeb_Bold.ttf') format('truetype');
}

/* --------------------------------------------------------------------------
   2. Design System Variables
   -------------------------------------------------------------------------- */
:root {
  --header-bg-start: #142850;
  --header-bg-end: #1e4bb3;
  --header-height: 64px;
  
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-light: #eff6ff;
  --primary-blue-glow: rgba(37, 99, 235, 0.25);

  --accent-orange: #f97316;
  --accent-orange-hover: #ea580c;

  --text-dark: #181c32;
  --text-body: #475569;
  --text-muted: #94a3b8;
  --text-light: #a1a5b7;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #f1f5f9;
  --border-card: #e2e8f0;
  --border-dashed: #e2e8f0;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 50rem;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12);
  --shadow-dropdown: 0 10px 40px 0 rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   3. Global Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  font-family: 'IRANSans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif !important;
  background-color: var(--bg-page);
  color: var(--text-body);
  letter-spacing: 0 !important;
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Tabular nums for Persian & numeric data */
.tabular-nums, .num, td.num-cell {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  display: inline-block;
}

/* Latin SKU & codes isolation */
bdi, .ltr-text {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 0.95em;
}

a {
  text-decoration: none;
  transition: all 0.2s ease;
}

button {
  font-family: inherit;
  transition: all 0.2s ease;
}

/* --------------------------------------------------------------------------
   4. Top Navbar (Header - Eye-Pleasing Blue)
   -------------------------------------------------------------------------- */
.top-header {
  background: linear-gradient(135deg, var(--header-bg-start) 0%, #1a3c7a 50%, var(--header-bg-end) 100%);
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(20, 40, 80, 0.15);
  position: relative;
  z-index: 1000;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Mobile Hamburger Button */
.btn-mobile-hamburger {
  display: none;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-mobile-hamburger:hover {
  background: rgba(255, 255, 255, 0.25);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-logo img {
  height: 28px;
  width: auto;
}

.brand-logo:hover {
  color: #ffffff;
  opacity: 0.95;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.header-nav-link {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
}

.header-nav-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.14);
}

.header-nav-link.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.22);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Header Left Actions (in RTL) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-share {
  background-color: #ffffff;
  color: #1e3a8a;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.42rem 1.1rem;
  border-radius: var(--radius-pill);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.btn-share:hover {
  background-color: #f8fafc;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.header-icon-btn {
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  cursor: pointer;
}

.header-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  transform: translateY(-1px);
}

.user-profile-btn {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0;
  border: none;
  background: transparent;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  object-fit: cover;
  transition: border-color 0.2s;
}

.user-profile-btn:hover .user-avatar {
  border-color: #ffffff;
}

.online-dot {
  position: absolute;
  bottom: 0;
  start: 0;
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   5. Mega Menu: Dashboards (Matches Image 3 & 5)
   -------------------------------------------------------------------------- */
.mega-menu-dashboards {
  position: absolute;
  top: calc(100% + 6px);
  right: 1.5rem;
  width: 780px;
  max-width: 95vw;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 1.5rem;
  z-index: 1100;
  display: none;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.mega-menu-dashboards.show {
  display: block;
}

.mega-menu-container {
  display: flex;
  gap: 1.5rem;
}

.mega-menu-main {
  flex: 1.7;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.mega-menu-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  color: var(--text-dark);
  text-decoration: none;
  transition: all 0.15s ease;
}

.mega-menu-card:hover {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  transform: translateY(-1px);
}

.mega-menu-card.active {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.mega-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.icon-bg-orange { background: #fff7ed; color: #ea580c; }
.icon-bg-pink { background: #fdf2f8; color: #db2777; }
.icon-bg-blue { background: #eff6ff; color: #2563eb; }
.icon-bg-green { background: #f0fdf4; color: #16a34a; }
.icon-bg-darkblue { background: #e0f2fe; color: #0284c7; }
.icon-bg-yellow { background: #fefce8; color: #ca8a04; }
.icon-bg-purple { background: #faf5ff; color: #9333ea; }
.icon-bg-red { background: #fef2f2; color: #dc2626; }

.mega-card-content h6 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.mega-card-content p {
  margin: 0;
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* Landing Page Promo Banner */
.mega-promo-banner {
  background: #f8fafc;
  border: 1px solid #eef2f6;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mega-promo-content h6 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.mega-promo-content p {
  margin: 0.15rem 0 0 0;
  font-size: 0.78rem;
  color: #64748b;
}

.btn-explore {
  background-color: var(--accent-orange);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-sm);
  border: none;
  white-space: nowrap;
}

.btn-explore:hover {
  background-color: var(--accent-orange-hover);
  color: #ffffff;
}

/* More Dashboards Column */
.mega-menu-side {
  flex: 1;
  border-right: 1px solid #f1f5f9;
  padding-right: 1.25rem;
}

.mega-side-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.85rem;
}

.mega-side-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mega-side-links a {
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  display: block;
}

.mega-side-links a:hover {
  color: var(--primary-blue);
  background-color: #f8fafc;
}

/* --------------------------------------------------------------------------
   6. Sub-header Navigation (White Bar)
   -------------------------------------------------------------------------- */
.sub-header-bar {
  background-color: #ffffff;
  border-bottom: 1px solid #eef2f6;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  position: relative;
  z-index: 900;
}

.sub-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sub-nav-item {
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.sub-nav-item:hover {
  color: var(--text-dark);
  background-color: #f8fafc;
}

.sub-nav-item.active {
  color: var(--text-dark);
  background-color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  border-color: #e2e8f0;
}

.sub-nav-side {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-sub-link {
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.btn-sub-link:hover, .btn-sub-link.active {
  color: var(--text-dark);
  background-color: #f1f5f9;
}

/* --------------------------------------------------------------------------
   7. Dropdowns: Account, Tools, Widgets (Matches Image 1, 2, & Main)
   -------------------------------------------------------------------------- */
/* Account Dropdown */
.account-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 1.5rem;
  width: 220px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 0.5rem;
  z-index: 1050;
  display: none;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.account-dropdown-menu.show {
  display: block;
}

/* Tools Dropdown */
.tools-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 1.5rem;
  width: 200px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 0.5rem;
  z-index: 1050;
  display: none;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.tools-dropdown-menu.show {
  display: block;
}

/* Avatar Dropdown Menu (Matches User Screenshot) */
.avatar-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 280px;
  max-width: 90vw;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 1.25rem 0 0.5rem 0;
  z-index: 1200;
  display: none;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.avatar-dropdown-menu.show {
  display: block;
}

.avatar-menu-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}

.avatar-menu-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-menu-info h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.badge-pro {
  background-color: #e8fff3;
  color: #50cd89;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.avatar-menu-info a.email {
  color: #94a3b8;
  font-size: 0.8rem;
  text-decoration: none;
  direction: ltr;
  display: inline-block;
  margin-top: 0.15rem;
}

.avatar-menu-info a.email:hover {
  color: var(--primary-blue);
}

.avatar-menu-section {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.avatar-menu-section:last-child {
  border-bottom: none;
  padding-bottom: 0.25rem;
}

.avatar-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #334155;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.avatar-menu-item:hover {
  background-color: #f8fafc;
  color: var(--primary-blue);
}

.badge-counter-pink {
  background-color: #ffe2e5;
  color: #f1416c;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
}

.lang-badge {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.theme-mode-icon {
  color: #94a3b8;
  font-size: 1.05rem;
}

/* Generic Dropdown Item with icon */
.custom-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.custom-menu-item:hover {
  background-color: #f8fafc;
  color: var(--primary-blue);
}

.custom-menu-item .menu-item-icon {
  width: 20px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   8. Sub-action / Filter Toolbar
   -------------------------------------------------------------------------- */
.action-toolbar {
  background-color: #ffffff;
  border-bottom: 1px solid #eef2f6;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 850;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-toolbar-tool {
  background: transparent;
  color: #475569;
  border: 1px solid transparent;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toolbar-tool:hover, .btn-toolbar-tool.active {
  background-color: #f1f5f9;
  color: var(--text-dark);
  border-color: #e2e8f0;
}

.btn-toolbar-tool .tool-icon {
  font-size: 0.95rem;
  color: #64748b;
}

.btn-toolbar-tool.active .tool-icon {
  color: var(--accent-orange);
}

.btn-search-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-search-icon:hover {
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}

/* "My Widgets" Popover Dropdown */
.widgets-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 250px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 0.5rem;
  z-index: 1050;
  display: none;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.widgets-dropdown-menu.show {
  display: block;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.widget-menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.widget-menu-item:hover {
  background-color: #f8fafc;
  color: var(--primary-blue);
}

.widget-icon-wrapper {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.icon-task { color: #6366f1; }
.icon-sales { color: #0284c7; }
.icon-expense { color: #f97316; }
.icon-media { color: #06b6d4; }
.icon-project { color: #8b5cf6; }
.icon-event { color: #3b82f6; }

/* --------------------------------------------------------------------------
   8.1 Clean & Smart Search Popover (Modern Replacement for Cluttered Form)
   -------------------------------------------------------------------------- */
.search-popover-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  max-width: 92vw;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 1.25rem;
  z-index: 1100;
  display: none;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.search-popover-menu.show {
  display: block;
}

.search-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.search-popover-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-popover-input-group {
  position: relative;
  margin-bottom: 0.85rem;
}

.search-popover-input {
  width: 100%;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.55rem 2.4rem 0.55rem 2.2rem;
  font-size: 0.86rem;
  color: var(--text-dark);
  outline: none;
  transition: all 0.2s;
}

.search-popover-input:focus {
  background-color: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-popover-input-group .search-icon {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
}

.search-popover-input-group .clear-icon {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  display: none;
}

.search-popover-input-group .clear-icon:hover {
  color: #dc2626;
}

/* Category Filter Pills */
.search-filter-pills {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.search-pill-btn {
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.search-pill-btn:hover {
  background-color: #e2e8f0;
  color: var(--text-dark);
}

.search-pill-btn.active {
  background-color: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Quick Filter Selects Row */
.search-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.search-select {
  width: 100%;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: #475569;
  outline: none;
  cursor: pointer;
}

.search-select:focus {
  border-color: var(--primary-blue);
}

/* Quick Results / Suggestions Section */
.search-suggestions-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 0.4rem;
}

.search-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: #334155;
  font-size: 0.84rem;
  text-decoration: none;
  transition: all 0.15s;
}

.search-suggestion-item:hover {
  background-color: #f8fafc;
  color: var(--primary-blue);
}

.suggestion-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.suggestion-thumb {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: contain;
  background: #f1f5f9;
  padding: 2px;
}

.suggestion-sku {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Footer Buttons */
.search-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.btn-search-apply {
  background-color: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.4rem 1.1rem;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--primary-blue-glow);
}

.btn-search-apply:hover {
  background-color: var(--primary-blue-hover);
  color: #ffffff;
}

.btn-search-reset {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
}

.btn-search-reset:hover {
  color: #dc2626;
}

/* --------------------------------------------------------------------------
   9. Main Layout & Sidebar (Desktop)
   -------------------------------------------------------------------------- */
.dashboard-container {
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  min-height: calc(100vh - 170px);
}

.dashboard-sidebar {
  width: 230px;
  flex-shrink: 0;
}

.sidebar-search-box {
  position: relative;
  margin-bottom: 1.25rem;
}

.sidebar-search-input {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.5rem 2.2rem 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.sidebar-search-box .search-icon {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
}

.sidebar-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.sidebar-nav-item a:hover {
  background-color: #f1f5f9;
  color: var(--text-dark);
}

.sidebar-nav-item.active a {
  background-color: #ffffff;
  color: var(--text-dark);
  font-weight: 700;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sidebar-nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.icon-features { color: #f97316; }
.icon-feature1 { color: #10b981; }
.icon-grid { color: #3b82f6; }
.icon-form { color: #f43f5e; }
.icon-calendar { color: #10b981; }
.icon-gallery { color: #0284c7; }
.icon-kanban { color: #f59e0b; }
.icon-timeline { color: #ec4899; }

.sidebar-section-title {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 1.5rem 0.5rem 0.5rem 0.5rem;
}

/* --------------------------------------------------------------------------
   10. Main Card & Data Table
   -------------------------------------------------------------------------- */
.dashboard-content {
  flex: 1;
  min-width: 0;
}

.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  position: relative;
  transition: box-shadow 0.3s ease;
}

/* --------------------------------------------------------------------------
   10.1 Fullscreen Mode for Products Table Card
   -------------------------------------------------------------------------- */
body.fullscreen-active {
  overflow: hidden !important;
}

@keyframes fullscreenIn {
  0% {
    opacity: 0.8;
    transform: scale(0.97) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fullscreenOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0.8;
    transform: scale(0.97) translateY(8px);
  }
}

.content-card.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 2500 !important;
  background-color: #ffffff !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2rem 2.5rem !important;
  overflow-y: auto !important;
  animation: fullscreenIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.content-card.is-fullscreen.fullscreen-exiting {
  animation: fullscreenOut 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Fullscreen Toggle Button inside Table Actions Group */
.btn-table-fullscreen {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-table-fullscreen:hover {
  background-color: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

/* When table is in fullscreen, style transforms to exit mode */
.content-card.is-fullscreen .btn-table-fullscreen,
.btn-table-fullscreen.is-active {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.1);
}

.content-card.is-fullscreen .btn-table-fullscreen:hover,
.btn-table-fullscreen.is-active:hover {
  background-color: #fecaca;
  color: #991b1b;
  border-color: #f87171;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(185, 28, 28, 0.2);
}

.fullscreen-kbd {
  background-color: #ffffff;
  color: #b91c1c;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #fca5a5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .content-card.is-fullscreen {
    padding: 1.25rem 1rem !important;
  }
}

/* Table Header Controls */
.table-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.product-search-box {
  position: relative;
  width: 280px;
  max-width: 100%;
}

.product-search-box input {
  width: 100%;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.55rem 2.4rem 0.55rem 0.85rem;
  font-size: 0.88rem;
  color: var(--text-dark);
  outline: none;
  transition: all 0.2s ease;
}

.product-search-box input:focus {
  background-color: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.product-search-box .search-icon {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.95rem;
  pointer-events: none;
}

.table-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-filter-select {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.status-filter-select:focus {
  border-color: var(--primary-blue);
}

.btn-add-product {
  background-color: var(--primary-blue);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--primary-blue-glow);
  cursor: pointer;
  white-space: nowrap;
}

.btn-add-product:hover {
  background-color: var(--primary-blue-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* Custom Table Responsive */
.custom-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.product-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: right;
  vertical-align: middle;
}

.product-table th {
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 1px dashed var(--border-dashed);
  white-space: nowrap;
  letter-spacing: 0;
}

.product-table td {
  padding: 1.05rem 1rem;
  border-bottom: 1px dashed var(--border-dashed);
  color: #334155;
  font-size: 0.88rem;
  vertical-align: middle;
  transition: background-color 0.15s ease;
}

.product-table tbody tr {
  transition: background-color 0.15s ease;
}

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

.product-table tbody tr.row-selected {
  background-color: #f0f7ff;
}

/* Table Checkbox */
.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  accent-color: var(--primary-blue);
  transition: all 0.2s;
}

/* Product Info Cell */
.product-cell {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
}

.product-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-title {
  color: var(--text-dark);
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0;
}

/* Quantity & Low Stock Badge */
.qty-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-low-stock {
  background-color: #fff8dd;
  color: #d97706;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

/* --------------------------------------------------------------------------
   Progress Bar (توان ۱۰ روزه - Matches Visual Data Table Image)
   -------------------------------------------------------------------------- */
.table-progress-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 140px;
}

.table-progress-track {
  flex: 1;
  height: 8px;
  background-color: #eaecf0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.table-progress-fill {
  height: 100%;
  background-color: #12b76a;
  border-radius: 999px;
  float: right;
  transition: width 0.4s ease;
}

.table-progress-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: #344054;
  white-space: nowrap;
  min-width: 32px;
  text-align: left;
}

/* Rating Stars (Kept for backwards compatibility) */
.star-rating {
  display: inline-flex;
  gap: 0.2rem;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.star-rating .star-filled {
  color: #f59e0b;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.status-badge.inactive {
  background-color: #ffe2e5;
  color: #f1416c;
}

.status-badge.scheduled {
  background-color: #fff4de;
  color: #ffa800;
}

.status-badge.published {
  background-color: #e8fff3;
  color: #50cd89;
}

/* Actions Dropdown Button */
.btn-actions-dropdown {
  background-color: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-actions-dropdown:hover, .btn-actions-dropdown[aria-expanded="true"] {
  background-color: #ffffff;
  color: var(--primary-blue);
  border-color: var(--primary-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.actions-dropdown-menu {
  min-width: 150px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-dropdown);
  padding: 0.4rem 0;
  z-index: 1050;
}

.actions-dropdown-menu .dropdown-item {
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #475569;
}

.actions-dropdown-menu .dropdown-item:hover {
  background-color: #f1f5f9;
  color: var(--primary-blue);
}

.actions-dropdown-menu .dropdown-item.text-danger:hover {
  background-color: #fef2f2;
  color: #dc2626 !important;
}

/* --------------------------------------------------------------------------
   11. Pagination Controls (Matches Image 4)
   -------------------------------------------------------------------------- */
.pagination-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.page-size-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-dark);
  cursor: pointer;
}

.custom-pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background-color: transparent;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.15s ease;
}

.page-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-dark);
}

.page-btn.active {
  background-color: var(--accent-orange);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

/* Footer (Matches Image 4) */
.dashboard-footer {
  text-align: center;
  padding: 2rem 1rem 1rem 1rem;
  color: #94a3b8;
  font-size: 0.82rem;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-nav a {
  color: #64748b;
  font-weight: 500;
}

.footer-nav a:hover {
  color: var(--primary-blue);
}

/* --------------------------------------------------------------------------
   12. Floating Help Button
   -------------------------------------------------------------------------- */
.floating-help-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: #ffffff;
  border: 1px solid #fed7aa;
  color: #f97316;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.25);
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 999;
}

.floating-help-btn:hover {
  background-color: #f97316;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}

/* --------------------------------------------------------------------------
   13. Mobile Drawer / Offcanvas (Matches Image 5)
   -------------------------------------------------------------------------- */
.mobile-drawer-header {
  padding: 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-drawer-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(100vh - 80px);
}

/* Mobile Accordions */
.drawer-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 0;
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  border-bottom: 1px dashed #e2e8f0;
}

.drawer-section-title i.chevron {
  transition: transform 0.2s ease;
  font-size: 0.8rem;
  color: #94a3b8;
}

.drawer-section-title.collapsed i.chevron {
  transform: rotate(180deg);
}

.drawer-collapse-content {
  padding: 0.75rem 0 1.25rem 0;
}

/* --------------------------------------------------------------------------
   14. Responsive Layouts & Breakpoints
   -------------------------------------------------------------------------- */
/* Tablet & Medium Screens (<992px) */
@media (max-width: 992px) {
  .btn-mobile-hamburger {
    display: inline-flex;
  }

  .header-nav {
    display: none !important;
  }

  .sub-header-bar {
    display: none !important;
  }

  .action-toolbar {
    display: none !important;
  }

  .dashboard-container {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }

  .dashboard-sidebar {
    display: none; /* Accessible inside mobile drawer */
  }

  .content-card {
    padding: 1rem;
    border-radius: var(--radius-sm);
  }

  .table-top-bar {
    margin-bottom: 1rem;
  }

  .product-search-box {
    width: 100%;
  }

  .table-actions-group {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .top-header {
    padding: 0 1rem;
  }

  .btn-share span {
    display: none;
  }

  .btn-share {
    padding: 0.45rem 0.65rem;
  }

  .mega-menu-dashboards {
    display: none !important; /* Managed via mobile drawer */
  }
}

/* Mobile Screens (<640px) */
@media (max-width: 640px) {
  .header-actions {
    gap: 0.4rem;
  }

  .header-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
  }

  .product-table th, .product-table td {
    padding: 0.75rem 0.6rem;
  }

  .product-thumb {
    width: 38px;
    height: 38px;
  }

  .product-title {
    font-size: 0.85rem;
  }

  .floating-help-btn {
    bottom: 1rem;
    left: 1rem;
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .table-actions-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    flex-wrap: nowrap;
  }

  .status-filter-select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
  }

  .btn-add-product {
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
    gap: 0.35rem;
  }

  .btn-table-fullscreen {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.92rem;
  }

  .btn-table-fullscreen #fullscreenText,
  .btn-table-fullscreen #fullscreenKbd {
    display: none !important;
  }
}

/* Very Small Mobile (<400px) */
@media (max-width: 400px) {
  .btn-add-product {
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
  }

  .status-filter-select {
    font-size: 0.78rem;
    padding: 0.45rem 0.4rem;
  }
}

/* ==========================================================================
   Health & Activity Dashboard Widgets Grid (Equal Height & Aligned)
   100% Offline, Zero-CDN, Pure CSS Grid
   ========================================================================== */
.health-widgets-section {
  width: 100%;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.health-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 380px;
  height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.health-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

/* Card Header */
.health-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.health-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.health-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.health-icon.icon-glucose {
  background: #fef2f2;
  color: #ef4444;
}

.health-icon.icon-activity {
  background: #ecfdf5;
  color: #10b981;
}

.health-icon.icon-scale {
  background: #f0f9ff;
  color: #0284c7;
}

.health-icon.icon-food {
  background: #fffbeb;
  color: #f59e0b;
}

.health-icon.icon-sleep {
  background: #eff6ff;
  color: #3b82f6;
}

.health-icon.icon-heart {
  background: #fff1f2;
  color: #f43f5e;
}

.health-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-dark);
}

.btn-health-more {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-health-more:hover {
  background: #f1f5f9;
  color: var(--text-dark);
}

/* Stats Value Row */
.health-stats-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.health-main-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.health-main-val .unit {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.health-sub-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.health-badge-diff {
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Chart Container & Axis */
.health-chart-box {
  width: 100%;
  margin: 0.5rem 0 0.85rem 0;
  position: relative;
}

.health-chart-svg {
  width: 100%;
  height: 90px;
  display: block;
  overflow: visible;
}

.health-timeline-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 0.35rem;
  padding: 0 2px;
}

/* Bottom Metrics Row (3-column pill stats) */
.health-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
  margin-top: auto;
  text-align: center;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-item .m-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.metric-item .m-val small {
  font-size: 0.65rem;
  font-weight: normal;
  color: var(--text-muted);
}

.metric-item .m-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.metric-item .m-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 0.2rem;
}

.m-dot.dot-walking { background: #34d399; }
.m-dot.dot-running { background: #10b981; }
.m-dot.dot-workout { background: #059669; }

/* Insight Pill Box */
.health-insight-box {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-top: 0.75rem;
}

.insight-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.15rem;
}

.insight-desc {
  font-size: 0.7rem;
  color: var(--text-body);
  line-height: 1.35;
}

/* Activity Multi-segment bar */
.activity-breakdown-bar {
  display: flex;
  height: 8px;
  border-radius: 50rem;
  overflow: hidden;
  background: #f1f5f9;
  margin: 0.5rem 0 0.85rem 0;
}

.activity-breakdown-bar .bar-seg {
  height: 100%;
}

.seg-walking { background: #6ee7b7; }
.seg-running { background: #10b981; }
.seg-workout { background: #047857; }

/* Smart Scale BMI Card */
.health-bmi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
}

.bmi-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
}

.bmi-info {
  flex: 1;
}

.bmi-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
  display: block;
}

.bmi-status {
  font-size: 0.7rem;
  font-weight: 600;
}

.bmi-battery {
  width: 24px;
  height: 12px;
  border: 1.5px solid #10b981;
  border-radius: 3px;
  padding: 1.5px;
  position: relative;
}

.bmi-battery::after {
  content: '';
  position: absolute;
  top: 2.5px;
  left: -3px;
  width: 2px;
  height: 4px;
  background: #10b981;
  border-radius: 1px 0 0 1px;
}

.bmi-battery-fill {
  background: #10b981;
  width: 75%;
  height: 100%;
  border-radius: 1px;
}

/* Nutrition Macro Progress Bar */
.nutrition-macro-bar {
  display: flex;
  height: 8px;
  border-radius: 50rem;
  overflow: hidden;
  background: #f1f5f9;
}

.macro-seg {
  height: 100%;
}

.seg-fat { background: #f59e0b; }
.seg-carb { background: #38bdf8; }
.seg-protein { background: #ec4899; }

.macro-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 500;
}

/* Sleep Hypnogram */
.sleep-hypnogram-box {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.sleep-timeline-bar {
  display: flex;
  align-items: flex-end;
  height: 36px;
  gap: 3px;
  background: #ffffff;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.sleep-block {
  border-radius: 3px;
  display: inline-block;
  transition: opacity 0.2s;
}

.sleep-block.deep {
  background: #1d4ed8;
  height: 100%;
}

.sleep-block.light {
  background: #60a5fa;
  height: 65%;
}

.sleep-block.rem {
  background: #93c5fd;
  height: 45%;
}

.sleep-block.awake {
  background: #f87171;
  height: 25%;
}

/* Responsive Breakpoints for Health Widgets */
@media (max-width: 1200px) {
  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .health-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .health-card {
    min-height: auto;
  }
}

/* ==========================================================================
   Live System Clock & Radial Metrics Widgets (Top Grid)
   ========================================================================== */
.erp-top-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.erp-clock-card,
.erp-radial-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 270px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.erp-clock-card:hover,
.erp-radial-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

/* Clock Header */
.erp-clock-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.erp-digital-time {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
  font-family: inherit;
  letter-spacing: -0.5px;
}

.erp-digital-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
}

/* Analog Clock Face */
.analog-clock-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0;
  flex: 1;
}

.analog-clock {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.08), inset 0 2px 6px rgba(0, 0, 0, 0.02);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clock-number {
  position: absolute;
  font-size: 0.82rem;
  font-weight: 800;
  color: #2563eb;
  line-height: 1;
  text-align: center;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clock-num-12 { top: 8px; left: calc(50% - 10px); }
.clock-num-3  { right: 8px; top: calc(50% - 10px); }
.clock-num-6  { bottom: 8px; left: calc(50% - 10px); }
.clock-num-9  { left: 8px; top: calc(50% - 10px); }

.clock-num-1  { top: 20px; right: 38px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-2  { top: 48px; right: 18px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-4  { bottom: 48px; right: 18px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-5  { bottom: 20px; right: 38px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-7  { bottom: 20px; left: 38px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-8  { bottom: 48px; left: 18px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-10 { top: 48px; left: 18px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }
.clock-num-11 { top: 20px; left: 38px; color: #1e293b; font-weight: 700; font-size: 0.75rem; }

/* Clock Hands */
.clock-center-dot {
  width: 9px;
  height: 9px;
  background: #1e293b;
  border-radius: 50%;
  position: absolute;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.clock-hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  border-radius: 4px;
}

.clock-hand.hour {
  width: 4px;
  height: 42px;
  background: #1e293b;
  margin-left: -2px;
  z-index: 6;
  transition: transform 0.3s ease;
}

.clock-hand.minute {
  width: 3px;
  height: 58px;
  background: #1e293b;
  margin-left: -1.5px;
  z-index: 7;
  transition: transform 0.3s ease;
}

.clock-hand.second {
  width: 1.5px;
  height: 68px;
  background: #2563eb;
  margin-left: -0.75px;
  z-index: 8;
  border-radius: 2px;
  transition: transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44);
}

/* Radial Gauge Containers */
.radial-chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 180px;
  flex: 1;
}

.radial-chart-box {
  width: 100%;
  height: 180px;
}

.radial-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

@media (max-width: 1200px) {
  .erp-top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .erp-top-grid {
    grid-template-columns: 1fr;
  }
}


