@import "./config";
@import "./mixins";
@import "./responsive";

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

input[type="search"] {
  -moz-appearance: none;
  -webkit-appearance: none;
}

// sizes for search element
// input field
$search-width: 480px;
$advanced-search-width: 740px;

// width on smaller devices
$search-width-small-device: 360px;

// width of project filter
$project-filter-width: 160px;

// width of project filter on smaller devices
$project-filter-width-small-device: 120px;


// shared dropdown menu in fulltext-search and search-panel
.dsp-search-menu {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  background-color: $bright;
  border-radius: $border-radius;
  overflow-y: auto;
  min-height: 320px;
  margin-top: 6px;
  padding: 16px;
  z-index: -1;
  position: relative;

  .dsp-menu-header {
    background-color: rgba(249, 249, 249, 1);
    border-top-left-radius: $border-radius;
    border-top-right-radius: $border-radius;
    display: inline-flex;
    height: 48px;
    width: 100%;
    margin-bottom: 12px;

    .dsp-menu-title h4 {
      margin: 12px 0;
    }
  }

  .dsp-menu-action {
    position: absolute;
    bottom: 0;
    width: calc(100% - 32px);

    .center {
      display: block;
      margin: 12px auto;
    }
  }
}

// form elements
$full-input-width: 320;
$gc-large: decimal-floor($full-input-width / 1.618, 0) - 2;
$gc-small: $full-input-width - $gc-large - 4;

.dsp-form-content {
  width: 100%;
  position: relative;
  min-height: 320px;
  height: 100%;

  .dsp-form-action {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: inline-flex;
  }

  .dsp-form-expert-search {
    bottom: 16px;
    width: calc(100% - 32px);
    display: inline-flex;
  }
}

.small-field {
  width: $gc-small + px;
}

.medium-field {
  width: $gc-large + px;
}

.large-field {
  min-width: $full-input-width + px;
}

.input-icon {
  color: $black-60-opacity;
}

// responsive style: desktop
@media (min-width: map-get($grid-breakpoints, desktop)) {
  .dsp-fulltext-search {
    width: $search-width;

    &.with-project-filter {
      width: calc(#{$search-width} + #{$project-filter-width});
    }

    .dsp-project-filter,
    .dsp-project-filter-button {
      width: $project-filter-width;
    }
  }

  .dsp-search-menu {
    width: calc(#{$search-width} - 32px);
    &.with-project-filter {
      width: calc(#{$search-width} + #{$project-filter-width} - 32px);
    }
    &.with-advanced-search {
      width: calc(#{$advanced-search-width} - 32px);
    }
  }
}

// responsive style: tablet
@media (max-width: map-get($grid-breakpoints, desktop)) and (min-width: map-get($grid-breakpoints, phone)) {

  .dsp-fulltext-search {
    width: $search-width-small-device;

    &.with-project-filter {
      width: calc(#{$search-width-small-device} + #{$project-filter-width-small-device});
    }

    .dsp-project-filter,
    .dsp-project-filter-button {
      width: $project-filter-width-small-device;
    }
  }

  .dsp-search-menu {
    width: calc(#{$search-width-small-device} - 32px);
    &.with-project-filter {
      width: calc(#{$search-width-small-device} + #{$project-filter-width-small-device} - 32px);
    }
    &.with-advanced-search {
      width: 100vw;
    }
  }
}
