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

:root {
  --primary-navy: #0f172a;
  --primary-blue: #0284c7;
  --accent-cyan: #06b6d4;
  --success-green: #10b981;
  --warning-amber: #f59e0b;
  --danger-red: #ef4444;
  --bg-slate: #f8fafc;
  --card-border: #e2e8f0;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Cairo', sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

[dir="rtl"], [dir="auto"]:lang(ar) {
  font-family: 'Cairo', 'Inter', -apple-system, sans-serif;
}

.font-mono-nums {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* High density table styles */
.dense-table th {
  padding: 0.5rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}
.dense-table td {
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  border-bottom: 1px solid #e2e8f0;
}
.dense-table tr:hover {
  background-color: #f8fafc;
}

/* Tab Active Styles */
.nav-tab.active {
  background-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

/* Status Badges */
.badge-active {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.badge-collected {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.badge-urgent {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.badge-warning {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Matrix Table Specific Highlight */
.matrix-row-inflow {
  background-color: #f0fdf4 !important;
  font-weight: 600;
}
.matrix-row-outflow {
  background-color: #fef2f2 !important;
  font-weight: 600;
}
.matrix-row-net {
  background-color: #e0f2fe !important;
  font-weight: 700;
}
.matrix-row-buffer {
  background-color: #f8fafc !important;
  font-weight: 700;
}

/* Animation utilities */
@keyframes pulseSubtle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}
.animate-pulse-subtle {
  animation: pulseSubtle 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Kanban Drag and Drop Styles */
.kanban-card {
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.98) rotate(1deg);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
}
.kanban-drop-zone {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.kanban-drop-zone.drag-over {
  background-color: #e0f2fe !important;
  border: 2px dashed #0284c7 !important;
  border-radius: 0.75rem;
}

/* ================= FINTECH COLLAPSIBLE SIDEBAR ================= */
#app-sidebar {
  width: 15rem;
  min-width: 15rem;
  max-width: 15rem;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1024px) {
  #app-sidebar {
    position: static !important;
  }
}

@media (max-width: 1023px) {
  #app-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 50 !important;
    width: 16rem !important;
    max-width: 80vw !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5) !important;
  }
}

#app-sidebar.sidebar-collapsed {
  width: 4.25rem !important;
  min-width: 4.25rem !important;
  max-width: 4.25rem !important;
}
#app-sidebar.sidebar-collapsed .sidebar-item-label,
#app-sidebar.sidebar-collapsed .sidebar-brand-text,
#app-sidebar.sidebar-collapsed .sidebar-group-title,
#app-sidebar.sidebar-collapsed .sidebar-user-info,
#app-sidebar.sidebar-collapsed .sidebar-badge {
  display: none !important;
}
#app-sidebar.sidebar-collapsed .nav-tab {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
#app-sidebar.sidebar-collapsed .nav-tab i {
  margin: 0 auto !important;
  font-size: 1.15rem !important;
}

/* ================= SLIDE-OVER DETAIL DRAWER & AI ADVISOR ================= */
#drawer-claim-detail {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}
#drawer-claim-detail.translate-x-full {
  visibility: hidden !important;
  pointer-events: none !important;
}
#drawer-claim-detail:not(.translate-x-full) {
  visibility: visible !important;
  pointer-events: auto !important;
}

#ai-chat-drawer {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}
#ai-chat-drawer.translate-x-full {
  visibility: hidden !important;
  pointer-events: none !important;
}
#ai-chat-drawer:not(.translate-x-full) {
  visibility: visible !important;
  pointer-events: auto !important;
}

@media (max-width: 1023px) {
  #app-sidebar.-translate-x-full {
    visibility: hidden !important;
    pointer-events: none !important;
  }
  #app-sidebar:not(.-translate-x-full) {
    visibility: visible !important;
    pointer-events: auto !important;
  }
}

#drawer-claim-detail-backdrop {
  transition: opacity 0.25s ease-out;
}
.drawer-tab-btn.active {
  border-bottom-color: #4f46e5 !important;
  color: #4f46e5 !important;
  font-weight: 700 !important;
}

/* Tabular numbers for clean financial alignment */
.tabular-nums {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* Line clamp utility for Kanban cards and headers */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Master Top Navigation Buttons */
.top-nav-btn {
  transition: all 0.15s ease-in-out;
}
.top-nav-btn.active {
  background-color: #f1f5f9;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Bidirectional Text Isolation */
.bidi-isolate {
  unicode-bidi: isolate;
  direction: auto;
}

/* ================= PRINT MEDIA UTILITIES ================= */
@media print {
  body {
    background: transparent !important;
    color: #0f172a !important;
  }
  .no-print,
  #app-sidebar,
  header,
  .print-bar,
  #modal-new-po {
    display: none !important;
  }
}

/* ================= MOBILE RESPONSIVE & TOUCH OPTIMIZATIONS ================= */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

.safe-area-bottom {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

.safe-area-top {
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
}

/* Smooth momentum scrolling on mobile touch screens */
.overflow-x-auto,
.overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

/* Touch target floor for mobile buttons and inputs (44px min tap area on coarse pointer) */
@media (pointer: coarse) {
  button, 
  .nav-tab, 
  .top-nav-btn,
  a[role="button"] {
    min-height: 44px;
  }

  .dense-table th,
  .dense-table td {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
}

/* Modal responsive constraints for small screens */
@media (max-width: 640px) {
  .modal-responsive-card {
    max-height: 94vh !important;
    width: 100% !important;
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
    border-radius: 1rem !important;
  }
}

/* ================= STRICT HORIZONTAL OVERFLOW LOCKDOWN ================= */
/* Prevents mobile viewport from sliding or bouncing horizontally and exposing white gutters */
html {
  overflow-x: hidden !important;
  overflow-x: clip !important;
  max-width: 100vw !important;
  overscroll-behavior-x: none !important;
}

body {
  overflow-x: hidden !important;
  overflow-x: clip !important;
  max-width: 100vw !important;
  width: 100% !important;
  position: relative !important;
  overscroll-behavior-x: none !important;
}

#main-content-column {
  overflow-x: hidden !important;
  overflow-x: clip !important;
  max-width: 100vw !important;
  width: 100% !important;
}

/* Ensure individual horizontal scroll containers stay bounded within their cards */
.overflow-x-auto {
  max-width: 100% !important;
  overscroll-behavior-x: contain !important;
  -webkit-overflow-scrolling: touch !important;
}



