/* ==============================================================================
   SIPANDAI E-OFFICE - CORE DESIGN SYSTEM & VARIABLES
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand Color Palette (Vibrant Royal Blue & Emerald Glow) */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-800: #1e3a8a;
  --primary-900: #172554;

  --accent-cyan: #06b6d4;
  --accent-teal: #0d9488;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  /* Default Soothing & Clean Light Theme */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-hover: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --text-inverse: #ffffff;

  /* Status Colors */
  --status-success-bg: #ecfdf5;
  --status-success-text: #059669;
  --status-success-border: #a7f3d0;

  --status-warning-bg: #fffbeb;
  --status-warning-text: #d97706;
  --status-warning-border: #fde68a;

  --status-danger-bg: #fff1f2;
  --status-danger-text: #e11d48;
  --status-danger-border: #fecdd3;

  --status-info-bg: #eff6ff;
  --status-info-text: #2563eb;
  --status-info-border: #bfdbfe;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 25px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 30px -6px rgba(15, 23, 42, 0.1), 0 8px 12px -4px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 25px -5px rgba(37, 99, 235, 0.25);

  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: #e2e8f0;
  --backdrop-blur: blur(16px);

  /* Dimensions */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 80px;
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode (Opsional jika ingin beralih) */
[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #283548;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-card-hover: rgba(51, 65, 85, 0.95);

  --border-color: rgba(148, 163, 184, 0.15);
  --border-hover: rgba(99, 102, 241, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #0f172a;

  --glass-bg: rgba(30, 41, 59, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-main);
  background-color: var(--bg-app);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout Hierarchy */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  position: relative;
  background: radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.06) 0%, transparent 40%);
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: width var(--transition-normal), transform var(--transition-normal);
  backdrop-filter: var(--backdrop-blur);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  justify-content: space-between;
}

.brand-logo-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-600), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.brand-logo-wrap.has-img {
  background: transparent !important;
  box-shadow: none !important;
  width: 44px;
  height: 44px;
  padding: 0;
}

.brand-logo-wrap.has-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: #1d4ed8;
}

[data-theme="dark"] .brand-name {
  color: #60a5fa;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* User Profile Badge in Sidebar */
.sidebar-user-card {
  margin: 1.25rem 1rem 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.user-avatar-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  position: relative;
}

.user-status-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-emerald);
  border-radius: var(--radius-full);
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2px solid var(--bg-surface);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name-text {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-pill {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-300);
  font-weight: 600;
  margin-top: 2px;
}

/* Sidebar Nav Links */
.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0 0.75rem 0.35rem;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
  position: relative;
  cursor: pointer;
}

.nav-item-link:hover {
  color: var(--primary-600);
  background: var(--primary-50);
}

.nav-item-link.active {
  color: var(--primary-700);
  background: var(--primary-50);
  border-left: 3px solid var(--primary-600);
  font-weight: 700;
}

[data-theme="dark"] .nav-item-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nav-item-link.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0.08) 100%);
  border-left: 3px solid var(--primary-500);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--primary-600);
  color: #fff;
  font-weight: 700;
}

/* Quick Role Switcher Bar in Sidebar Footer */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.role-switcher-title {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.role-switcher-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.role-switcher-select:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Main Content Area */
.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Top App Header */
.app-header {
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.page-breadcrumb .current-page {
  color: var(--text-main);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  width: 260px;
  transition: width var(--transition-fast), border-color var(--transition-fast);
}

.header-search-bar:focus-within {
  width: 320px;
  border-color: var(--primary-500);
}

.header-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.82rem;
  width: 100%;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.notif-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-rose);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
}

/* Page Body Viewport */
.app-content {
  flex: 1;
  padding: 1.25rem 1.5rem;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

/* Dynamic Page Animations */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sidebar Backdrop Overlay for Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}
.sidebar-backdrop.active,
.sidebar-backdrop.show {
  display: block !important;
  opacity: 1 !important;
}

.sidebar-close-btn {
  display: none;
  background: var(--bg-surface-elevated, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--text-muted, #64748b);
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm, 8px);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.sidebar-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

.mobile-menu-toggle {
  display: none;
}

/* Responsive adjustments & Full Screen Mobile UX */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: min(300px, 85vw) !important;
    max-width: 85vw !important;
    background: var(--bg-surface, #ffffff) !important;
    z-index: 1050 !important;
    transform: translateX(-105%) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .app-sidebar.active,
  .app-sidebar.mobile-open {
    transform: translateX(0) !important;
  }
  .sidebar-close-btn {
    display: inline-flex !important;
  }
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
  }
  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 10 !important;
  }
}

@media (max-width: 768px) {
  /* Full screen layout optimization on smartphone screens */
  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  .app-layout {
    width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .app-header {
    height: 52px;
    padding: 0 0.65rem;
    gap: 0.5rem;
  }

  .header-left {
    flex: 1;
    min-width: 0;
    gap: 0.45rem;
  }

  .page-breadcrumb {
    font-size: 0.78rem;
    max-width: calc(100vw - 160px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .page-breadcrumb .current-page {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Sembunyikan search bar di sticky header HP agar tidak tumpang tindih */
  .header-search-bar {
    display: none !important;
  }

  .header-right {
    gap: 0.35rem;
  }

  .header-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
  }

  .btn-back-landing .btn-text,
  .btn-header-logout .btn-text {
    display: none;
  }

  .btn-back-landing,
  .btn-header-logout {
    padding: 0.35rem 0.5rem;
  }

  /* Isi Halaman Full Screen HP */
  .app-content {
    padding: 0.85rem 0.65rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
  }

  .view-title-group h1 {
    font-size: 1.25rem !important;
    line-height: 1.35;
    letter-spacing: -0.01em;
  }

  .view-subtitle {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  /* Tombol Aksi di HP (Rapi, fleksibel, tidak berantakan) */
  .view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }

  .view-actions .btn {
    font-size: 0.75rem;
    padding: 0.42rem 0.7rem;
    flex: 1 1 auto;
    justify-content: center;
    white-space: nowrap;
  }

  /* Kartu Metrik Statistik Full Width */
  .stat-card {
    padding: 1.05rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.65rem;
  }

  .stat-card-value {
    font-size: 1.85rem;
  }
}

/* ==============================================================================
   MINIMALIST INSTITUTIONAL EMPTY STATE SYSTEM
   ============================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 2rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

