/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Import the library styles */
/* Org Chart Tree Lines */
/* ORG TREE STYLES */
/* Ensure the container has no default padding that messes up alignment */
.org-tree,
.org-tree ul {
  padding-left: 20px;
  /* Indent each level */
  list-style-type: none;
}

/* Position context for the lines */
.org-tree li {
  position: relative;
  padding-left: 20px;
  /* Space for the horizontal line */
  margin-bottom: 0;
}

.org-tree li>ul {
  padding-top: 10px;
  position: relative;
  /* Establishes a valid anchor for the 'Stem' */
}

/* The Vertical Line (Tree Trunk) */
/* Connects this item to the one below it */
.org-tree ul li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-left: 2px solid #e5e7eb;
  /* tailwind gray-200 */
}

/* The Horizontal Line (Branch) */
/* Connects the trunk to the card */
.org-tree li::after {
  content: '';
  position: absolute;
  top: 24px;
  /* Center of a 48px avatar (h-12) */
  left: 0;
  width: 20px;
  border-top: 2px solid #e5e7eb;
  /* tailwind gray-200 */
}

.org-tree li>ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  /* Aligns with the padding-left of the list */
  width: 0;
  height: 10px;
  /* Matches the padding-top exactly */
  border-left: 2px solid #e5e7eb;
  /* Matches your tailwind gray-200 */
}

/* FIX: Don't draw the vertical line past the last child */
.org-tree ul>li:last-child::before {
  height: 25px;
  /* Stop exactly at the branch */
}


/* ========================================================== */
/* TIPTAP EDITOR STYLES: Overriding Tailwind's Preflight      */
/* ========================================================== */

/* Base Editor spacing */
.ProseMirror>*+* {
  margin-top: 0.75em;
}

/* Headings */
.ProseMirror h1 {
  font-size: 2rem !important;
  font-weight: 800 !important;
  margin-top: 1.5rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.2 !important;
  color: #111827 !important;
  /* gray-900 */
}

.ProseMirror h2 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  margin-top: 1.5rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.3 !important;
  color: #1f2937 !important;
  /* gray-800 */
}

.ProseMirror h3 {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  margin-top: 1rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.4 !important;
  color: #374151 !important;
  /* gray-700 */
}

/* Lists */
.ProseMirror ul {
  list-style-type: disc !important;
  padding-left: 1.5rem !important;
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
}

.ProseMirror ol {
  list-style-type: decimal !important;
  padding-left: 1.5rem !important;
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
}

.ProseMirror li p {
  margin-top: 0.25em !important;
  margin-bottom: 0.25em !important;
}

/* Blockquotes */
.ProseMirror blockquote {
  border-left: 4px solid #e5e7eb !important;
  /* gray-200 */
  padding: 0.5rem 1rem !important;
  margin: 1.5rem 0 !important;
  font-style: italic !important;
  color: #4b5563 !important;
  /* gray-600 */
  background-color: #f9fafb !important;
  /* gray-50 */
  border-radius: 0 0.25rem 0.25rem 0 !important;
}

/* Horizontal Rule */
.ProseMirror hr {
  border: none !important;
  border-top: 2px solid #e5e7eb !important;
  margin: 2rem 0 !important;
}

/* 1. Force the original <select> to actually hide, overriding any framework CSS */
select.ts-hidden-accessible {
    border: 0 !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    white-space: nowrap !important;
}

.ts-wrapper.select {
    position: relative;
}

/* 2. Hide Tom Select's default CSS caret */
.ts-wrapper.select.single .ts-control::after {
    display: none !important;
}

/* 3. Recreate the Metronic styling on the main Tom Select control box */
.ts-wrapper.select .ts-control {
    appearance: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;

    /* Sizing & Spacing */
    min-height: 34px;
    padding: 0 1.5rem 0 0.75rem;
    gap: 8px;

    /* Typography */
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: #475569;

    /* Background & Arrow */
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%239f9fa9' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 14px 11px;

    /* Borders & Shadows */
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

    cursor: pointer;
    transition: color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* 4. Focus State for the control box */
.ts-wrapper.select.focus .ts-control {
    border-color: #b5b5c3;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 0 0 2px rgba(181, 181, 195, 0.2);
}

/* 5. Fix the internal text input so it inherits styles seamlessly */
.ts-wrapper.select .ts-control > input {
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    outline: none;
}

/* 6. Style the dropdown menu container (The backing) */
.ts-wrapper.select .ts-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 105; /* Ensures it floats above other form elements */
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    margin-top: 4px; /* Slight gap between input and dropdown */
    overflow: hidden;
}

/* 7. Style the individual options inside the dropdown */
.ts-wrapper.select .ts-dropdown .option {
    padding: 8px 12px;
    font-size: 0.8125rem;
    color: #475569;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* 8. Hover and Active/Selected states for options */
.ts-wrapper.select .ts-dropdown .option:hover,
.ts-wrapper.select .ts-dropdown .option.active {
    background-color: #f1f5f9; /* A light grey hover effect */
    color: #0f172a; /* Darker text on hover */
}

/* Constrain the dropdown height and force a vertical scrollbar */
.ts-wrapper.select .ts-dropdown-content {
    max-height: 250px; /* Adjust this to fit your UI needs */
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Optional: Style the scrollbar to match the clean Metronic look */
.ts-wrapper.select .ts-dropdown-content::-webkit-scrollbar {
    width: 6px;
}
.ts-wrapper.select .ts-dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}
.ts-wrapper.select .ts-dropdown-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.ts-wrapper.select .ts-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
