/* static/css/style.css
   Updated: ensure collapsing the sidebar does NOT push the page below it.
   When sidebar is collapsed we remove it from the layout (display:none)
   and expand the main content area.
*/

/* base app styles */
body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }

/* Login styles (kept) */
.login-root {
  background: #f3f6f9;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  width: 900px;
  height: 480px;
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(20,20,40,0.12);
  background: transparent;
}
.left-panel {
  width: 320px;
  background: linear-gradient(180deg, #1e88e5 0%, #42a5f5 100%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px;
}
.left-inner {
  display:flex;
  flex-direction:column;
  height:100%;
}
.wave {
  height:60px;
  border-radius:30px;
  background: rgba(255,255,255,0.06);
  margin-bottom: 14px;
}
.logo { text-align: center; margin-top: 18px; }
.logo .mre { font-size:46px; font-weight:700; letter-spacing:2px; }
.logo .sub { font-size:12px; margin-top:6px; opacity:0.95; }
.desc { margin-top:18px; text-align:center; font-size:12px; opacity:0.95; }
.left-spacer { flex:1; }
.footer { text-align:center; font-size:11px; opacity:0.85; margin-top:6px; }

/* Right login card */
.right-card { flex:1; background: #ffffff; padding: 36px; display:flex; align-items:center; }
.card-body-custom { width:100%; padding-right:8px; box-sizing:border-box; }
.welcome { color: #1e88e5; font-size:30px; font-weight:700; text-align:right; }
.subtitle { color:#666; font-size:13px; text-align:right; margin-top:6px; }
.input-custom {
  background:#eaf8f0; border:1px solid #cfefe0; border-radius:6px; padding:10px 12px; height:44px; text-align:right;
}
.input-custom:focus { border-color:#8fd5a3; box-shadow:none; }
.btn-login { background:#0b5ea8; color:white; border:none; padding:8px 22px; border-radius:6px; font-weight:600; }
.btn-login:hover { background:#094f8b; }
.btn-cancel { color:#777; background:transparent; border:none; padding:8px 16px; border-radius:6px; }

@media (max-width: 980px) {
  .login-container { width: 92%; flex-direction: column; height: auto; }
  .left-panel { width:100%; height:160px; border-bottom-left-radius:0; border-bottom-right-radius:0; }
  .right-card { padding:20px; }
}

/* Dashboard stat cards */
.stat-card {
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 84px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  box-shadow: 0 4px 12px rgba(20,20,40,0.06);
}
.stat-title { font-size:13px; opacity:0.95; text-align:right; }
.stat-value { font-size:22px; font-weight:700; margin-top:4px; text-align:right; }

/* Card headers right-aligned for RTL */
.card-header { text-align: right; font-weight:700; }

/* Chart canvas wrapper style for consistent look */
.card-body canvas { display:block; width:100% !important; height:auto !important; }

/* Tight table in alerts */
.table-sm td, .table-sm th { padding: .35rem .45rem; vertical-align: middle; }

/* remove default top gap for fixed navbar */
#topNavbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1040; }
.app-shell { padding-top: 72px; } /* adjust if navbar height changes */

/* static/css/style.css
   Compact icon-only sidebar mode + hover-to-expand
*/

/* base app styles */
body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }

/* Top navbar fix */
#topNavbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1040; }
.app-shell { padding-top: 72px; }

/* Sidebar base */
.sidebar {
  background:#fff;
  box-sizing: border-box;
  border-right: 1px solid #eee;
  min-height: calc(100vh - 72px);
  transition: width .22s ease, flex-basis .22s ease, box-shadow .22s ease;
  z-index: 1050;
  flex: 0 0 260px;
  max-width: 260px;
  padding: 16px;
}

/* nav items layout */
.sidebar-nav { padding-left: 0; margin-bottom: 0; list-style: none; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .6rem;
  color: #333;
  border-radius: 6px;
  justify-content: flex-end; /* RTL: icon at right */
}
.sidebar-nav .nav-link:hover { background: rgba(0,0,0,0.03); color: #000; text-decoration:none; }

/* icon and label */
.sidebar-icon { font-size: 1.25rem; width: 36px; text-align:center; color: #0b5ea8; }
.sidebar-label { white-space: nowrap; font-size: .95rem; }

/* Compact (icon-only) mode: narrow rail */
#mainSidebar.compact {
  flex: 0 0 68px !important;
  max-width: 68px !important;
  width: 68px !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
  overflow: visible !important;
}

/* hide labels when compact */
#mainSidebar.compact .sidebar-label {
  display: none;
  opacity: 0;
}

/* show brand small in compact (optional) */
.sidebar-brand { font-size: 13px; }

/* expand-on-hover: when user hovers compact sidebar it expands to full */
#mainSidebar.compact:hover {
  flex: 0 0 260px !important;
  max-width: 260px !important;
  width: 260px !important;
  box-shadow: 0 8px 30px rgba(20,20,40,0.08);
}
#mainSidebar.compact:hover .sidebar-label {
  display: inline;
  opacity: 1;
}

/* main content layout */
.main-content {
  flex: 1 1 auto;
  padding: 24px;
  transition: margin .2s ease, width .2s ease, padding .2s ease;
  box-sizing: border-box;
}

/* when main content is marked expanded adjust spacing */
#mainContent.expanded { padding-left: 20px; }

/* Mobile off-canvas (unchanged) */
.sidebar-overlay { display:none; }
@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    top: 72px;
    left: 0;
    transform: translateX(-110%);
    width: 260px;
    height: calc(100vh - 72px);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.45);
    z-index: 1045;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  .app-shell { padding-top: 72px; }
  .main-content { padding: 12px; }
}

/* small responsive tweaks */
@media (max-width: 768px) {
  .stat-card { min-height:70px; padding:10px; }
  .stat-value { font-size:18px; }
}


[dir="rtl"] .sidebar {
  right: 0;
  left: auto;
  border-left: 1px solid #eee;
  border-right: none;
}

/* When compact, change chevron direction */
#mainSidebar.compact #sidebarCollapseBtn i { transform: rotate(180deg); }

/* Dark theme */
body.theme-dark {
  background: #0f1720 !important;
  color: #d1d5db;
}
body.theme-dark .main-content { background: transparent; }
body.theme-dark .navbar { background: #0b1220 !important; }
body.theme-dark .footer { background: #07111b; color: #9aa6b2; }

body.theme-dark .sidebar {
  background: #071022;
  color: #c7d2de;
  border-left-color: rgba(255,255,255,0.06);
}
body.theme-dark .sidebar .nav-link { color: #cbd5e1; }
body.theme-dark .sidebar .nav-link:hover { background: rgba(255,255,255,0.03); color: #fff; }
body.theme-dark .sidebar .sidebar-icon { color: #7dd3fc; }

/* Active nav item */
.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(11,94,168,0.12), rgba(11,94,168,0.08));
  color: #0b5ea8;
  font-weight:600;
}

/* Compact mode: show only icons and keep small brand */
#mainSidebar.compact .sidebar-brand strong,
#mainSidebar.compact .sidebar-brand small {
  display: none;
}

/* Mobile: ensure slide-in from right in RTL */
@media (max-width: 767.98px) {
  [dir="rtl"] .sidebar {
    position: fixed;
    top: 72px;
    right: 0;
    left: auto;
    transform: translateX(110%);
    width: 260px;
    height: calc(100vh - 72px);
    transition: transform .22s ease;
  }
  body.sidebar-open [dir="rtl"] .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.45);
    z-index: 1045;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

/* small spacing tweak to ensure main content doesn't get hidden when sidebar open on mobile */
@media (max-width: 767.98px) {
  .main-content { padding: 14px; }
}