/* ==========================================================================
   UNITED TRACTORS WMS - SHELL & LAYOUT STYLESHEET
   ========================================================================== */

/* Shell Root */
.ut-shell-root {
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Body Offset for Fixed Sidebar */
body {
  margin: 0;
  padding: 0;
  margin-left: var(--ut-sidebar-w);
  transition: margin-left var(--ut-transition);
  font-family: var(--font-sans);
  background-color: var(--ut-gray-light);
  overflow-x: hidden;
}

body.ut-collapsed {
  margin-left: calc(var(--ut-sidebar-collapsed-w) + 20px);
}

@media (max-width: 768px) {
  body {
    margin-left: 0 !important;
  }
}

.main-wrapper {
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
}

/* ==========================================================================
   DESKTOP SIDEBAR
   ========================================================================== */
.ut-sidebar {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--ut-sidebar-w);
  background-color: #1a1a1a;
  border-right: 1px solid #2a2a2a;
  z-index: 100;
  overflow: hidden;
  transition: width var(--ut-transition);
  color-scheme: dark;
}

@media (max-width: 768px) {
  .ut-sidebar {
    display: none !important;
  }
}

body.ut-collapsed .ut-sidebar {
  width: var(--ut-sidebar-collapsed-w);
}

/* Header */
.ut-sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 56px;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
  overflow: visible;
  z-index: 2;
}

body.ut-collapsed .ut-sidebar-header {
  justify-content: center;
  padding: 0;
}

.ut-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.ut-sidebar-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  padding: 4px;
  flex-shrink: 0;
}

.ut-sidebar-logo-text {
  opacity: 1;
  width: 140px;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.15s, width var(--ut-transition);
}

body.ut-collapsed .ut-sidebar-logo-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.ut-sidebar-brand-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ut-sidebar-brand-sub {
  font-size: 0.6rem;
  color: #8a8780;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Sidebar Toggle Button */
.ut-toggle-btn {
  position: fixed;
  top: 14px;
  left: calc(var(--ut-sidebar-w) - 14px);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #8a8780;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.35);
  z-index: 101;
  flex-shrink: 0;
  transition: left var(--ut-transition), border-color 0.15s, color 0.15s, background-color 0.15s;
}

.ut-toggle-btn:hover {
  border-color: #e8a000;
  color: #1a1a1a;
  background-color: #e8a000;
}

body.ut-collapsed .ut-toggle-btn {
  left: calc(var(--ut-sidebar-collapsed-w) - 14px);
}

body.ut-collapsed .ut-toggle-btn svg {
  transform: rotate(180deg);
}

/* Nav Menu Container */
.ut-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ut-sidebar-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Nav section labels */
.ut-nav-section {
  padding: 4px 0;
}

.ut-section-label {
  opacity: 1;
  height: auto;
  font-size: 0.58rem;
  font-weight: 700;
  color: #8a8780;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 16px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s, height 0.2s, padding 0.2s;
}

body.ut-collapsed .ut-section-label {
  opacity: 0;
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* Nav Links and Tooltips */
.ut-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #8a8780;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-left: 2.5px solid transparent;
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s, padding var(--ut-transition);
}

.ut-nav-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.ut-nav-link:hover {
  color: #ffffff;
  background-color: #222222;
  border-left-color: rgba(232, 160, 0, 0.4);
}

.ut-nav-link.active {
  color: #e8a000 !important;
  background-color: rgba(232, 160, 0, 0.08) !important;
  border-left-color: #e8a000 !important;
  font-weight: 600;
}

body.ut-collapsed .ut-nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  border-left-color: transparent !important;
}

body.ut-collapsed .ut-nav-link.active {
  background-color: rgba(232, 160, 0, 0.1);
}

.ut-link-text {
  opacity: 1;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s, max-width var(--ut-transition);
}

body.ut-collapsed .ut-link-text {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

body.ut-collapsed .ut-nav-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--ut-sidebar-collapsed-w) + 20px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ut-dark-surface, #2a2a2a);
  border: 1px solid var(--ut-border-dark, #2a2a2a);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s 0.05s;
  z-index: 200;
}

body.ut-collapsed .ut-nav-link:hover::after {
  opacity: 1;
}

/* Sidebar Footer */
.ut-sidebar-footer {
  border-top: 1px solid #2a2a2a;
  padding: 14px 16px;
  flex-shrink: 0;
  overflow: visible;
  transition: padding var(--ut-transition);
}

body.ut-collapsed .ut-sidebar-footer {
  padding-left: 0;
  padding-right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 12px;
}

.ut-sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
  transition: background-color 0.15s;
}

.ut-sidebar-user:hover {
  background-color: #222222;
}

body.ut-collapsed .ut-sidebar-user {
  justify-content: center;
  margin: 0;
  padding: 0;
}

.ut-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #e8a000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #1a1a1a;
  flex-shrink: 0;
}

.ut-sidebar-user-info {
  opacity: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.15s, max-width var(--ut-transition);
}

body.ut-collapsed .ut-sidebar-user-info {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

.ut-sidebar-user-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ut-sidebar-user-role {
  font-size: 0.62rem;
  color: #8a8780;
  margin-top: 2px;
}

/* Sisa Kredit */
.ut-credit-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 4px 8px 4px;
}

body.ut-collapsed .ut-credit-info {
  justify-content: center;
  flex-direction: column;
  margin-top: 4px;
  padding-bottom: 0;
}

.ut-credit-label {
  font-size: 0.65rem;
  color: #8a8780;
  font-weight: 500;
  letter-spacing: 0.02em;
}

body.ut-collapsed .ut-credit-label {
  display: none;
}

.ut-credit-pts {
  font-size: 0.7rem;
  font-weight: 700;
  color: #e8a000;
}

body.ut-collapsed .ut-credit-pts {
  font-size: 0.48rem;
  font-weight: 600;
  text-align: center;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-top: 2px;
}

.ut-footer-links {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 40px;
  margin-top: 4px;
  border-top: 1px solid #2a2a2a;
  padding-top: 4px;
  transition: opacity 0.15s, max-height 0.2s, margin-top 0.2s;
}

body.ut-collapsed .ut-footer-links {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  padding: 0;
  border: none;
  pointer-events: none;
}

.ut-footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 0.72rem;
  color: #8a8780;
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: color 0.15s;
}

.ut-footer-link:hover {
  color: #e05252;
}

/* ==========================================================================
   MOBILE NAVIGATION & DRAWER
   ========================================================================== */
.ut-mobile-nav {
  display: none !important;
}

.ut-bottom-nav {
  display: none !important;
}

@media (max-width: 768px) {
  .ut-mobile-nav {
    display: block !important;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .ut-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    height: 60px;
    z-index: 180;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.ut-drawer {
  display: none;
}

.ut-drawer.open {
  display: block;
}

.ut-drawer-panel {
  transform: translateY(-100%);
  transition: transform var(--ut-transition);
}

.ut-drawer.open .ut-drawer-panel {
  transform: translateY(0);
}

.ut-bottom-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2.5px;
  background: var(--ut-gold);
  border-radius: 0 0 3px 3px;
}
