/* =============================================
   WMS Gudang — Custom Style
   ============================================= */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1e1b4b;
  --sidebar-active: #4f46e5;
  --sidebar-hover: rgba(255,255,255,0.08);
  --topbar-h: 64px;
  --primary: #4f46e5;
  --body-bg: #f1f5f9;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--body-bg);
  margin: 0;
  font-size: .875rem;
}

/* =============================================
   SIDEBAR
   ============================================= */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease, width .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -.3px;
}

.sidebar-brand i {
  font-size: 1.4rem;
  background: linear-gradient(135deg, #818cf8, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text { color: #fff; }

.sidebar-close {
  color: rgba(255,255,255,.5) !important;
  padding: 4px 8px;
  line-height: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: rgba(255,255,255,.05);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.user-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: .82rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge {
  font-size: .7rem;
  color: #a5b4fc;
  white-space: nowrap;
}

/* Sidebar Navigation */
.sidebar-nav {
  list-style: none;
  padding: .75rem 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav li {
  padding: 0;
}

.nav-label {
  padding: .9rem 1.25rem .35rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  border-radius: 0;
  transition: all .15s;
  font-size: .84rem;
  font-weight: 500;
  position: relative;
}

.nav-link-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.nav-link-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #a5b4fc;
  border-radius: 0 2px 2px 0;
}

/* =============================================
   OVERLAY (mobile)
   ============================================= */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

#sidebarOverlay.show { display: block; }

/* =============================================
   MAIN WRAPPER
   ============================================= */
#mainWrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  gap: 1rem;
}

.topbar-toggle {
  padding: 4px 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.topbar-breadcrumb {
  font-size: .8rem;
  color: #64748b;
}

/* PAGE CONTENT */
.page-content {
  flex: 1;
  padding: 1.5rem;
}

.content-header {
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -.3px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  border-radius: var(--radius) !important;
}

.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

/* =============================================
   TABLES
   ============================================= */
.table th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  border-bottom-width: 1px;
  padding-top: .75rem;
  padding-bottom: .75rem;
}

.table td {
  padding-top: .7rem;
  padding-bottom: .7rem;
  vertical-align: middle;
}

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

/* =============================================
   BUTTONS
   ============================================= */
.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 6px; font-size: .8rem; }

/* =============================================
   FLASH MESSAGES
   ============================================= */
.flash-messages { margin-bottom: 1rem; }

.alert {
  border-radius: 10px;
  font-size: .85rem;
}

/* =============================================
   FORMS
   ============================================= */
.form-control, .form-select {
  border-radius: 8px;
  font-size: .875rem;
  border-color: #e2e8f0;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.input-group-text {
  border-color: #e2e8f0;
  background-color: #f8fafc;
  font-size: .875rem;
}

.form-label { font-size: .82rem; color: #374151; margin-bottom: .35rem; }

/* =============================================
   BADGES
   ============================================= */
.badge { font-size: .72rem; font-weight: 600; }

/* =============================================
   SIDEBAR COLLAPSED (desktop)
   ============================================= */
body.sidebar-collapsed #sidebar {
  width: 68px;
}

body.sidebar-collapsed #sidebar .brand-text,
body.sidebar-collapsed #sidebar .nav-link-item span,
body.sidebar-collapsed #sidebar .nav-label,
body.sidebar-collapsed #sidebar .user-name,
body.sidebar-collapsed #sidebar .user-badge {
  display: none;
}

body.sidebar-collapsed #sidebar .sidebar-header {
  justify-content: center;
  padding: 1.25rem .5rem 1rem;
}

body.sidebar-collapsed #sidebar .sidebar-user {
  justify-content: center;
  padding: .75rem .5rem;
}

body.sidebar-collapsed #sidebar .nav-link-item {
  justify-content: center;
  padding: .7rem;
}

body.sidebar-collapsed #sidebar .nav-link-item i {
  width: auto;
}

body.sidebar-collapsed #mainWrapper {
  margin-left: 68px;
}

/* =============================================
   MOBILE
   ============================================= */
@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.show {
    transform: translateX(0);
  }

  #mainWrapper {
    margin-left: 0 !important;
  }
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  background: var(--body-bg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.login-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  top: -100px;
  right: -100px;
}

.login-left::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  bottom: -80px;
  left: -60px;
}

.login-left-content {
  position: relative;
  z-index: 1;
  max-width: 380px;
  color: #fff;
}

.login-logo-big {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #a5b4fc, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-left-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .75rem;
  line-height: 1.3;
}

.login-left-content p {
  color: rgba(255,255,255,.7);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.login-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: rgba(255,255,255,.85);
  margin-bottom: .5rem;
  font-size: .9rem;
}

.login-features i { color: #a5b4fc; }

.login-right {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #fff;
}

.login-form-wrapper {
  width: 100%;
  max-width: 380px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 1.75rem;
}

.login-brand i { font-size: 1.75rem; }

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: .35rem;
}

.login-subtitle { font-size: .875rem; margin-bottom: 1.5rem; }

.login-form .form-control { padding: .6rem .875rem; }

@media (max-width: 991.98px) {
  .login-right {
    max-width: 100%;
    padding: 1.5rem;
  }
}

/* =============================================
   SCROLLBAR
   ============================================= */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* =============================================
   PRINT
   ============================================= */
@media print {
  #sidebar, #sidebarOverlay, .topbar, .content-header { display: none !important; }
  #mainWrapper { margin: 0 !important; }
  .page-content { padding: 0 !important; }
}
