/* =========================================================================
HALLO TIM ENTERPRISE HRIS - SHELL & LAYOUT STYLES (layout.css)
Struktur tata letak utama, sidebar desktop/mobile, header, dan bottom nav
========================================================================= */

/* --- 1. Base Application Shell --- */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background-color: #f8fafc;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-body {
  flex: 1;
  padding: 16px 14px 40px 14px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .content-body {
    max-width: 1720px;
    padding: 24px 32px 48px 32px;
  }
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* --- 2. Sidebar Navigation (Desktop & Drawer Mobile) --- */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  border-right: 1px solid var(--border-dark);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-dark);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.logo-text h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.logo-text h2 span {
  color: var(--primary-accent);
}

.logo-text p {
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.user-brief {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.04);
  margin: 12px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid var(--border-dark);
  transition: background-color 0.2s;
}

.user-brief:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.avatar-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  background-color: #1e293b;
}

.status-indicator.online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: #38bdf8;
  border: 2px solid var(--sidebar-bg);
}

.brief-info h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  background-color: #1e3a8a;
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-top: 2px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-light);
  letter-spacing: 1.2px;
  padding: 14px 10px 6px;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.nav-item i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.2s;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 10px;
}

.nav-item.active i {
  color: #ffffff !important;
}

/* Nav Accordion Groups & Submenus */
.nav-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.nav-accordion-btn {
  display: flex;
  align-items: center;
  width: 100%;
}

.nav-arrow {
  margin-left: auto;
  font-size: 0.72rem !important;
  width: auto !important;
  transition: transform 0.25s ease;
  color: rgba(255, 255, 255, 0.6) !important;
}

.nav-group.open .nav-arrow {
  transform: rotate(90deg);
  color: #ffffff !important;
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  padding-left: 12px;
  gap: 2px;
  margin-top: 2px;
  margin-bottom: 4px;
  border-left: 2px solid rgba(255, 255, 255, 0.15);
  margin-left: 20px;
}

.nav-submenu.d-none {
  display: none !important;
}

.nav-subitem {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s;
}

.nav-subitem i {
  font-size: 0.88rem;
  width: 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

.nav-subitem:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-subitem.active {
  background-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-weight: 700;
}

.badge-counter {
  margin-left: auto;
  background-color: var(--danger);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  display: inline-block;
}

.badge-counter:empty,
.badge-counter[data-count="0"],
.badge-counter.d-none {
  display: none !important;
}

.badge-warning-count {
  background-color: #f59e0b !important;
  color: #ffffff !important;
}

.badge-danger-count {
  background-color: #ef4444 !important;
  color: #ffffff !important;
}

/* ESS Personal Multi-Card Rotating Carousel Banner */
.ess-contract-summary-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #172554 0%, #1e40af 100%);
  color: #ffffff;
  border-radius: 14px;
  padding: 12px 16px 16px 16px;
  margin-bottom: 0px;
  /* Jarak dikontrol presisi oleh kontainer gap 6px agar dempet rapi */
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.15s, box-shadow 0.2s;
  min-height: 82px;
  display: block;
  box-sizing: border-box;
}

.ess-contract-summary-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(30, 64, 175, 0.35);
}

.ess-carousel-slide {
  display: none;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  animation: bannerFadeIn 0.3s ease-in-out;
}

.ess-carousel-slide.active {
  display: flex;
}

@keyframes bannerFadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ess-carousel-dots {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 2;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
}

.carousel-dot.active {
  background: #38bdf8;
  width: 16px;
  border-radius: 4px;
}

.contract-type-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(30, 58, 138, 0.6);
  color: #bfdbfe;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-status-sp {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  padding: 2px 8px;
  border-radius: 9999px;
}

.badge-status-sp.has-sp {
  background: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.contract-days-left {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 4px 0 2px 0;
  color: #ffffff;
}

.contract-period-sub {
  font-size: 0.72rem;
  color: #cbd5e1;
  display: block;
}

.contract-circle-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.75rem;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-dark);
}

.btn-sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sidebar-logout:hover {
  background-color: var(--danger);
  color: #ffffff;
}

/* --- 3. Top Header Bar & Branding --- */
.ess-company-header {
  height: 56px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.header-brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background-color 0.15s;
}

.btn-mobile-toggle:active {
  background-color: #f1f5f9;
}

.header-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.company-dropdown-btn {
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  letter-spacing: 0.3px;
}

/* Header Right Actions (Navigasi Desktop) */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-header-nav-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ecfdf5;
  color: var(--primary-dark);
  border: 1px solid #a7f3d0;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-header-nav-home:hover {
  background-color: #d1fae5;
  color: var(--primary-dark);
}

/* --- 4. Mobile Bottom Navigation Bar --- */
.ess-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  padding: 0 10px max(6px, env(safe-area-inset-bottom, 6px)) 10px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(226, 232, 240, 0.85);
  z-index: 1000;
  justify-content: space-between;
  align-items: flex-end;
  box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  flex: 1 1 0;
  width: auto;
  max-width: none;
  min-width: 0;
  padding: 4px 1px 6px 1px;
  height: 100%;
  transition: color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.more-menu-grid-btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.more-menu-grid-btn:hover {
  transform: translateY(-2px);
  background: #f1f5f9 !important;
}

.more-menu-grid-btn:active {
  transform: scale(0.96);
}

.bottom-nav-item span {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
  margin-top: 3px;
  letter-spacing: -0.25px;
  max-width: 100%;
}

.bottom-nav-item.active {
  color: var(--primary) !important;
  font-weight: 800;
}

.bottom-nav-item.active i {
  color: var(--primary) !important;
  transform: translateY(-1px);
}

.bottom-nav-item i {
  font-size: 1.18rem;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.bottom-nav-scan-btn {
  /* Menyejajarkan teks Presensi pada baseline yang sama dengan tombol lainnya */
  position: relative;
}

.scan-floating-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
  font-size: 1.3rem;
  border: 3.5px solid #ffffff;
  margin-top: -24px;
  margin-bottom: 2px;
  transition: transform 0.12s ease;
}

.bottom-nav-scan-btn:active .scan-floating-icon {
  transform: scale(0.92);
}

.nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-color);
  background-color: #1e293b;
  display: block;
}

.bottom-nav-item.active .nav-avatar {
  border-color: var(--primary);
}

/* --- 5. Layout Responsive Adaptations --- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .btn-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .d-mobile-none {
    display: none !important;
  }

  .content-body {
    padding: 12px 14px calc(80px + env(safe-area-inset-bottom, 16px)) 14px;
    margin-bottom: 0;
  }

  .ess-bottom-nav {
    display: flex;
  }
}

/* =========================================================================
   6. ROLE-BASED DISPLAY RULES (MOBILE TOGGLE & DESKTOP SIDEBAR)
   ========================================================================= */

/* 1. Hilangkan garis tiga (hamburger button) di mobile untuk Kepala Toko & Karyawan Biasa */
body[data-role="kepala_toko"] .btn-mobile-toggle,
body[data-role="employee"] .btn-mobile-toggle,
body[data-role="training"] .btn-mobile-toggle {
  display: none !important;
}

/* 2. Hilangkan seluruh menu di kirinya (sidebar) di desktop untuk Karyawan Biasa & Kepala Toko */
body[data-role="employee"] #sidebar,
body[data-role="employee"] #sidebarBackdrop,
body[data-role="kepala_toko"] #sidebar,
body[data-role="kepala_toko"] #sidebarBackdrop,
body[data-role="training"] #sidebar,
body[data-role="training"] #sidebarBackdrop {
  display: none !important;
}

/* Pastikan konten utama melebar penuh dan rapi saat menu kiri disembunyikan */
body[data-role="employee"] .main-wrapper,
body[data-role="kepala_toko"] .main-wrapper,
body[data-role="training"] .main-wrapper {
  width: 100% !important;
  flex: 1 1 100% !important;
}

/* 3. Tampilkan bottom nav melayang di desktop untuk Karyawan Biasa & Kepala Toko agar tetap bisa akses menu Profil & Navigasi */
@media (min-width: 769px) {

  body[data-role="employee"] .ess-bottom-nav,
  body[data-role="kepala_toko"] .ess-bottom-nav,
  body[data-role="training"] .ess-bottom-nav {
    display: flex !important;
    max-width: 480px;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 16px !important;
    border-radius: 28px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    padding: 0 10px 6px 10px !important;
  }

  body[data-role="employee"] .content-body,
  body[data-role="kepala_toko"] .content-body,
  body[data-role="training"] .content-body {
    padding-bottom: 90px;
  }
}

/* =========================================================================
   7. PENDING ACCOUNT STATUS (READ-ONLY / LOCKED ACCESS)
   ========================================================================= */

/* Banner Pemberitahuan Status Pending Elegan */
.pending-account-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: var(--radius-lg, 16px);
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.1);
  backdrop-filter: blur(8px);
  animation: fadeInDown 0.3s ease-out;
}

.pending-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f59e0b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.pending-banner-content {
  flex: 1;
}

.pending-banner-content h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #b45309;
  margin-bottom: 3px;
  letter-spacing: -0.2px;
}

.pending-banner-content p {
  font-size: 0.78rem;
  color: #78350f;
  line-height: 1.45;
  margin: 0;
}

.pending-banner-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Kunci interaksi tombol jika akun berstatus pending */
body[data-account-status="pending"] .ess-quick-grid .ess-action-item,
body[data-account-status="pending"] #essBtnClockIn,
body[data-account-status="pending"] .ess-banner-card {
  opacity: 0.55;
  filter: grayscale(0.45);
  cursor: not-allowed !important;
  transition: opacity 0.2s, filter 0.2s;
}

body[data-account-status="pending"] .ess-quick-grid .ess-action-item:hover,
body[data-account-status="pending"] #essBtnClockIn:hover {
  transform: none !important;
  box-shadow: none !important;
}