﻿:root {
  --bs-font-sans-serif: Roboto, "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --uo-rightbar-w: 330px;
  --uo-leftbar-w: 275px;
  --uo-leftbar-header-h: calc(var(--uo-leftbar-w) * 3.25 / 5);
  --uo-footer-h: 2.85rem;
  --uo-leftbar-footer-h: var(--uo-footer-h);
  --uo-main-footer-h: var(--uo-footer-h);
  --uo-leftbar-toggle-width: 52px;
}

html, body {
  height: 100%;
  margin: 0;
}

/* ===== Layout Stack =====
    #account .dropdown-menu, floating-toggle (1060)
    sidebar-left (1050)
    sidebar-right (1040)
    sidebar-backdrop (1030)
    main (1000)
*/

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  height: 100%;
  min-width: 220px;
  transition: transform .25s ease, opacity .25s ease;
  background-color: var(--bs-tertiary-bg) !important;
  overflow: hidden;
}

#sidebar-left {
  width: var(--uo-leftbar-w);
  display: flex;
  flex-direction: column;
  left: 0;
  z-index: 1050;
  box-shadow: 1px 0 12px rgba(0, 0, 0, 0.25);
  transform: translateX(0);
}

  #sidebar-left.collapsed {
    --uo-leftbar-w: 0px;
    transform: translateX(-100%);
    opacity: 1;
    box-shadow: none;
  }

  #sidebar-left .leftbar-header {
    height: var(--uo-leftbar-header-h);
  }

  #sidebar-left .leftbar-menu {
    flex: 1 1 auto;
    position: relative;
    height: calc(100% - var(--uo-leftbar-header-h) - var(--uo-leftbar-footer-h));
  }

  #sidebar-left .leftbar-footer {
    height: var(--uo-leftbar-footer-h);
    position: relative;
  }

    #sidebar-left .leftbar-footer .footer-content {
      position: absolute;
      height: 100%;
      width: 100%;
      right: calc(-1 * var(--uo-leftbar-w));
      display: flex;
      align-items: center;
      justify-content: start;
      gap: .5rem;
      padding: .5rem;
      transition: right .28s ease;
    }

#sidebar-right {
  right: 0;
  width: var(--uo-rightbar-w);
  position: fixed;
  z-index: 1040;
  transform: translateX(100%);
}

  #sidebar-right:not(.collapsed) {
    transform: translateX(0);
    box-shadow: -1px 0 12px rgba(0, 0, 0, 0.075);
  }

/* Main area */
.main {
  margin-left: var(--uo-leftbar-w);
  min-height: 100vh;
  position: relative;
  z-index: 1000;
  transition: margin .25s ease;
}

  .main > .container-fluid {
    padding-left: 0;
    padding-right: 0;
  }

  .main footer {
    height: var(--uo-main-footer-h);
    flex-shrink: 0;
  }

#sidebar-left.collapsed ~ .main {
  margin-left: 0;
}

#account .dropdown-menu {
  z-index: 1060;
}

#account .dropdown-item img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 50%;
  vertical-align: middle;
  margin-left: -6px;
  image-rendering: optimizeQuality;
  transform: translate(3px, -1px);
}

/* bg wraper */

.bg-wrap {
  --uo-bg-wrap-bg-img: url('/$main/admin/img/bg1.jpg');
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  outline: none !important;
}

  .bg-wrap::before,
  .bg-wrap::after {
    position: absolute;
    inset: 0;
    content: '';
    z-index: -1;
  }

  .bg-wrap::before {
    --bg-wrap-bgcolor: color-mix(in srgb, var(--bs-light) 75%, transparent);
    background: var(--bg-wrap-bgcolor) var(--uo-bg-wrap-bg-img) no-repeat center;
    background-size: cover;
    filter: grayscale(.3) opacity(.6);
  }

  .bg-wrap::after {
    box-shadow: inset 0 0 1.75rem rgba(0,0,0,.75);
  }

  .bg-wrap img {
    --bg-wrap-img-height: calc(var(--uo-leftbar-header-h) * .52);
    height: var(--bg-wrap-img-height);
    width: var(--bg-wrap-img-height);
    object-fit: cover;
    image-rendering: optimizeQuality;
    filter: opacity(.95);
    margin: .15rem 0;
    border-radius: 50%;
    --bg-wrap-img-bgcolor: color-mix(in srgb, var(--bs-body-color) 17.5%, transparent);
    background: var(--bg-wrap-img-bgcolor);
    transition: transform .15s ease;
  }

    .bg-wrap img:hover {
      transform: scale(1.05);
    }

  .bg-wrap .dispname {
    font-size: 1.2rem;
  }

.leftbar-header img {
  cursor: pointer;
}

#sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(var(--bs-dark-rgb), .5);
  z-index: 1030;
}

[data-bs-theme="dark"]
#sidebar-backdrop {
  background-color: rgba(var(--bs-light-rgb), .15);
}

/* Responsive */
@media (max-width: 991.98px) {
  #sidebar-left.collapsed {
    transform: translateX(-100%);
  }

  #sidebar-left:not(.collapsed) {
    transform: translateX(0);
  }

  #sidebar-right.collapsed {
    transform: translateX(100%);
  }

  #sidebar-right:not(.collapsed) {
    transform: translateX(0);
  }

  .main {
    margin: 0;
  }
}

/* Minimal page layout */
.login {
  --uo-login-bg-img1: url('/$main/admin/img/bg1-1.jpg');
  --uo-login-bg-img2: url('/$main/admin/img/bg1-2.jpg');
  --uo-login-bg-img3: url('/$main/admin/img/bg1-3.jpg');
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100vw;
  min-height: 100vh;
  position: relative;
}


  .login::before,
  .login::after {
    position: absolute;
    inset: 0;
    content: "";
    z-index: -1;
    filter: grayscale(.35);
  }

  .login::before {
    background: var(--uo-login-bg-img1) no-repeat top left fixed;
    background-size: contain;
  }

  .login .login-card {
    width: 375px;
    padding: 1.25rem;
    border-radius: 1rem;
    background: var(--bs-tertiary-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    margin-left: auto;
    transform: translateX(-50%);
  }

@media(max-width: 991.98px) {
  .login {
    flex-direction: row;
  }

    .login::before {
      background: var(--uo-login-bg-img2) no-repeat top left fixed;
      background-size: contain;
    }

    .login::after {
      background: var(--uo-login-bg-img3) no-repeat bottom left fixed;
      background-size: contain;
    }

    .login .login-card {
      margin: 0 auto;
      transform: translateX(0) !important;
    }
}

/* Utilities */
.text-decoration-link {
  text-decoration: none !important;
  transition: text-decoration-color .15s ease-in-out;
  cursor: pointer;
}

  .text-decoration-link:hover {
    text-decoration: underline !important;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }

/** FLOATING BUTTON */
.floating-toggle {
  position: fixed;
  top: 50%;
  left: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(var(--bs-light-rgb), .35);
  border: 2px solid rgba(var(--bs-light-rgb), .1);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1060;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  opacity: .85;
  transition: opacity .2s ease, transform .1s ease;
  touch-action: none; /* 🔥 important for drag */
  /*desktop UX*/
  user-select: none;
  bottom: auto;
  right: auto;
  will-change: transform;
}

[data-bs-theme="light"]
#sidebar-left.collapsed ~ .floating-toggle {
  background: rgba(var(--bs-secondary-rgb), .35);
  border: 2px solid rgba(var(--bs-secondary-rgb), .1);
}

.floating-toggle:hover {
  opacity: 1;
}

.floating-toggle:active {
  transform: scale(0.95);
}

.floating-toggle i {
  font-size: 1.75rem;
  line-height: 0;
  margin-top: 2px;
}

#floating-leftbar-toggle {
  cursor: pointer;
}

  #floating-leftbar-toggle.dragging {
    cursor: grabbing;
  }
