/* =================================================_ */
/* 1. CSS RESET & GLOBAL BASE                        */
/* =================================================_ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.app-body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background-color: var(--bg-color, #f8fafc);
  color: var(--text-color, #1e293b);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* =================================================_ */
/* 2. APP LAYOUT (GRID / FLEX CONTAINER)             */
/* =================================================_ */
.app-container.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* =================================================_ */
/* 3. SIDEBAR STYLING                                */
/* =================================================_ */
.sidebar.app-sidebar {
  width: 260px;
  background-color: var(--sidebar-bg, #ffffff);
  border-right: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

/* Sidebar Header & Brand */
.sidebar-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
}

.logo-box.brand-icon {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary-color, #0f172a);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.logo-box.brand-icon i {
  width: 24px;
  height: 24px;
  color: var(--primary-accent, #2563eb);
}

/* Sidebar Menu Navigation */
.sidebar-menu.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.menu-group {
  margin-bottom: 24px;
}

.menu-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  padding: 0 12px 8px;
  letter-spacing: 0.8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-secondary, #475569);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.nav-link i {
  width: 18px;
  height: 18px;
}

.nav-link:hover {
  background-color: var(--hover-bg, #f1f5f9);
  color: var(--primary-color, #0f172a);
}

.nav-link.active {
  background-color: var(--primary-accent-light, #eff6ff);
  color: var(--primary-accent, #2563eb);
  font-weight: 600;
}

/* Sidebar Footer & Logout Button */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color, #f1f5f9);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background-color: transparent;
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--danger-color, #dc2626);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-logout:hover {
  background-color: var(--danger-light, #fef2f2);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

/* =================================================_ */
/* 4. MAIN WRAPPER & TOPBAR                          */
/* =================================================_ */
.main-wrapper.app-main {
  flex: 1;
  margin-left: 260px; /* Lebar sesuai sidebar */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.topbar.app-header {
  height: 70px;
  background-color: var(--header-bg, #ffffff);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, #475569);
  display: none; /* Muncul via responsive.css kalau layar kecil */
  align-items: center;
  justify-content: center;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color, #0f172a);
}

/* Header Profile & Badges */
.header-right.header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  background-color: var(--primary-accent-light, #eff6ff);
  color: var(--primary-accent, #2563eb);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.username {
  font-weight: 600;
  color: var(--primary-color, #0f172a);
}

/* =================================================_ */
/* 5. CONTENT BODY / MAIN ROUTER CONTAINER           */
/* =================================================_ */
.content-body.app-content {
  flex: 1;
  padding: 32px;
}

/* Loading State untuk Router */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  gap: 12px;
  color: var(--text-muted, #94a3b8);
}

.spin {
  animation: spin 1s linear infinite;
  width: 32px;
  height: 32px;
  color: var(--primary-accent, #2563eb);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* =================================================
   6. Modern SaaS Alert Icon Animations
   ================================================= */

.alert-mdl-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    width: 56px;
    height: 56px;

    border-radius: 50%;
    margin: 0 auto 16px;

    animation: saasPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Background & Color */

.alert-success .alert-mdl-icon {
    background-color: #d1fae5;
    color: #059669;
}

.alert-error .alert-mdl-icon {
    background-color: #fee2e2;
    color: #dc2626;
}

.alert-warning .alert-mdl-icon {
    background-color: #fef3c7;
    color: #d97706;
}

.alert-info .alert-mdl-icon {
    background-color: #e0f2fe;
    color: #0284c7;
}

/* Pop In */

@keyframes saasPopIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* SVG Base */

.saas-animated-icon {
    width: 30px;
    height: 30px;
    overflow: visible;
}


.success-icon .icon-circle {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;

    animation: iconCircleDraw 0.45s ease-out forwards;
}

.success-icon .icon-check {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;

    animation: iconCheckDraw 0.38s
        cubic-bezier(0.65, 0, 0.45, 1)
        0.38s forwards;
}

/* ERROR */

.error-icon .icon-circle {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;

    animation: iconCircleDraw 0.45s ease-out forwards;
}

.error-icon .cross-line-1,
.error-icon .cross-line-2 {
    stroke-dasharray: 12;
    stroke-dashoffset: 12;
}

.error-icon .cross-line-1 {
    animation: iconCrossDraw 0.22s ease-out 0.35s forwards;
}

.error-icon .cross-line-2 {
    animation: iconCrossDraw 0.22s ease-out 0.52s forwards;
}

/* WARNING */

.warning-icon .icon-circle {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;

    animation: iconCircleDraw 0.45s ease-out forwards;
}

.warning-icon .warning-line {
    stroke-dasharray: 10;
    stroke-dashoffset: 10;

    animation: iconWarningDraw 0.25s ease-out 0.35s forwards;
}

.warning-icon .warning-dot {
    opacity: 0;

    animation: iconDotAppear 0.15s ease-out 0.58s forwards;
}

/* INFO */

.info-icon .icon-circle {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;

    animation: iconCircleDraw 0.45s ease-out forwards;
}

.info-icon .info-line {
    stroke-dasharray: 10;
    stroke-dashoffset: 10;

    animation: iconInfoDraw 0.25s ease-out 0.35s forwards;
}

.info-icon .info-dot {
    opacity: 0;

    animation: iconDotAppear 0.15s ease-out 0.58s forwards;
}

/* =================================================
   Keyframes
   ================================================= */

@keyframes iconCircleDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes iconCheckDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes iconCrossDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes iconWarningDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes iconInfoDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes iconDotAppear {
    from {
        opacity: 0;
        transform: scale(0.4);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================
   MASTER DATA TAB NAVIGATION
   ========================================== */

.master-tab-nav {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.master-tab-list {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
}

.master-tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;

  padding: 0.75rem 1.1rem;

  border: none;
  border-radius: 10px 10px 0 0;

  background: transparent;
  color: var(--text-muted, #64748b);

  font-size: 0.9rem;
  font-weight: 500;

  cursor: pointer;

  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.master-tab-btn i {
  width: 17px;
  height: 17px;
}

.master-tab-btn:hover {
  color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.05);
}

.master-tab-btn.active,
.master-tab-btn.btn-primary {
  color: var(--primary, #2563eb);
  background: var(--bg-main, #f4f6f9);
  font-weight: 600;
}

.master-tab-btn.active::after,
.master-tab-btn.btn-primary::after {
  content: "";

  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;

  height: 2px;

  background: var(--primary, #2563eb);
  border-radius: 2px 2px 0 0;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 640px) {

  .master-tab-list {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .master-tab-list::-webkit-scrollbar {
    display: none;
  }

  .master-tab-btn {
    flex-shrink: 0;
    padding: 0.7rem 0.85rem;
    font-size: 0.85rem;
  }

}