/* ==========================================================================
   KaryaKita Hub — Full Scale-Up Design System Stylesheet
   Warna Resmi, Tipografi & Komponen Semantik (Adaptive Dual-Theme)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* Warm Daylight (Light Mode) Tokens - 100% Selaras Landing Page */
  --color-primary-emerald: #0F4C3A;
  --color-primary-hover: #1A6B52;
  --color-accent-amber: #B45309;
  --color-app-bg: #F8FAF9;
  --color-card-surface: #FFFFFF;
  --color-spotlight-soft: #EEF5F2;
  --color-card-border: #CFE0D8;
  --color-card-elevated: #EEF5F2;
  --color-text-primary: #1F2937;
  --color-text-muted: #4B5563;

  /* Unit Bisnis Colors */
  --unit-lini-1: #7C3AED;
  --unit-lini-2: #0284C7;
  --unit-lini-3: #0D9488;
  --unit-lini-4: #EA580C;
  --unit-lini-5: #0F4C3A;
  --unit-internal: #4B5563;

  /* Status Colors */
  --status-todo: #64748B;
  --status-inprogress: #0284C7;
  --status-review: #D97706;
  --status-done: #059669;
  --status-blocked: #DC2626;
}

/* Deep Forest Slate (Adaptive Dark Mode) Tokens */
.dark {
  --color-primary-emerald: #10B981;
  --color-primary-hover: #34D399;
  --color-accent-amber: #F59E0B;
  --color-app-bg: #0B1210;
  --color-card-surface: #121C18;
  --color-spotlight-soft: #162620;
  --color-card-border: #23362F;
  --color-card-elevated: #192722;
  --color-text-primary: #ECFDF5;
  --color-text-muted: #9CA3AF;

  /* Soft Pastel Unit Colors for Dark Mode */
  --unit-lini-1: #A78BFA;
  --unit-lini-2: #38BDF8;
  --unit-lini-3: #2DD4BF;
  --unit-lini-4: #FB923C;
  --unit-lini-5: #34D399;
  --unit-internal: #94A3B8;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-app-bg);
  color: var(--color-text-primary);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #23362F;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #345045;
}

/* Custom Badges */
.badge-unit-lini1 { background-color: #F5F3FF; color: #7C3AED; border: 1px solid #DDD6FE; }
.badge-unit-lini2 { background-color: #F0F9FF; color: #0284C7; border: 1px solid #BAE6FD; }
.badge-unit-lini3 { background-color: #F0FDFA; color: #0D9488; border: 1px solid #99F6E4; }
.badge-unit-lini4 { background-color: #FFF7ED; color: #EA580C; border: 1px solid #FFEDD5; }
.badge-unit-lini5 { background-color: #F0FDF4; color: #0F513D; border: 1px solid #BBF7D0; }
.badge-unit-ops   { background-color: #F8FAFC; color: #475569; border: 1px solid #E2E8F0; }

.dark .badge-unit-lini1 { background-color: rgba(124, 58, 237, 0.15); color: #C4B5FD; border-color: rgba(124, 58, 237, 0.3); }
.dark .badge-unit-lini2 { background-color: rgba(2, 132, 199, 0.15); color: #7DD3FC; border-color: rgba(2, 132, 199, 0.3); }
.dark .badge-unit-lini3 { background-color: rgba(13, 148, 136, 0.15); color: #5EEAD4; border-color: rgba(13, 148, 136, 0.3); }
.dark .badge-unit-lini4 { background-color: rgba(234, 88, 12, 0.15); color: #FDBA74; border-color: rgba(234, 88, 12, 0.3); }
.dark .badge-unit-lini5 { background-color: rgba(16, 185, 129, 0.15); color: #6EE7B7; border-color: rgba(16, 185, 129, 0.3); }
.dark .badge-unit-ops   { background-color: rgba(100, 116, 139, 0.15); color: #CBD5E1; border-color: rgba(100, 116, 139, 0.3); }

/* Status Badges */
.badge-status-backlog    { background-color: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.badge-status-todo       { background-color: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.badge-status-inprogress { background-color: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.badge-status-review     { background-color: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.badge-status-done       { background-color: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.badge-status-blocked    { background-color: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }

/* ==========================================================================
   Penyelarasan Landing Page & Dashboard Tokens
   ========================================================================== */

/* Sidebar Active Nav Item - Solid #0F4C3A with White Text & Mint Chevron */
.active-nav {
  background-color: #0F4C3A !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
}
.active-nav i,
.active-nav svg {
  color: #A7F3D0 !important;
}
.dark .active-nav {
  background-color: #10B981 !important;
  color: #06281E !important;
  font-weight: 600 !important;
}
.dark .active-nav i,
.dark .active-nav svg {
  color: #06281E !important;
}

/* Spotlight Card Styles */
.card-spotlight {
  background-color: #0F4C3A;
  color: #FFFFFF;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px -5px rgba(15, 76, 58, 0.3);
}

/* Top Accent Line for 5 Business Units */
.bento-accent-lini1 { border-top: 5px solid #7C3AED !important; }
.bento-accent-lini2 { border-top: 5px solid #0284C7 !important; }
.bento-accent-lini3 { border-top: 5px solid #0D9488 !important; }
.bento-accent-lini4 { border-top: 5px solid #EA580C !important; }
.bento-accent-lini5 { border-top: 5px solid #0F4C3A !important; }

/* Sticky Glass Navbar / Topbar */
.sticky-glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid #CFE0D8;
}
.dark .sticky-glass {
  background-color: rgba(18, 28, 24, 0.88);
  border-bottom: 1px solid #23362F;
}

.dark .badge-status-backlog    { background-color: rgba(71, 85, 105, 0.2); color: #94A3B8; border-color: rgba(71, 85, 105, 0.3); }
.dark .badge-status-todo       { background-color: rgba(71, 85, 105, 0.2); color: #94A3B8; border-color: rgba(71, 85, 105, 0.3); }
.dark .badge-status-inprogress { background-color: rgba(2, 132, 199, 0.2); color: #38BDF8; border-color: rgba(2, 132, 199, 0.3); }
.dark .badge-status-review     { background-color: rgba(217, 119, 6, 0.2); color: #FBBF24; border-color: rgba(217, 119, 6, 0.3); }
.dark .badge-status-done       { background-color: rgba(16, 185, 129, 0.2); color: #34D399; border-color: rgba(16, 185, 129, 0.3); }
.dark .badge-status-blocked    { background-color: rgba(220, 38, 38, 0.2); color: #F87171; border-color: rgba(220, 38, 38, 0.3); }

/* Payment Gate Badges */
.badge-gate-waiting  { background-color: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.badge-gate-dp50     { background-color: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.badge-gate-paid100  { background-color: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }

.dark .badge-gate-waiting  { background-color: rgba(180, 83, 9, 0.2); color: #FBBF24; border-color: rgba(180, 83, 9, 0.4); }
.dark .badge-gate-dp50     { background-color: rgba(16, 185, 129, 0.2); color: #34D399; border-color: rgba(16, 185, 129, 0.4); }
.dark .badge-gate-paid100  { background-color: rgba(5, 150, 105, 0.25); color: #6EE7B7; border-color: rgba(5, 150, 105, 0.4); }

/* Card Surface with border */
.card-surface {
  background-color: var(--color-card-surface);
  border: 1px solid var(--color-card-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.card-surface-interactive {
  background-color: var(--color-card-surface);
  border: 1px solid var(--color-card-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease-in-out;
}
.card-surface-interactive:hover {
  border-color: var(--color-primary-emerald);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}
.dark .card-surface-interactive:hover {
  box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.4);
}

/* Dark Mode Overrides for Core Surfaces & Text */
.dark .bg-white {
  background-color: var(--color-card-surface) !important;
}
.dark .bg-gray-50 {
  background-color: var(--color-card-elevated) !important;
}
.dark .bg-gray-100 {
  background-color: #192722 !important;
}
.dark .border-gray-100, .dark .border-gray-200, .dark .border-gray-300 {
  border-color: var(--color-card-border) !important;
}
.dark .border-brand-border {
  border-color: var(--color-card-border) !important;
}
.dark .text-gray-900, .dark .text-gray-800 {
  color: var(--color-text-primary) !important;
}
.dark .text-gray-700, .dark .text-gray-600 {
  color: #D1D5DB !important;
}
.dark .text-gray-500, .dark .text-gray-400 {
  color: var(--color-text-muted) !important;
}
.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--color-card-border) !important;
}
.dark input, .dark select, .dark textarea {
  background-color: #192722 !important;
  color: #ECFDF5 !important;
  border-color: var(--color-card-border) !important;
}
.dark input:focus, .dark select:focus, .dark textarea:focus {
  border-color: var(--color-primary-emerald) !important;
}

/* Modal and Drawer transitions */
.modal-backdrop {
  background-color: rgba(5, 10, 8, 0.7);
  backdrop-filter: blur(4px);
}

/* Mobile Bottom Navigation */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background-color: var(--color-card-surface);
    border-top: 1px solid var(--color-card-border);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
  }
}

/* Quick Action FAB on Mobile */
.mobile-fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background-color: var(--color-primary-emerald);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(15, 81, 61, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.dark .mobile-fab-btn {
  color: #0B1210;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}
.mobile-fab-btn:active {
  transform: scale(0.92);
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast-msg {
  pointer-events: auto;
  animation: slideInRight 0.25s ease-out;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Print Stylesheet for Invoices & Syirkah Slips */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-content, #printable-content * {
    visibility: visible;
  }
  #printable-content {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block !important;
  }
}

/* ==========================================================================
   INTERACTIVE ONBOARDING: TOOLTIPS & HOTSPOTS
   ========================================================================== */
.tour-highlighted-target {
  position: relative !important;
  z-index: 10002 !important;
  box-shadow: 0 0 0 3px #10B981, 0 0 25px rgba(16, 185, 129, 0.45) !important;
  outline: 2px solid #34D399 !important;
  border-radius: 0.5rem;
  transition: all 0.25s ease-in-out;
}

.tour-pulse-ring {
  animation: tourPulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes tourPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.tour-tooltip-enter {
  animation: tourTooltipPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tourTooltipPop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================================================
   GEMINI AI STUDIO COPILOT STYLES
   ========================================================================== */
.gemini-drawer-enter {
  animation: geminiSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes geminiSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gemini-bubble-ai {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.85) 0%, rgba(240, 249, 255, 0.85) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.dark .gemini-bubble-ai {
  background: linear-gradient(135deg, rgba(22, 37, 32, 0.9) 0%, rgba(15, 30, 38, 0.9) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.gemini-bubble-user {
  background: linear-gradient(135deg, #0F513D 0%, #166B51 100%);
  color: #ffffff;
}

.gemini-typing-dot {
  animation: geminiTyping 1.4s infinite ease-in-out both;
}

.gemini-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.gemini-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes geminiTyping {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.35;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================================
   ENTERPRISE AUTH & ONBOARDING CAROUSEL STYLES
   ========================================================================== */
.auth-input-group:focus-within {
  border-color: var(--color-primary-emerald) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

/* ==========================================================================
   SIDEBAR COLLAPSIBLE DYNAMICS (256px -> 72px)
   ========================================================================== */
#main-sidebar.collapsed {
  width: 72px !important;
}
#main-sidebar.collapsed .sidebar-label,
#main-sidebar.collapsed .sidebar-category-title,
#main-sidebar.collapsed .sidebar-user-info,
#main-sidebar.collapsed .sidebar-studio-title {
  display: none !important;
}
#main-sidebar.collapsed .nav-item {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
#main-sidebar.collapsed .sidebar-header-box {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
#main-sidebar.collapsed .sidebar-footer-box {
  justify-content: center !important;
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}

.onboarding-card-modal {
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.onboarding-slide-enter {
  animation: slideInSoft 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.quick-founder-pill {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.quick-founder-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px -1px rgba(15, 81, 61, 0.12);
}
.dark .quick-founder-pill:hover {
  box-shadow: 0 2px 8px -1px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   WCAG 2.1 AA ACCESSIBILITY & RESPONSIVE POLISH (Tahap 3 - ui-ux-pro-max)
   ========================================================================== */

/* 1. Global Keyboard Focus Indicator (WCAG 2.4.7 & 2.4.11) */
:focus-visible {
  outline: 2px solid var(--color-primary-emerald) !important;
  outline-offset: 2px !important;
}
.dark :focus-visible {
  outline-color: #10B981 !important;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* 2. Interactive Button Disabled & Loading States */
button:disabled,
button[disabled],
.btn-disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* 3. Mobile Table & Responsive Container Safety */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  max-width: 100%;
}

/* 4. Touch Target Minimum Size (WCAG 2.5.5 / 2.5.8) */
.touch-target-min {
  min-height: 44px;
  min-width: 44px;
}

/* 5. Safe Area Insets for Modern Mobile Devices (iOS Notch / Gesture Bar) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    height: calc(4rem + env(safe-area-inset-bottom));
  }
}
