*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  position: relative;
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#app-container {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

.font-poppins {
  font-family: 'Poppins', Inter, sans-serif;
}

.glass {
  background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .25);
}

.dark .glass {
  background: rgba(15, 23, 42, .6);
  border: 1px solid rgba(255, 255, 255, .08);
}

.shadow-soft {
  box-shadow: 0 10px 30px -10px rgba(79, 70, 229, .25), 0 4px 12px -4px rgba(0, 0, 0, .05);
}

.dark .shadow-soft {
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5), 0 4px 12px -4px rgba(0, 0, 0, .3);
}

.trans {
  transition: all .2s cubic-bezier(.2, .8, .2, 1);
}

/* Lucide Icons Crisp Enterprise Styling */
.lucide {
  stroke-width: 2px;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: #c7d2fe;
  border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #374151;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.zen #sidebar,
.zen #topbar,
.zen #bottomnav,
.zen #fab {
  display: none !important;
}

.animate-in {
  animation: in .25s ease;
}

@keyframes in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Quill Editor Customizations */
.ql-toolbar.ql-snow {
  border: none !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px 12px 0 0;
  padding: 8px 12px !important;
  font-family: inherit;
}

.ql-container.ql-snow {
  border: none !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 14px !important;
}

.ql-editor {
  min-height: 120px;
}

.ql-editor p {
  margin-bottom: 0.5em;
}

/* Dark Mode Quill */
.dark .ql-toolbar.ql-snow {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: rgba(255, 255, 255, 0.02);
}

.dark .ql-snow .ql-stroke {
  stroke: #cbd5e1;
}

.dark .ql-snow .ql-fill,
.dark .ql-snow .ql-stroke.ql-fill {
  fill: #cbd5e1;
}

.dark .ql-snow .ql-picker {
  color: #cbd5e1;
}

.dark .ql-snow .ql-picker-options {
  background-color: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .ql-editor.ql-blank::before {
  color: rgba(255, 255, 255, 0.4);
}

/* === CUTE PRELOADER & VALIDATION ANIMATIONS === */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.animate-shake {
  animation: shake 0.45s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes cute-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(1.5deg);
  }
}

.animate-cute-float {
  animation: cute-float 3s ease-in-out infinite;
}

@keyframes cute-wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.animate-cute-wiggle {
  animation: cute-wiggle 1.8s ease-in-out infinite;
}

@keyframes cute-blink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

.cute-eye {
  transform-origin: center;
  animation: cute-blink 3.5s infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.2) rotate(45deg); }
}

.animate-sparkle {
  animation: sparkle 2s ease-in-out infinite;
}

.animate-sparkle-delayed {
  animation: sparkle 2s ease-in-out 1s infinite;
}

/* Fullscreen Immersive Focus Workspace (Desktop & Mobile) */
body.focus-workspace-active {
  overflow: hidden !important;
}

#page-diskusi.focus-workspace {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: #f8fafc !important;
  padding: 1rem !important;
  overflow-y: auto !important;
  margin: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

.dark #page-diskusi.focus-workspace {
  background: #090d16 !important;
}

@media (min-width: 1024px) {
  #page-diskusi.focus-workspace {
    padding: 1.25rem 2rem !important;
    overflow: hidden !important;
  }
  #page-diskusi.focus-workspace #panel-diskusi-main,
  #page-diskusi.focus-workspace #panel-diskusi-side {
    height: calc(100vh - 110px) !important;
    min-height: 520px !important;
  }
}

@media (max-width: 1023px) {
  #page-diskusi.focus-workspace {
    padding: 0.75rem !important;
    padding-bottom: 2rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  #page-diskusi.focus-workspace #panel-diskusi-main,
  #page-diskusi.focus-workspace #panel-diskusi-side {
    height: auto !important;
    min-height: auto !important;
  }
}

/* Floating Exit Fullscreen Button in Focus Workspace */
.focus-exit-floating-btn {
  display: none;
}
#page-diskusi.focus-workspace .focus-exit-floating-btn {
  display: flex !important;
}

/* === HIGH PERFORMANCE RENDERING & SCROLL OPTIMIZATIONS === */
.performance-card,
.task-item-card,
.sesi-item-card,
.mk-item-card {
  content-visibility: auto;
  contain-intrinsic-size: 120px 320px;
  transform: translateZ(0);
}

.custom-scroll,
.overflow-y-auto,
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* Smart Action Buttons in AI Co-Pilot Feed */
.btn-chat-action {
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.btn-chat-action:hover {
  transform: translateY(-1px);
}

.btn-chat-action:active {
  transform: scale(0.96);
}

/* Cover BJT UT Official Styling */
.bjt-cover-box {
  font-family: 'Times New Roman', Times, serif;
  border: 2px solid #000;
  padding: 24px;
  background: #fff;
  color: #000;
  margin-bottom: 24px;
}

/* Responsive Mobile Layout Fixes & Zero-Overflow Safety */
@media (max-width: 1023px) {
  #page-diskusi {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  #page-diskusi .grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 1rem !important;
  }

  #page-diskusi #panel-diskusi-main,
  #page-diskusi #panel-diskusi-side {
    height: auto !important;
    min-height: 480px !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* Sembunyikan FAB bulat (+) saat di ruang diskusi di mobile agar tidak menutupi canvas jawaban */
  body:has(#page-diskusi:not(.hidden)) #fab {
    display: none !important;
  }
}

@media (max-width: 767px) {
  main {
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .glass {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* Quill Toolbar Responsive Multi-Row Wrapping */
  .ql-toolbar.ql-snow {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2px !important;
    padding: 6px 8px !important;
  }

  .ql-snow .ql-formats {
    margin-right: 4px !important;
    margin-bottom: 2px !important;
  }

  /* Chat feed wrap safety */
  #chat-container {
    padding: 0.75rem !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    word-break: break-word !important;
  }

  #chat-container > div > div {
    max-width: 96% !important;
  }
}



