@_segmentselector-default-space: 8px;
@_segmentselector-dropdown_padding: @_segmentselector-default-space;
@_segmentselector-action-size: 18px;
@_segmentselector-button-height: 36px;
@_segmentselector-full-width-button-width: ~'calc(100% - 16px)';

/* ADDITIONAL STYLES */
.youMustBeLoggedIn {
    display: block;
    font-size: 12px;
    padding: @_segmentselector-dropdown_padding;
    line-height: 14px;

}

.searchFound {
    border: 0 solid red;
}

.others {
    border: 0 solid green;
}

.clear {
    clear: both;
}

.segment-row-inputs {
    margin-bottom: 5px;

    @media screen and (max-width: 749px) {
        width: 100%;
        display: block;
    }
}

.hovered {
    border-radius: 4px;
    border: 2px dashed #a0a0a0 !important;
    padding: 0;
}

.metricListBlock {
    border-radius: 4px;
    width: 292px;
    margin-right: 11px;
    border: 2px dashed #EFEFEB;
}

.metricListBlock > select {
    margin: 0 !important;
    width: 98% !important;
    margin-left: 2px !important;
}

.metricMatchBlock {
    margin-right: 11px;
}

.metricValueBlock {
    width: 60%;
}

div.scrollable {
    height: 100%;
    overflow: hidden;
    overflow-y: auto;
}

.no_results {
    margin: 0;
    position: relative;

    a {
        cursor: default;
    }
}

.segment-element {
    position: absolute;
    z-index: 999;
    top: 100%;
    left: -1px;
    margin-top: 8px;

    width: 940px;
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid @theme-color-border;
    background-color: @theme-color-background-contrast;
    box-shadow: @theme-shadow-overlay;

    color: @theme-color-text;

    @media screen and (max-width: 940px) {
        width: 95vw;
        padding: 1em;
    }
}

.segment-element .custom_select_search {
    width: 146px;
    background: url(plugins/SegmentEditor/images/bg-segment-search.png) 0 10px no-repeat;
    padding: 10px 0 0 0;
    margin: 0 0 10px 15px;
    position: relative;
    height: 32px;
}

.segment-element .custom_select_search input[type="text"] {
    font-size: 11px !important;
    color: @theme-color-text !important;
    width: 125px;
    padding: 0 0 3px 7px !important;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
}

.segment-element .custom_select_search a {
    position: absolute;
    width: 13px;
    height: 13px;
    right: 5px;
    top: 14px;
    background: url(plugins/SegmentEditor/images/reset_search.png);
}

.segment-element .segment-content {
    min-height: 300px;
    padding: 0 0 20px 0;
}

.segment-element .segment-content h3 {
    font-size: 16px;
    font-weight: bold;
    color: @theme-color-text;
    margin: 0 0 0 0;
    text-shadow: 0 1px 0 @theme-color-background-contrast;
}

.segment-element .segment-content h3 a {
    font-size: 11px;
    text-decoration: none;
    margin: -1px 0 0 0;
}

.segment-element input.edit_segment_name[type=text]:not(.browser-default) {
    width: 200px;
}

.segment-element .segment-top {
    font-size: 11px;
    color: @theme-color-text-light;
    text-align: left;
    padding: 3px 7px 0 0;
    margin-left: 6px;

    > * {
        vertical-align: top;
    }

}

.segment-element .segment-top .segment-hidden {
    display: none;
}

.segment-element .segment-top .segment-top-item {
    display: inline;
    white-space: nowrap;

    @media screen and (max-width: 749px) {
        display: block;
    }
}

.grid-1, .grid-2 {
    width: 26%;
}

.grid-3 {
    width: 46%;
}

.segment-element .segment-top a {
    text-decoration: none;
}

.segment-element .segment-footer {
    border-top: 1px solid @theme-color-border-light;
    text-align: right;
    padding: 7px 10px;
    margin: 0 -4px -6px -4px;
}

.segment-element .segment-footer a.delete {
    color: @color-red-matomo !important;
}

.segment-element .segment-footer a {
    font-size: 14px;
    color: @theme-color-link !important;
    margin: 0 5px;
    text-decoration: none;
}

.segment-element .segment-footer button {
    margin: 0 0 0 15px;
}

.segmentEditorPanel .segmentListContainer {
    flex: auto;
    line-height: 14px;
}

.top_controls .segmentEditorPanel {
    position: absolute;
}

.segmentationContainer > span > strong {
    color: #255792;
}

.segmentationContainer .submenu {
    font-size: 14px;
    min-width: 206px;
}

.segmentationContainer hr {
  margin: 10px 0;
}

.segmentationContainer .submenu ul {
    display: flex;
    flex-direction: column;
    color: @theme-color-text-lighter;
    float: none;
    font-size: 14px;
    font-weight: normal;
    line-height: 20px;
    list-style: none outside none;
    margin-right: 0;
    padding-top: 8px;
}
.segment-visits-label {
  height: 20px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
}
.segment-visits-label,
.segmentsSharedWithMeBySuperUser,
.segmentsVisibleToSuperUser {
  padding: 0 @_segmentselector-dropdown_padding;
  font-size: 14px;
  font-weight: bold;
  color: @theme-color-text;
}

.segmentationContainer .submenu ul li {
    padding: 2px @_segmentselector-dropdown_padding;
    margin: 3px 0 0 0;
    cursor: pointer;
    order: 2;
    height: 32px;
    border-radius: @_selector-dropdown_border-radius;
}

.segmentationContainer .submenu ul li[data-idsegment=""] {
    order: 0;
}

.segmentationContainer .submenu ul li.segmentStarred {
    order: 1;
}

.segmentationContainer .submenu ul li.comparedSegment {
  font-weight: bold;
}

.segmentationContainer .submenu ul li:hover {
    color: #255792;
    background: @theme-color-background-tinyContrast;
    outline: none;

    > * {
        outline: none;
    }
}

.segmentationContainer ul.submenu {
    padding-top: 5px;
    display: none;
    margin-bottom: 5px;
}

@keyframes starAnimation {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
  100% { transform: scale(1) rotate(360deg); }
}

@keyframes starAnimationPath {
  0% { fill: black; }
  50% { fill: @theme-color-brand; stroke: @theme-color-brand; }
  100% { fill: black; }
}

@keyframes unstarAnimation {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(-180deg);}
  100% { transform: scale(1) rotate(-360deg); }
}

@keyframes unstarAnimationPath {
  0% { fill: black; }
  100% { fill: transparent; }
}

@keyframes starErrorAnimation {
  0% { opacity: 0.5; }
  5%, 15%, 25%, 35%, 45% { transform: translate(-2px)}
  10%, 20%, 30%, 40% { transform: translate(2px)}
  50% { opacity: 1; }
  100% { transform: translate(0); opacity: 0.5; }
}

@keyframes starErrorAnimationPath {
  0% { stroke: black; fill: black; }
  25%, 75% { stroke: red; fill: red; }
  100% { stroke: black; fill: transparent; }
}

.segmentAction--placeholder {
  visibility: hidden;
  pointer-events: none;
}

.segmentAction {
  flex: none;
  display: flex;
  width: @_segmentselector-action-size;
  height: @_segmentselector-action-size;

  // Button reset
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;

  font-weight: normal;
  text-align: center;
  opacity: 0.5;
  filter: @theme-filter-on-illustration;

  &:hover {
    opacity: 1;
  }

  &:focus {
    background-color: transparent;
  }

  &[data-state=disabled] {
    opacity: 0.2;
    cursor: not-allowed;
  }
}

.editSegment {
    background: url(plugins/SegmentEditor/images/edit_segment.svg) no-repeat;
    background-size: cover;
    order: 3;
}

.starSegment {
    order: 2;
    color: @theme-color-text-lighter;
}

.starSegment + .compareSegment,
.compareSegment + .editSegment {
    margin-left: 8px;
}

.segmentStarAnimation .starSegment {
  animation: unstarAnimation 0.5s 1;
}

.segmentStarAnimation .starSegment path {
  animation: unstarAnimationPath 0.5s 1;
}

.segmentStarred.segmentStarAnimation .starSegment {
  animation-name: starAnimation;
}

.segmentStarred.segmentStarAnimation .starSegment path {
  animation-name: starAnimationPath;
}

.segmentStarErrorAnimation .starSegment {
  animation: starErrorAnimation 2s 1;
}

.segmentStarErrorAnimation .starSegment path {
  animation: starErrorAnimationPath 2s 1;
}

.segmentStarred.segmentStarErrorAnimation .starSegment path {
  animation-direction: reverse;
}

/* We do not want filled & transparent stars, design wanted by Matthieu */
.segmentStarred .starSegment[data-state=disabled] {
  opacity: 0.5;
}

.segmentStarred .starSegment path {
    fill: currentColor;
}

.entityTable .segmentStarred .entityTable_StarCell .starSegment path {
    fill: black;
}

.compareSegment {
    order: 2;
    color: @theme-color-text-lighter;
    align-items: center;
    justify-content: center;

    svg {
      display: block;
      width: @_segmentselector-action-size;
      height: @_segmentselector-action-size;
    }

    &.isAnonymous {
        margin-left: 22px;
    }
}

.comparisonsDisabled  .compareSegment {
  display: none;
}

.segmentEditorPanel.expanded .segmentationContainer {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;

    .dropdown-body {
        min-width: 337px;
        padding: @_segmentselector-dropdown_padding;
    }

    @media screen and (max-width: 600px) {
        .dropdown-body {
            width: ~'calc(100% - 40px)';
        }
    }
}

.segmentEditorPanel.expanded ul.submenu {
    display: inline-block;
    list-style: none;
    width: 100%;
    padding: 0;
}

.segmentFilterContainer {
    margin-bottom: 4px;
    display: block;
    position: relative;
    width: 100%;
    padding: @_segmentselector-dropdown_padding;
}

.segmentEditorPanel.expanded .segmentFilterContainer:hover .searchInputClear {
    background: url(plugins/SegmentEditor/images/reset_search.png);
}

.segmentEditorPanel.expanded .filterNoResults {
    font-style: italic;
}

.segmentEditorPanel.expanded {
    .add_new_segment, .sign_in_segment_btn {
        display: flex;
        justify-content: center;
        align-items: center;

        width: @_segmentselector-full-width-button-width;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;

        min-height: @_segmentselector-button-height;
        line-height: @_segmentselector-button-height;
        box-shadow: none;
    }
    .add_new_segment {
        margin: @_segmentselector-dropdown_padding;
        margin-top: 16px;
    }
    .sign_in_segment_btn {
        margin: @_segmentselector-dropdown_padding;
    }
}


.segmentEditorPanel.expanded .manage_segment_btn {
    width: @_segmentselector-full-width-button-width;
    margin: @_segmentselector-dropdown_padding;
    margin-top: 0;
    box-shadow: none;
    line-height: @_segmentselector-button-height;
}

.segmentationContainer > ul.submenu > li {
    padding: 5px 0;
    clear: both;
    cursor: pointer;
}

.segmentList {
    max-height: 300px;
    overflow-x: hidden;
    overflow-y: auto;


    li {
        display: flex;
        align-items: center;
        gap: 4px;
    }
}

.jspVerticalBar {
    background: transparent !important;
}

/* ADDITIONAL STYLES */
.segment-element .segment-nav div > ul > li ul {
    margin-left: 0;
}

.segment-element .segment-nav div > ul > li li a,
.segment-element .segment-nav div > ul > li li a:hover {
    padding-right: 18px;
}

a.metric_category {
    display: block;
    width: 100%;
}

.segment-content > h3 {
    padding-bottom: 7px;
}

.ui-widget-segmentation {
    border: 1px solid #D4D4D4 !important;
}

.clearfix:after {
    display: block;
    visibility: hidden;
    height: 0;
    clear: both;
    content: ".";
}

.metricValueBlock input {
    padding: 8px !important;
}

.segmentationSelectorContainer {
    margin: 8px;
}

.segmentSelected,
.segmentSelected:hover,
.segmentEditorPanel .segmentationContainer .submenu li .segmentSelected {
    font-weight: bold;
}

.ui-autocomplete {
    position: absolute;
    cursor: default;
    z-index: 1000 !important;
}

.ui-autocomplete.ui-menu.ui-widget {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
    padding: 6px !important;
}

@media all and (max-width: 749px) {
    span.segmentationTitle,
    .segmentEditorPanel.expanded .segmentationContainer {
        width: auto;
    }

    .grid-1, .grid-2, .grid-3 {
        width: 100%;
    }
}

.segment-definition-change-confirm .description {
    margin-top: 20px;
    float: left;
    width: 100%;
    text-align: center;

    > span {
        display: inline-block;
    }
}

.segment-element.anchorRight {
    right: -1px;
    left: auto;
}

.segmentationTitle,
.segment-element .segment-nav a.dropdown,
.segname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.segment-element .segment-nav a.dropdown {
    max-width: 180px;
    padding: 0;
    display: inline-block;
    background: url("plugins/Morpheus/images/sort_subtable_desc.png") no-repeat scroll 100% -2px transparent !important;
}

.segname {
    flex: auto;
    font-size: 14px;
    line-height: 20px;
    padding-right: 10px;
    order: 1;
}

@media screen and (min-width: 601px) {
    .segname  {
        max-width: 246px;
    }
}

.segmentEditorPanel .segmentationTitle {
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: top;
    max-width: 170px;
}

.segment-clicked {
    font-weight: bold;
}

.segment-element .segment-top a.dropdown {
    padding: 0;
    margin-right: 0.5em;
    background: none !important;
}

.segment-element .segment-top a.dropdown:after {
    content: "";
    display: inline-block;
    border-left: 0.4em solid rgba(0, 0, 0, 0);
    border-right: 0.4em solid rgba(0, 0, 0, 0);
    border-top: 0.5em solid @theme-color-brand;
    margin-left: 0.5em;
    margin-bottom: 0.25em;
    vertical-align: middle;
}

.enable_all_users, .visible_to_website, .auto_archive {
    display: inline-block;
    margin-left: 4px;
}

.auto_archive {
    a.dropList {
        display: inline-block;
        width: calc(100% - 15px);
    }
}
