/*********
* Budgie *
**********/

$budgie_panel_bg_color: if($variant == 'light', $bg_color, #263238);
$budgie_panel_fg_color: if($variant == 'light', $fg_color, #fff);

$pos_list: ((top, bottom),(bottom,top),(left,right),(right,left));

@function gtkalpha($c,$a) {
  @return unquote("alpha(#{$c},#{$a})");
}

%app_indicators {

  &:hover {
    background-color: transparentize(black, 0.9);
  }

  &:active,
  &:checked {
    // background-color: transparentize(black, 0.8);
  }

  @each $pos, $alt_pos in $pos_list {
    .#{$pos} & {

      @at-root {
        .#{$pos} .budgie-panel .unpinned .launcher,
        .#{$pos} .budgie-panel .pinned .launcher.running {
          border-#{$pos}: 2px solid transparentize($budgie_panel_fg_color, 0.8);
        }
      }

      &:hover {
        border-#{$pos}: 3px solid transparentize($budgie_panel_fg_color, 0.5);
      }

      &:active,
      &:checked {
        border-#{$pos}: 3px solid $budgie_panel_fg_color;
      }
    }
  }
}

// Positional Styles
@each $pos, $alt_pos in $pos_list {

  // Panel borders
  .#{$pos} .budgie-panel {
    border-#{$alt_pos}: 1px solid transparentize(black,0.8);
    box-shadow:inset 0 1px 0 0 transparentize(white,0.9);
  }

  // Raven borders
  .#{$pos} .raven-frame {
    border-#{$alt_pos}: 1px solid transparentize(black, 0.2);
    box-shadow:inset 0 0 0 1px transparentize(white, 0.7);
  }

  // Shadows
  .#{$pos} .shadow-block {
    background-color: transparent;
    background-image: linear-gradient(to $alt_pos,
                      $shadow_color,
                      transparent,
                      transparent);
  }
}

// Budgie
.budgie-container {
  background-image: none;
  background-color: transparent;

  &:backdrop {
    background-image: none;
    background-color: transparent;
  }
}

// Budgie Menu
.budgie-menu {

  GtkSearchEntry.entry:not(:selected) {
    border: none;
    box-shadow: none;
    background: none;
    font-size: 100%;

    &.image { padding-left: 0px; padding-right: 6px; }
  }
  .list-row.activatable:selected,
  .list-row.activatable:selected .button { color: inherit; }
}

// Panel
.budgie-panel {
  color: $budgie_panel_fg_color;
  background-color: $budgie_panel_bg_color;

  // this is the actual style for some reason
  &:backdrop {
    color: $budgie_panel_fg_color;
    background-color: $budgie_panel_bg_color;
  }

  // Menu
  BudgieMenuApplet {
    font: bold;
    .label {
      color: $budgie_panel_fg_color;
      icon-shadow: 0 1px $icon_shadow_color;
      text-shadow: 0 1px $text_shadow_color;
    }
  }

  // Clock
  ClockApplet {
    font: monospace bold;
    font-size: 90%;
    .label {
      color: $budgie_panel_fg_color;
      icon-shadow: 0 1px $icon_shadow_color;
      text-shadow: 0 1px $text_shadow_color;
    }
  }

  // Tasklist
  WnckTasklist {
    .button,
    .button:backdrop {

      border-radius: 0;

      @if $variant == 'default' {
        &:not(:hover):not(:active):not(:checked) { color: gtkalpha(currentColor, 0.5); }
        background: none;
        background-clip: padding-box;
        border: none;

        @extend %app_indicators;
      }
    }
  }

  // Icon Tasklist
  .launcher {
    transition: all 100ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding-left: 2px;
    padding-right: 2px;
    border-color: transparentize($budgie_panel_bg_color, 1.0); // fixes the transition

    &:hover { -gtk-image-effect: highlight; }
  }

  .pinned,
  .unpinned {
    .launcher,
    .launcher.running {
      @extend %app_indicators;
      padding: 2px 6px;
    }
  }
}

// Panel borders
.bottom .budgie-panel {
  border: none;
  box-shadow:none;
  background:none;
}

// Raven

.raven {
  color: $fg_color;
  background-color: transparentize($bg_color, 0.02);
  transition: 170ms ease-out;

  .raven-header {
    padding: 4px;
    font: bold;
    text-shadow: 0 1px $text_shadow_color;
    icon-shadow: 0 1px $icon_shadow_color;
    background-color: $bg_color;
    background-image: linear-gradient(to bottom,
                      lighten($bg_color, 5%),
                      $bg_color);
    color: $fg_color;
    border: solid $borders_color;
    border-width: 1px 0 1px 0;
    box-shadow:inset 0 1px 0 0 transparentize(white,0.9),
              inset 0 -1px 0 0 transparentize(white,0.95),
              0 1px 2px 0 $shadow_color;

    &.top { border-top-style: none; }
    &.bottom { border-bottom-style: none; }

    GtkSwitch {
      -GtkSwitch-slider-width: 16px;
      -GtkSwitch-slider-height: 16px;
      border-radius: 12px;

      .slider {
        border-radius: 8px;
      }
    }

  }

  @if $variant=='default' {
    .expander-button { color: gtkalpha(currentColor, 0.5); }
  }

  .raven-background {
    background-color: $base_color;
    border-bottom: 1px solid $borders_color;
    box-shadow:inset 0 1px 1px 0 $shadow_color;
    &.middle { border-bottom-style: none; }  // applet background between two headers

  }

  // Calendar
  .raven-calendar {
    border:none;
    padding: 2px;
    border-bottom:1px solid $borders_color;
  }

  // Session Buttons
  .powerstrip {
    background-color: transparent;
    background-image:none;
    border: none;
    box-shadow:none;
  }

  .powerstrip .button {
    border-radius:50%;
    padding: 12px;
    background: darken($bg_color,2%);
    border: 1px solid transparentize(black,0.8);
    box-shadow: 0 1px transparentize(white,0.9);
    font-size: 100%;

    &:hover {
      box-shadow: inset 0 1px transparentize(white,0.9), 1px 1px transparentize(black,0.8);
      transition: 170ms ease all;
    }

    &:active {
      box-shadow: 0 1px transparentize(white,0.9);
      transition: 170ms ease all;
    }
  }

  .option-subtitle {
    font-size: smaller;
  }
}

// MPRIS Applet
.raven-mpris {
  text-shadow: 0 1px $text-shadow_color;
  icon-shadow: 0 1px $icon_shadow_color;
  color: $budgie_panel_fg_color;
  background-color: transparentize($budgie_panel_bg_color, 0.2);
  border: solid transparentize(black, 0.8);
  border-width: 1px 0;
  box-shadow:inset 0 1px 0 0 transparentize(white,0.9),
            inset 0 -1px 0 0 transparentize(white,0.95),
            0 1px 1px 0 transparentize(black,0.9);

  .button.image-button { padding: 8px; }
}

// Notifications
.budgie-notification-window {
  border-radius: 4px;
  border:none;
  border-top: 1px solid transparentize(white,0.9);
  background-color: $bg_color;
  box-shadow: 0 2px 2px 0 $shadow_color, 0 0 0 1px $shadow_color;
}

.budgie-notification {

  &.background {
    border-radius: 4px;
    padding: 4px;
  }

  .notification-title {
    font-size: 110%;
    color: $fg_color;
  }

  .notification-body {
    border:none;
    color: transparentize($budgie_panel_fg_color, 0.3);
  }
}

// Session Dialog
.budgie-session-dialog {
  border-radius: 4px;
  border:none;
  border-top: 1px solid transparentize(white,0.9);

  &.background {
    padding:12px;
    box-shadow: 0 1px 1px 0 $shadow_color, 0 0 0 1px $shadow_color;
  }

  .linked.horizontal > .button {
    border-bottom: none;
    border-radius: 0;
    &:first-child { border-left: none; border-radius: 0 0 0 4px; }
    &:last-child { border-right: none; border-radius: 0 0 4px 0; }
  }
}

// PolKit Dialog
.budgie-polkit-dialog {
  @extend .budgie-session-dialog;

  .message { color: transparentize($budgie_panel_fg_color, 0.3); }
  .failure { color: $red; }
}