@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Kanit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --font-main: 'Prompt', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Kanit', 'Prompt', sans-serif;
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
}

body {
  font-family: var(--font-main);
  background-color: #f8fafc;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Tree Chart Hierarchy Styling */
.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
  padding: 2rem 1rem;
}

.tree-node-card {
  transition: all 0.25s ease-in-out;
}
.tree-node-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.12), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
}

/* Branch connectors for tree */
.tree-branch {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.tree-branch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid #cbd5e1;
  height: 24px;
  transform: translateX(-50%);
}

.tree-children {
  display: flex;
  justify-content: center;
  position: relative;
  padding-top: 24px;
  gap: 1.5rem;
}

.tree-children::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid #cbd5e1;
  height: 24px;
  transform: translateX(-50%);
}

.tree-child-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tree-child-item::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 24px;
  border-top: 2px solid #cbd5e1;
}

.tree-child-item:first-child::before {
  left: 50%;
}

.tree-child-item:last-child::before {
  right: 50%;
}

.tree-child-item:only-child::before {
  display: none;
}

.tree-child-item::after {
  content: '';
  position: absolute;
  top: -24px;
  left: 50%;
  border-left: 2px solid #cbd5e1;
  height: 24px;
  transform: translateX(-50%);
}

/* Drag & Drop ghost & chosen styles */
.sortable-ghost {
  opacity: 0.4;
  border: 2px dashed #3b82f6 !important;
  background-color: #eff6ff !important;
}

.sortable-chosen {
  box-shadow: 0 15px 30px rgba(0,0,0,0.15) !important;
}

/* Animation utilities */
.animate-fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
  }

  .no-print, nav, header, .action-bar, .modal, .toast-container, button:not(.print-keep) {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .page-break {
    page-break-before: always;
  }

  .tree-container, .group-board {
    overflow: visible !important;
    padding: 0 !important;
  }

  .card, .tree-node-card {
    box-shadow: none !important;
    border: 1px solid #94a3b8 !important;
    break-inside: avoid;
  }

  @page {
    size: A4 landscape;
    margin: 1cm;
  }
}
