@charset "UTF-8";

@mixin entry($t, $fc:gtk("@theme_view_active_decoration_color")) {
//
// Entries drawing function
//
// $t: entry type
// $fc: focus color
// $edge: set to none to not draw the bottom edge or specify a color to not
//        use the default one
//
// possible $t values:
// normal, focus, insensitive, backdrop, backdrop-insensitive, osd, osd-focus, osd-backdrop;
//
  @if $t==normal {
    color: gtk("@theme_text_color");
    border-color: gtk("@borders");
    background-color: gtk("@theme_base_color");
    box-shadow: none;
  }

  @if $t==focus {
    border-color: $fc;
  }

  @if $t==insensitive {
    color: gtk("@insensitive_base_fg_color");
    border-color: gtk("@insensitive_borders");
    background-color: gtk("@insensitive_base_color");
  }

  @if $t==backdrop {
    color: gtk("@theme_unfocused_text_color");
    border-color: gtk("@unfocused_borders");
    background-color: gtk("@theme_unfocused_base_color");
  }

  @if $t==backdrop-insensitive {
    color: gtk("@theme_unfocused_view_text_color");
    border-color: gtk("@unfocused_insensitive_borders");
    background-color: gtk("@theme_unfocused_view_bg_color");
  }
}

/****************
 * Text Entries *
 ****************/

%entry,
entry {
    %entry_basic, & {
      min-height: 30px;
      padding-left: 8px;
      padding-right: 8px;
      border: 1px solid;
      border-radius: $r;
      transition: all 200ms $ease-out-quad;

      @include entry(normal);

      image { // icons inside the entry
        &.left { padding-left: 0; padding-right: 6px; }
        &.right { padding-left: 6px; padding-right: 0; }
      }
      // FIXME
      // undershoot {
      // &.left { @include undershoot(left); }
      // &.right { @include undershoot(right); }
      // }

      &.flat {
        &:focus, & {
          min-height: 0;
          padding: 2px;
          @include entry(normal);
        }
      }
      &:focus { @include entry(focus); }
      &:disabled { @include entry(insensitive); }
      &:backdrop { @include entry(backdrop); }
      &:backdrop:disabled { @include entry(backdrop-insensitive); }

      selection { &:focus, & { @extend %selected_items; }}

      @each $e_type, $e_color in (error, gtk("@error_color")),
                                 (warning, gtk("@warning_color")) {
        &.#{$e_type} {
          color: $e_color;
          border-color: $e_color;
          background-color: gtkalpha($e_color, 0.5);
          &:focus {
            @include entry(focus, $e_color);
            background-color: gtkalpha($e_color, 0.5);
          }
          &:selected, &:selected:focus { background-color: $e_color; }
          &:backdrop {
            @if $e_color == gtk("@error_color") {
              color: gtk("@error_color_backdrop");
              border-color: gtk("@error_color_backdrop");
              background-color: gtkalpha(gtk("@error_color_backdrop"), 0.5);
            } @else if $e_color == gtk("@warning_color") {
              color: gtk("@warning_color_backdrop");
              border-color: gtk("@warning_color_backdrop");
              background-color: gtkalpha(gtk("@warning_color_backdrop"), 0.5);
            }
          }
        }
      }

      image { // entry icons colors
        color: gtkmix(gtk("@theme_fg_color"),gtk("@theme_text_color"), 0.8);
        &:hover { color: gtk("@theme_button_decoration_hover"); }
        &:active { color: gtk("@theme_button_decoration_focus"); }
        &:backdrop { color: gtkmix(gtk("@theme_unfocused_fg_color"), gtk("@theme_unfocused_fg_color"), 0.8); }
      }
    //   FIXME
    //   &:drop(active) {
    //   &:focus, & {
    //     border-color: $drop_target_color;
    //     box-shadow: inset 0 0 0 1px $drop_target_color;
    //   }
    // }
    }

  progress {
    margin: 1px;
    border-radius: 0;
    border-width: 0 0 2px;
    border-color: gtk("@theme_selected_bg_color");
    border-style: solid;
    background-image: none;
    background-color: transparent;
    box-shadow: none;
    &:backdrop {
      background-color: transparent;
      border-color: gtk("@theme_unfocused_selected_bg_color");
    }
  }
}

treeview acceleditor > label {
    background-color: gtk("@theme_selected_bg_color");
}

treeview entry {
  &.flat, & {
    border-radius: 0;
    background-image: none;
    background-color: gtk("@theme_base_color");

    &:focus { border-color: gtk("@theme_view_active_decoration_color"); }
  }
}
