@import url('./variables.css');
@import url('./components.css');

/* ==========================================================================
   Mobile Zero-Wobble Viewport Lockdown
   Prevents entire page / tabs from scrolling or rubber-banding horizontally
   ========================================================================== */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

#mobile-nav {
  overscroll-behavior-x: contain;
  max-width: 100vw;
  width: 100%;
}

/* Strict Responsive Navbar Isolation: Never show desktop nav on mobile or mobile nav on desktop */
@media (max-width: 767px) {
  #desktop-nav {
    display: none !important;
  }
  button, input, select, .tab-pill, .header-action-btn {
    min-height: 38px;
  }
}

@media (min-width: 768px) {
  #mobile-nav {
    display: none !important;
  }
}

/* 24/7 Cloud Sync & Offline Status Badge */
.cloud-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.cloud-sync-badge.offline {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.cloud-sync-badge .dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: pulse-dot 2s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}


/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-pitch);
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-bold);
}

/* Schedule Matrix Table & Ergonomic Scrollbar */
.schedule-scroll-box {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.6) rgba(0, 0, 0, 0.2);
}
.schedule-scroll-box::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.schedule-scroll-box::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}
.schedule-scroll-box::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.schedule-scroll-box::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.9);
  background-clip: content-box;
}

/* Schedule Cell Highlighting */
.shift-cell {
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}
.shift-cell:hover {
  filter: brightness(1.25);
  outline: 2px solid var(--accent-white);
  z-index: 10;
}

/* Subtle Engineering Patterns (Anti-Slop Modern Texture) */
.bg-dot-pattern {
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 20px 20px;
}
.bg-grid-pattern {
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Tactile Micro-Interactions (150ms Responsive Feedback) */
.btn-press,
.btn-primary,
.btn-secondary,
.tab-pill,
.app-chip {
  transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-press:active,
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.97);
}

/* Focus Ring (Anti-Excel Harsh Border) */
.focus-ring:focus,
.app-input:focus,
.app-input-box:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
  border-color: #10b981;
}

/* Modern Skeleton Shimmer */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-pulse {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s infinite ease-in-out;
  border-radius: 0.5rem;
}

/* Modern Custom Select Styling (Anti-Excel Dropdown) */
select.app-input-box,
select.app-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.875rem;
  padding-right: 2.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
select.app-input-box:hover,
select.app-input:hover {
  border-color: rgba(16, 185, 129, 0.4);
}
select.app-input-box option,
select.app-input option {
  background-color: #18181b;
  color: #f4f4f5;
  padding: 0.5rem 0.75rem;
}

/* ==========================================================================
   Universal Modal Stacking & Z-Index Guard
   Prevents sticky table headers/columns & navbar from piercing through modals
   ========================================================================== */
#modal-manual-book,
#modal-pwa-install,
#modal-user-select,
#modal-request-ghk,
#modal-add-event,
.app-modal-layer {
  z-index: 99995 !important;
}

#toast {
  z-index: 99999 !important;
}

/* ==========================================================================
   Notebook AI Ops Dedicated Workspace Grid
   Immune to tailwind purging; guarantees flawless 3-column desktop layout
   and seamless mobile vertical stack.
   ========================================================================== */
.notebook-workspace-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .notebook-workspace-grid {
    display: grid !important;
    grid-template-columns: 310px minmax(0, 1fr) 310px !important;
    gap: 1.5rem !important;
    align-items: start !important;
    width: 100% !important;
  }
}

@media (min-width: 1440px) {
  .notebook-workspace-grid {
    grid-template-columns: 340px minmax(0, 1fr) 340px !important;
    gap: 1.75rem !important;
  }
}

.notebook-col-sources,
.notebook-col-chat,
.notebook-col-studio {
  width: 100%;
  min-width: 0; /* Prevents flex/grid blowouts */
}

/* ==========================================================================
   Engineering CAD / Industrial Line Grid Backdrop (High Performance)
   Crisp, prominent mathematical drafting lines (cukup tegas terlihat)
   Zero image payload, instant 60fps rendering
   ========================================================================== */
.app-cyber-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #09090b;
  background-image: 
    /* Minor 24px grid lines */
    linear-gradient(to right, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    /* Major 120px grid lines with industrial emerald accent */
    linear-gradient(to right, rgba(16, 185, 129, 0.22) 1.5px, transparent 1.5px),
    linear-gradient(to bottom, rgba(16, 185, 129, 0.22) 1.5px, transparent 1.5px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  background-position: 0 0;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

/* ==========================================================================
   Translucent Cyber Glassmorphism Surface
   Allows background telemetry & cleanroom textures to shine subtly through cards
   ========================================================================== */
.dark .app-card,
:root .app-card {
  background-color: rgba(9, 9, 11, 0.72) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45) !important;
}

html:not(.dark) .app-card {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid #e4e4e7 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .app-cyber-bg {
  background-color: #f8fafc;
  background-image: 
    /* Minor 24px grid lines */
    linear-gradient(to right, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    /* Major 120px grid lines with crisp drafting blue/emerald accent */
    linear-gradient(to right, rgba(16, 185, 129, 0.26) 1.5px, transparent 1.5px),
    linear-gradient(to bottom, rgba(16, 185, 129, 0.26) 1.5px, transparent 1.5px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  opacity: 1;
}

/* ==========================================================================
   Compact Navbar & Header Pills (1:1 Exact Inversion & Anti-Wrap)
   ========================================================================== */
.dark .app-header,
:root .app-header {
  background-color: rgba(9, 9, 11, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

html:not(.dark) .app-header {
  background-color: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid #e4e4e7 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

.app-pill-container {
  border-radius: 9999px;
  padding: 0.18rem !important;
  gap: 0.18rem !important;
  align-items: center;
  flex-wrap: nowrap;
}

.dark .app-pill-container,
:root .app-pill-container {
  background-color: rgba(17, 17, 21, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html:not(.dark) .app-pill-container {
  background-color: #f4f4f5 !important;
  border: 1px solid #e4e4e7 !important;
}

.tab-pill {
  white-space: nowrap !important;
  padding: 0.26rem 0.62rem !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  gap: 0.35rem !important;
  border-radius: 9999px !important;
  line-height: 1.15 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  user-select: none !important;
  transition: all 0.15s ease !important;
}

.tab-pill i,
.tab-pill svg {
  width: 13px !important;
  height: 13px !important;
  flex-shrink: 0 !important;
}

.dark .tab-pill,
:root .tab-pill {
  color: #a1a1aa !important;
}
.dark .tab-pill:hover,
:root .tab-pill:hover {
  color: #ffffff !important;
}

html:not(.dark) .tab-pill {
  color: #52525b !important;
}
html:not(.dark) .tab-pill:hover {
  color: #09090b !important;
  background-color: rgba(0, 0, 0, 0.04) !important;
}

.dark .tab-pill.active,
:root .tab-pill.active {
  background-color: #ffffff !important;
  color: #000000 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35) !important;
}

html:not(.dark) .tab-pill.active {
  background-color: #000000 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18) !important;
}

html:not(.dark) .subtab-pill.active {
  background-color: #000000 !important;
  color: #ffffff !important;
}

.header-action-btn {
  white-space: nowrap !important;
  padding: 0.26rem 0.65rem !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  line-height: 1.15 !important;
  flex-shrink: 0 !important;
}

/* ==========================================================================
   Dashboard Telemetry HUD Banner (Light & Dark)
   ========================================================================== */
.dashboard-hud-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(9, 9, 11, 0.95) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

html:not(.dark) .dashboard-hud-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

.dashboard-hud-title {
  color: #f4f4f5 !important;
}
html:not(.dark) .dashboard-hud-title {
  color: #09090b !important;
}

.dashboard-hud-sub {
  color: #a1a1aa !important;
}
html:not(.dark) .dashboard-hud-sub {
  color: #64748b !important;
}

.dashboard-hud-badge {
  background: rgba(24, 24, 27, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html:not(.dark) .dashboard-hud-badge {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .dashboard-hud-badge-label {
  color: #64748b !important;
}

/* ==========================================================================
   Dashboard KPI Summary Cards & Responsive Grid
   Immune to Tailwind purging. Guarantees 2 cols mobile, 3 cols tablet, 6 cols desktop.
   ========================================================================== */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 768px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
  }
}

@media (min-width: 1200px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
  }
}

.dashboard-kpi-card {
  position: relative;
  border-radius: 1rem;
  padding: 1.1rem 1.15rem !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.dark .dashboard-kpi-card,
:root .dashboard-kpi-card {
  background-color: rgba(14, 16, 22, 0.75) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.25);
}

.dark .dashboard-kpi-card:hover,
:root .dashboard-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4);
}

html:not(.dark) .dashboard-kpi-card {
  background-color: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #e4e4e7 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .dashboard-kpi-card:hover {
  transform: translateY(-2px);
  border-color: #10b981 !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08) !important;
}

.dashboard-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dashboard-kpi-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  line-height: 1.2;
}

html:not(.dark) .dashboard-kpi-title {
  color: #52525b !important;
}

.dashboard-kpi-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dashboard-kpi-val {
  font-size: 1.45rem;
  line-height: 1.8rem;
  font-weight: 900;
  font-family: var(--font-mono, monospace);
  color: var(--text-main);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html:not(.dark) .dashboard-kpi-val {
  color: #09090b !important;
}

.dashboard-kpi-sub {
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html:not(.dark) .dashboard-kpi-sub {
  color: #71717a !important;
}

/* ==========================================================================
   Equipment Documentation Cards (Tab Data Mesin - Dark & Light Mode)
   ========================================================================== */
.equipment-doc-card {
  background-color: rgba(15, 23, 42, 0.6) !important;
  border-color: rgba(51, 65, 85, 0.7) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.equipment-doc-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.45) !important;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5) !important;
}

.equipment-doc-title {
  color: #e2e8f0;
}

.equipment-doc-desc {
  color: #94a3b8;
}

.equipment-doc-meta {
  color: #64748b;
}

html:not(.dark) .equipment-doc-card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .equipment-doc-card:hover {
  border-color: #10b981 !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08) !important;
}

html:not(.dark) .equipment-doc-title {
  color: #0f172a !important;
}

html:not(.dark) .equipment-doc-desc {
  color: #475569 !important;
}

html:not(.dark) .equipment-doc-meta {
  color: #64748b !important;
}

/* ==========================================================================
   Subtab Pills & History Audit Trail (Light Mode Polish)
   ========================================================================== */
html:not(.dark) .subtab-pill {
  color: #64748b !important;
  background-color: transparent !important;
}

html:not(.dark) .subtab-pill:hover {
  color: #0f172a !important;
}

html:not(.dark) .subtab-pill.active {
  background-color: #000000 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}



