/*
 * Menu icons in Apple's style: thin round lines, one colour.
 *
 * WHY. osTicket's menus show small coloured pictures from 2010 (GIF and
 * PNG files). Next to Apple's system font they look out of place. Here
 * each picture is hidden and a line icon is drawn instead, in the
 * colour of the link's words: grey normally, blue on the current page,
 * light in dark mode. Nothing to download: the icons are written below.
 *
 * Served on its own (ajax.php/ceritek-look/icons.css) and only linked
 * when the setting "Modern menu icons" is ticked (see lib/Theme.php).
 *
 * HOW IT WORKS.
 *   1. Each icon is a small SVG drawing kept in a variable on :root
 *      (--ck-icon-home, --ck-icon-book, ...). All are 24 x 24, lines
 *      1.8 wide with round ends, like Apple's SF Symbols.
 *   2. osTicket gives each menu link a class saying what it is (a.kb,
 *      a.teams, a.newTicket, ...). Each class picks its icon:
 *      --ck-icon: var(--ck-icon-book).
 *   3. One rule draws the icon in front of the link, in the place where
 *      the old picture was (10px from the left), as a "mask": the
 *      drawing cuts the shape out of a square painted in the words'
 *      colour (currentColor).
 *   A link whose class has no icon here keeps osTicket's own picture.
 */

/* --- 1. The drawings --------------------------------------------------- */

:root {
  --ck-icon-home: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z'/></svg>");
  --ck-icon-plus: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='4'/><path d='M12 8v8M8 12h8'/></svg>");
  --ck-icon-check: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='m8 12.5 2.7 2.7L16 9.8'/></svg>");
  --ck-icon-tray: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4h14l2 9v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z'/><path d='M3 13h5l1.5 3h5l1.5-3h5'/></svg>");
  --ck-icon-book: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4.5A1.5 1.5 0 0 1 6.5 3H19v14H6.5A1.5 1.5 0 0 0 5 18.5z'/><path d='M5 18.5A1.5 1.5 0 0 0 6.5 20H19'/></svg>");
  --ck-icon-folder: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/></svg>");
  --ck-icon-bubble: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1h-9l-5 4v-4H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z'/><path d='M7 9h10M7 13h6'/></svg>");
  --ck-icon-chart: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 21h18M6 17v-5M11 17V6M16 17v-8M21 17v-3'/></svg>");
  --ck-icon-clock: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M12 7v5l3 2'/></svg>");
  --ck-icon-person: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='4'/><path d='M4 21a8 8 0 0 1 16 0'/></svg>");
  --ck-icon-people: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='8' r='3.5'/><path d='M2.5 20a6.5 6.5 0 0 1 13 0'/><path d='M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14.2a6.5 6.5 0 0 1 3.5 5.8'/></svg>");
  --ck-icon-building: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16M16 9h2a2 2 0 0 1 2 2v10M2 21h20M8 7h4M8 11h4M8 15h4'/></svg>");
  --ck-icon-sliders: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0'/><circle cx='16' cy='6' r='2'/><circle cx='10' cy='12' r='2'/><circle cx='18' cy='18' r='2'/></svg>");
  --ck-icon-ticket: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v3a2 2 0 0 0 0 4v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a2 2 0 0 0 0-4z'/><path d='M15 6v12'/></svg>");
  --ck-icon-list: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M9 6h11M9 12h11M9 18h11'/><circle cx='4.5' cy='6' r='1'/><circle cx='4.5' cy='12' r='1'/><circle cx='4.5' cy='18' r='1'/></svg>");
  --ck-icon-question: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.6M12 17.2v.1'/></svg>");
  --ck-icon-filter: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6h16M7 12h10M10 18h4'/></svg>");
  --ck-icon-braces: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M8 4H7a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1M16 4h1a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-1'/></svg>");
  --ck-icon-doc: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 3h8l5 5v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/><path d='M14 3v5h5M8 13h8M8 17h6'/></svg>");
  --ck-icon-docs: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='8' y='3' width='12' height='15' rx='2'/><path d='M4 7v12a2 2 0 0 0 2 2h10'/></svg>");
  --ck-icon-form: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='6' rx='2'/><rect x='3' y='14' width='18' height='6' rx='2'/></svg>");
  --ck-icon-envelope: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='5' width='18' height='14' rx='2'/><path d='m3.5 6.5 8.5 6.5 8.5-6.5'/></svg>");
  --ck-icon-pulse: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12h4l2-5 4 10 2-5h6'/></svg>");
  --ck-icon-reply: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M9 14 4 9l5-5'/><path d='M4 9h10a6 6 0 0 1 6 6v4'/></svg>");
  --ck-icon-search: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-4-4'/></svg>");
  --ck-icon-bell: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 16v-5a6 6 0 0 1 12 0v5l2 2H4z'/><path d='M10 21a2 2 0 0 0 4 0'/></svg>");
  --ck-icon-lock: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='5' y='11' width='14' height='10' rx='2'/><path d='M8 11V8a4 4 0 0 1 8 0v3'/></svg>");
  --ck-icon-nosign: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='m5.6 5.6 12.8 12.8'/></svg>");
  --ck-icon-alert: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M12 7.5v5.5M12 16.5v.1'/></svg>");
}

/* --- 2. Which link gets which drawing ---------------------------------- */

/* Where the menu links are: staff tabs and their small menus, the bar
   under the tabs, the queue bar of the Tickets page, the portal menu. */
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.home { --ck-icon: var(--ck-icon-home); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.new, a.newTicket, a.newPremade, a.newapi, a.newsla, a.newEmail, a.newEmailTemplate, a.newTicketFilter, a.newuser, a.newgroup, a.newHelpTopic, a.newDepartment, a.newPage) { --ck-icon: var(--ck-icon-plus); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.status, a.closed, a.closedTickets) { --ck-icon: var(--ck-icon-check); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.tickets, a.Ticket, a.open, a.test) { --ck-icon: var(--ck-icon-tray); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.kb, a.kb-settings) { --ck-icon: var(--ck-icon-book); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.faq-categories { --ck-icon: var(--ck-icon-folder); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.canned, a.premade) { --ck-icon: var(--ck-icon-bubble); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.logs { --ck-icon: var(--ck-icon-chart); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.sla { --ck-icon: var(--ck-icon-clock); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.users, a.user, a.mine, a.assignedTickets) { --ck-icon: var(--ck-icon-person); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.teams, a.groups, a.staff) { --ck-icon: var(--ck-icon-people); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.departments { --ck-icon: var(--ck-icon-building); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.preferences, a.email-settings, a.userPref) { --ck-icon: var(--ck-icon-sliders); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.ticket-settings { --ck-icon: var(--ck-icon-ticket); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.lists { --ck-icon: var(--ck-icon-list); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.helpTopics { --ck-icon: var(--ck-icon-question); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.ticketFilters, a.emailFilters) { --ck-icon: var(--ck-icon-filter); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.api { --ck-icon: var(--ck-icon-braces); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.pages { --ck-icon: var(--ck-icon-doc); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.emailTemplates { --ck-icon: var(--ck-icon-docs); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.forms { --ck-icon: var(--ck-icon-form); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.emailSettings, a.emails) { --ck-icon: var(--ck-icon-envelope); }
/* osTicket gives "Banlist" and "Diagnostic" the same class. */
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.emailDiagnostic { --ck-icon: var(--ck-icon-pulse); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.answered, a.answeredTickets, a.email-autoresponders) { --ck-icon: var(--ck-icon-reply); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.search { --ck-icon: var(--ck-icon-search); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.alert-settings { --ck-icon: var(--ck-icon-bell); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.userPasswd { --ck-icon: var(--ck-icon-lock); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.banList { --ck-icon: var(--ck-icon-nosign); }
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) a.overdueTickets { --ck-icon: var(--ck-icon-alert); }

/* --- 3. Drawing the icon ----------------------------------------------- */

/* The links that can carry an icon. */
#nav li a,
#sub_nav > li > a,
#customQ_nav li.item > a,
.jb-overflowmenu-menu-secondary li.item > a {
  position: relative;
}

/*
 * The icon: a 16px square in the words' colour, cut to the drawing.
 * A link with no --ck-icon gets an empty mask, so nothing shows.
 */
#nav li a::before,
#sub_nav > li > a::before,
#customQ_nav li.item > a::before,
.jb-overflowmenu-menu-secondary li.item > a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background-color: currentColor;
  -webkit-mask: var(--ck-icon, linear-gradient(transparent, transparent)) center / contain no-repeat;
  mask: var(--ck-icon, linear-gradient(transparent, transparent)) center / contain no-repeat;
  pointer-events: none;
}

/* Right-to-left languages: the icon sits on the right. */
.rtl #nav li a::before,
.rtl #sub_nav > li > a::before,
.rtl #customQ_nav li.item > a::before {
  left: auto;
  right: 10px;
}

/* --- 4. Hiding the old pictures ---------------------------------------- */

/* Only on links that got an icon above (they all set --ck-icon). !important:
   osTicket's portal rule names the link more precisely than this file can
   without repeating every class. */
:is(#nav, #sub_nav, #customQ_nav, .jb-overflowmenu-menu-secondary) :is(a.home, a.new, a.newTicket, a.newPremade, a.newapi, a.newsla, a.newEmail, a.newEmailTemplate, a.newTicketFilter, a.newuser, a.newgroup, a.newHelpTopic, a.newDepartment, a.newPage, a.status, a.closed, a.closedTickets, a.tickets, a.Ticket, a.open, a.test, a.kb, a.kb-settings, a.faq-categories, a.canned, a.premade, a.logs, a.sla, a.users, a.user, a.mine, a.assignedTickets, a.teams, a.groups, a.staff, a.departments, a.preferences, a.email-settings, a.userPref, a.ticket-settings, a.lists, a.helpTopics, a.ticketFilters, a.emailFilters, a.api, a.pages, a.emailTemplates, a.forms, a.emailSettings, a.emails, a.emailDiagnostic, a.answered, a.answeredTickets, a.email-autoresponders, a.search, a.alert-settings, a.userPasswd, a.banList, a.overdueTickets) {
  background-image: none !important;
}

