/* EKinerja Modern Theme Palette */

/* daisyUI theme variables - fallback if not loaded from Tailwind config */
:root,
[data-theme="ekinerja"] {
  --color-primary: oklch(76.662% 0.135 153.45);
  --color-primary-content: oklch(33.387% 0.04 162.24);
  --color-secondary: #254A41;
  --color-secondary-content: #ffffff;
  --color-accent: oklch(72.772% 0.149 33.2);
  --color-accent-content: oklch(0% 0 0);
  --color-neutral: oklch(35.519% 0.032 262.988);
  --color-neutral-content: oklch(98.462% 0.001 247.838);
  --color-base-100: #F8FAFB;
  --color-base-200: #F3F6F9;
  --color-base-300: #E5E7EB;
  --color-base-content: oklch(35.519% 0.032 262.988);
  --color-info: oklch(72.06% 0.191 231.6);
  --color-info-content: oklch(100% 0 0);
  --color-success: oklch(64.8% 0.15 160);
  --color-success-content: oklch(100% 0 0);
  --color-warning: oklch(84.71% 0.199 83.87);
  --color-warning-content: oklch(100% 0 0);
  --color-error: oklch(71.76% 0.221 22.18);
  --color-error-content: oklch(100% 0 0);
  --radius-selector: 2rem;
  --radius-field: 2rem;
  --radius-box: 1rem;
}

/* Hide attachment buttons and file tools in Trix toolbar */
trix-toolbar [data-trix-button-group="file-tools"] { display: none !important; }
trix-toolbar .trix-button--icon-attach { display: none !important; }

/* Optional: hide any attachment preview UI inside editor content */
.trix-content .attachment { display: none; }

/* Trix Editor Custom Styling */
trix-editor {
  min-height: 120px;
  padding: 12px;
  line-height: 1.6;
}

trix-editor:focus {
  outline: none;
  border-color: var(--color-accent, #14b8a6) !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

trix-toolbar .trix-button-group {
  margin-bottom: 0;
}

/* Make Trix content readable */
.trix-content h1 { font-size: 1.5em; font-weight: bold; margin: 0.5em 0; }
.trix-content h2 { font-size: 1.3em; font-weight: bold; margin: 0.5em 0; }
.trix-content ul, .trix-content ol { margin-left: 1.5em; margin-bottom: 0.5em; }
.trix-content blockquote { border-left: 4px solid #ddd; padding-left: 1em; margin: 0.5em 0; color: #666; }
.trix-content pre { background: #f5f5f5; padding: 1em; border-radius: 4px; overflow-x: auto; }

/* Reduce accidental zoom on mobile (Chrome/Edge), Safari has limited support */
html, body { touch-action: manipulation; }
:root {
  /* Sidebar colors (fixed untuk consistency) */
  --color-sidebar: #254A41;
  --color-sidebar-hover: #204438;
}

/* Viewport and safe area handling */
/* Conservative defaults; JS controller refines these after load */
:root {
  --vh: 1vh;                 /* 1% of viewport height as fallback */
  --vvh: 100vh;              /* full pixel height fallback */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Smooth transition to avoid abrupt jumps when values update */
html, body, .min-h-screen, .h-screen, [data-smooth-viewport] {
  transition: padding 160ms ease, margin 160ms ease, height 160ms ease, min-height 160ms ease;
}

/* Override Tailwind CDN utilities to use --vh instead of 100vh */
.min-h-screen { min-height: calc(var(--vh, 1vh) * 100) !important; }
.h-screen { height: calc(var(--vh, 1vh) * 100) !important; }

/* Utilities for safe area using our variables with env() fallback */
.pt-safe { padding-top: calc(var(--safe-top, env(safe-area-inset-top, 0px))) !important; }
.pb-safe { padding-bottom: calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px))) !important; }
.mt-safe { margin-top: calc(var(--safe-top, env(safe-area-inset-top, 0px))) !important; }
.mb-safe { margin-bottom: calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px))) !important; }

/* Sidebar - satu-satunya override yang diperbolehkan */
.bg-sidebar { background-color: #254A41 !important; }

/* Skeleton shimmer (mobile) */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.10) 25%, rgba(0,0,0,0.18) 37%, rgba(0,0,0,0.10) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 12px;
}
.skeleton-muted { background: linear-gradient(90deg, rgba(0,0,0,0.07) 25%, rgba(0,0,0,0.12) 37%, rgba(0,0,0,0.07) 63%); }

/* Simple spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(15, 23, 42, 0.15);
  border-top-color: rgba(15, 23, 42, 0.55);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Epic Loader styles */
.epic-loader {
  position: fixed; inset: 0; z-index: 9999; overflow: hidden; pointer-events: auto;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(255,129,57,0.08), transparent 60%),
              radial-gradient(1200px 700px at 80% 90%, rgba(113,47,255,0.08), transparent 60%),
              linear-gradient(135deg, #1f1133 0%, #2a0b2a 30%, #4d1930 60%, #a7441a 100%);
  overscroll-behavior: none;
  touch-action: none;
}
.epic-loader::before { /* animated gradient sweep */
  content: ""; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, rgba(255,129,57,0.15), rgba(113,47,255,0.15), rgba(255,129,57,0.15));
  filter: blur(60px); animation: epic-rotate 16s linear infinite;
}
@keyframes epic-rotate { to { transform: rotate(360deg); } }

/* particles */
.epic-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.epic-particle { position: absolute; width: 3px; height: 3px; border-radius: 9999px; opacity: 0.7; filter: drop-shadow(0 0 6px rgba(255,255,255,0.5)); }
.epic-particle.p1 { background: #ff8139; animation: float1 6s ease-in-out infinite; }
.epic-particle.p2 { background: #a06bff; animation: float2 8s ease-in-out infinite; }
.epic-particle.p3 { background: #ffd18a; animation: float3 10s ease-in-out infinite; }
@keyframes float1 { 0%{ transform: translate(10vw,80vh) } 50%{ transform: translate(20vw,30vh) } 100%{ transform: translate(10vw,80vh) } }
@keyframes float2 { 0%{ transform: translate(70vw,90vh) } 50%{ transform: translate(60vw,20vh) } 100%{ transform: translate(70vw,90vh) } }
@keyframes float3 { 0%{ transform: translate(40vw,85vh) } 50%{ transform: translate(30vw,25vh) } 100%{ transform: translate(40vw,85vh) } }

.epic-logo { transform: scale(0.96); opacity: 0; animation: logo-in 1.2s ease forwards; }
@keyframes logo-in { to { transform: scale(1); opacity: 1; } }

.epic-progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.15); box-shadow: inset 0 0 14px rgba(0,0,0,0.35); overflow: hidden; }
.epic-progress-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #7c3aed, #ff6b2c); box-shadow: 0 0 16px rgba(255,107,44,0.5), 0 0 10px rgba(124,58,237,0.45); transition: width 220ms ease; }

.epic-loader-container { position: relative; z-index: 2; color: #fff; font-family: var(--font-sans); }
.epic-phase { font-weight: 700; letter-spacing: 0.2px; text-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.epic-tips { opacity: 0.9; text-shadow: 0 1px 4px rgba(0,0,0,0.35); }

.epic-loader-out { animation: epic-out 420ms ease forwards; }
@keyframes epic-out { to { opacity: 0; transform: scale(0.985); } }

/* Ensure any app content cannot overlap the loader */
.z-max { z-index: 9999 !important; }

/* Prevent page scroll while loader visible */
.no-scroll, .no-scroll body {
  overflow: hidden !important;
  height: 100% !important;
}

/* Sidebar refinements */
.sidebar {
  background-color: var(--color-sidebar) !important;
  color: #fff;
}

/* Custom scrollbar hide for sidebar */
.sidebar .scrollbar-hide::-webkit-scrollbar { display: none; }
.sidebar .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

.sidebar .nav-item {
  border-radius: 12px;
  color: rgba(255,255,255,0.92);
  border: 1px solid transparent;
}
.sidebar .nav-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.sidebar .nav-item:focus-visible {
  outline: 2px solid rgba(255,255,255,0.45);
  outline-offset: 2px;
}
.sidebar .nav-item.is-active {
  background: linear-gradient(120deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.20);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  color: #e8f5ff;
}
.sidebar .role-badge { background-color: rgba(54,132,240,0.18); border: 1px solid rgba(54,132,240,0.35); color: #E5F1FF; }
.sidebar .nav-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.14);
  color: #e9f7ff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Submenu height transitions - auto height for proper sizing */
[data-sidebar-target="submenu"] {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

/* Use a predictable max-height for animation; .submenu-open indicates visible */
[data-sidebar-target="submenu"].submenu-open {
  max-height: 420px; /* enough for multiple items; adjust if necessary */
  opacity: 1;
  transition: max-height 220ms ease, opacity 160ms ease;
}

[data-sidebar-target="submenu"] {
  transition: max-height 220ms ease, opacity 160ms ease;
}

/* Status chips */
.chip { border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.chip-success { background: rgba(37,183,96,0.12); color: var(--color-success); }
.chip-warning { background: rgba(255,140,66,0.14); color: var(--color-warning); }
.chip-error { background: rgba(255,82,82,0.12); color: var(--color-error); }
.chip-info { background: rgba(54,132,240,0.12); color: var(--color-info); }

/* Bottom navigation transparency fallback and styling */
.bottom-navigation {
  /* Modern glass morphism look - don't override inline styles */
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}


/* Accessibility: ensure link focus is visible */
/* Accessibility: ensure link focus is visible */
a:focus, button:focus { outline: 2px solid var(--color-info); outline-offset: 2px; }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 20px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.1);
}
