/* public/css/style.css - Services & Formulir IT Mitra Keluarga (Sidebar Layout) */
:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --mika-green: #059669;
  --mika-green-light: #ecfdf5;
  --mika-green-border: #a7f3d0;
  
  --bg-page: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-active: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --color-blue: #0284c7;
  --color-blue-bg: #eff6ff;
  --color-amber: #d97706;
  --color-amber-bg: #fffbeb;
  --color-emerald: #059669;
  --color-emerald-bg: #ecfdf5;

  --sidebar-width: 270px;
  --sidebar-width-collapsed: 74px;
  --topbar-height: 58px;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-sidebar: 4px 0 24px rgba(15, 23, 42, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}

/* ====================================================
   Application Layout Container
   ==================================================== */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Mobile Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 140;
}

/* ====================================================
   LEFT SIDEBAR
   ==================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 150;
  box-shadow: var(--shadow-sidebar);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* Sidebar Header / Brand */
.sidebar-header {
  padding: 1rem 1.15rem;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  min-width: 0;
}

.brand-badge {
  width: 38px;
  height: 38px;
  background: var(--primary-gradient);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.brand-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.brand-info h2 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-info .badge-mika {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.brand-info p {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Sidebar Toggle Collapse Button */
.btn-sidebar-toggle {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-sidebar-toggle:hover {
  background: var(--surface-hover);
  color: var(--primary);
  border-color: #cbd5e1;
}

.btn-sidebar-toggle .icon-toggle {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  padding: 0.6rem 0.65rem 0.25rem;
  white-space: nowrap;
}

/* General Sidebar Link Item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.nav-item-icon {
  font-size: 1.15rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-ext-arrow {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-left: auto;
}

/* ====================================================
   HIERARCHICAL TREE GROUP (Services Accordion)
   ==================================================== */
.nav-group {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
}

.nav-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  color: #047857;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-align: left;
}

.nav-group-header:hover {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

.group-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-group.is-open .group-chevron {
  transform: rotate(180deg);
}

/* Sub-Items (Tree Branches) */
.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0 0.35rem 0.85rem;
  position: relative;
  border-left: 2px solid #e2e8f0;
  margin-left: 1.25rem;
  margin-top: 0.25rem;
}

.nav-group.is-open .nav-group-items {
  display: flex;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-sub-item:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.nav-sub-item.active {
  background: #eff6ff;
  color: #0284c7;
  font-weight: 700;
  border-left: 3px solid #0284c7;
  padding-left: calc(0.65rem - 3px);
}

.sub-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.sub-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.sub-title {
  font-size: 0.82rem;
  line-height: 1.2;
}

.sub-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.badge-blue {
  background: #e0f2fe;
  color: #0284c7;
}

.badge-amber {
  background: #fef3c7;
  color: #d97706;
}

.badge-emerald {
  background: #d1fae5;
  color: #059669;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-light);
  background: #fafafa;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.status-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.status-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #0f172a;
}

.status-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ====================================================
   SIDEBAR COLLAPSED STATE (MINI SIDEBAR)
   ==================================================== */
.app-sidebar.is-collapsed {
  width: var(--sidebar-width-collapsed);
}

.app-sidebar.is-collapsed .brand-info,
.app-sidebar.is-collapsed .nav-item-text,
.app-sidebar.is-collapsed .nav-section-title,
.app-sidebar.is-collapsed .sub-text,
.app-sidebar.is-collapsed .item-ext-arrow,
.app-sidebar.is-collapsed .status-info,
.app-sidebar.is-collapsed .group-chevron {
  display: none !important;
}

.app-sidebar.is-collapsed .btn-sidebar-toggle .icon-toggle {
  transform: rotate(180deg);
}

.app-sidebar.is-collapsed .sidebar-header {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}

.app-sidebar.is-collapsed .sidebar-brand {
  display: none;
}

.app-sidebar.is-collapsed .sidebar-item,
.app-sidebar.is-collapsed .nav-group-header {
  justify-content: center;
  padding: 0.65rem 0.5rem;
}

.app-sidebar.is-collapsed .nav-group-items {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
  align-items: center;
}

.app-sidebar.is-collapsed .nav-sub-item {
  justify-content: center;
  padding: 0.6rem 0.5rem;
  border-left: none;
}

.app-sidebar.is-collapsed .nav-sub-item.active {
  border-left: none;
  background: #eff6ff;
}

.app-sidebar.is-collapsed .sidebar-footer {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
}

/* ====================================================
   MAIN VIEWPORT & TOPBAR
   ==================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-page);
  min-width: 0;
}

/* Slim Main Topbar */
.main-topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.35rem;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-mobile-menu:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 0.85rem;
}

.crumb-root {
  color: var(--text-muted);
  font-weight: 600;
}

.crumb-sep {
  color: var(--text-subtle);
}

.crumb-current {
  font-weight: 800;
  color: var(--text-main);
}

.toolbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.toolbar-badge.blue {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.toolbar-badge.amber {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.toolbar-badge.emerald {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

/* Topbar Right Actions & Tab Switchers */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-tabs {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  gap: 0.2rem;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
  white-space: nowrap; /* tab-btn */
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap; /* btn-action */
  flex-shrink: 0;
}

.btn-action:hover {
  background: var(--surface-hover);
  border-color: var(--text-subtle);
  transform: translateY(-1px);
}

.btn-action.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-action.primary:hover {
  background: var(--primary-hover);
}

/* Notice Banner */
.notice-banner {
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  padding: 0.45rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.76rem;
  color: #1e40af;
  flex-shrink: 0;
}

.notice-banner .notice-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notice-banner a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
}

/* ====================================================
   EMBED CONTAINER & VIEWPORT
   ==================================================== */
.embed-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.iframe-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  display: none;
}

.iframe-wrapper.active {
  display: flex;
  flex-direction: column;
}

.embed-iframe {
  width: 100%;
  height: 100%;
  flex: 1;
  border: none;
  display: block;
}

/* Loading Overlay */
.iframe-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ====================================================
   SHAREPOINT FORM GATEWAY CARD
   ==================================================== */
.sp-gateway-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  flex: 1;
  overflow-y: auto;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.sp-gateway-card {
  max-width: 620px;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  padding: 2.25rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  animation: cardFade 0.3s ease forwards;
}

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

.sp-gateway-icon {
  width: 64px;
  height: 64px;
  background: #fef3c7;
  color: #d97706;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
}

.sp-gateway-badge {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

.sp-gateway-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.sp-gateway-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.55;
  margin-top: -0.5rem;
}

.sp-gateway-notice {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0284c7;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  text-align: left;
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #334155;
  width: 100%;
}

.sp-gateway-notice strong {
  color: #0f172a;
  display: block;
  margin-bottom: 2px;
}

.sp-gateway-notice p {
  color: #64748b;
  margin: 0;
  line-height: 1.45;
}

.sp-gateway-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-primary-sp {
  flex: 1;
  min-width: 220px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.btn-primary-sp:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.btn-secondary-sp {
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-sp:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
  transform: translateY(-1px);
}

.sp-gateway-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
  padding-top: 0.85rem;
  width: 100%;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 0.5rem;
  z-index: 999;
  animation: toastFade 0.25s ease forwards;
}

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

/* Fullscreen Mode */
body.is-fullscreen .app-sidebar,
body.is-fullscreen .main-topbar,
body.is-fullscreen .notice-banner {
  display: none;
}

body.is-fullscreen .embed-main,
body.is-fullscreen .iframe-wrapper,
body.is-fullscreen .embed-iframe {
  height: 100vh;
}

/* ====================================================
   RESPONSIVE DESIGN (TABLETS & MOBILE)
   ==================================================== */
@media (max-width: 992px) {
  .btn-action .btn-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  .app-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.is-mobile-open {
    display: block;
  }

  .btn-mobile-menu {
    display: flex;
  }

  .btn-sidebar-toggle {
    display: none;
  }

  .main-topbar {
    padding: 0 0.85rem;
  }

  .breadcrumb-trail .crumb-root,
  .breadcrumb-trail .crumb-sep {
    display: none;
  }

  .sp-gateway-actions {
    flex-direction: column;
  }
}

/* Dokumen Aset Group & OneDrive Badge */
.nav-group-header.doc-header {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  margin-top: 0.2rem;
}

.nav-group-header.doc-header:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.badge-onedrive {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
