/* Top Bar */
// a.k.a. the panel

#panel {
  font-weight: bold;
  color: $panel-text-secondary;
  font-feature-settings: "tnum";
  transition-duration: 250ms;
  box-shadow: none;
  border: none;
  @include fontsize($font_size - 1);

  @if $float == 'true' {
    background-color: transparent;
    height: $item_size + $base_margin * 2;
  } @else {
    background-color: $panel;
    height: $item_size + 2px;
  }

  // the rounded outset corners
  .panel-corner {
    -panel-corner-radius: 0;
    -panel-corner-background-color: $panel;
    -panel-corner-border-width: 2px;
    -panel-corner-border-color: transparent;
    -panel-corner-opacity: 1;
    transition-duration: 250ms;
  }

  // panel menus
  .panel-button {
    -natural-hpadding: $base_padding * 2;
    -minimum-hpadding: $base_padding;
    font-weight: bold;
    color: $panel-text-secondary;
    transition-duration: 150ms;
    border-radius: $circular_radius;
    text-shadow: none;

    @if $float == 'true' {
      border: $base_margin solid transparent;
      box-shadow: inset 0 0 0 1000px $panel;
    } @else {
      border: $base_padding / 2 solid transparent;
    }

    &.clock-display {
      box-shadow: none;

      .clock {
        transition-duration: 150ms;
        border-radius: $circular_radius;

        @if $float == 'true' {
          border: $base_margin solid transparent;
          box-shadow: inset 0 0 0 1000px $panel;
        } @else {
          border: $base_padding / 2 solid transparent;
        }
      }
    }

    &.screen-recording-indicator {
      box-shadow: inset 0 0 0 100px $error;
    }

    &.screen-sharing-indicator {
      box-shadow: inset 0 0 0 100px $warning;
      StBoxLayout { margin: 0 $base_padding; }
    }

    &.screen-recording-indicator,
    &.screen-sharing-indicator {
      StBoxLayout {
        spacing: $base_padding;
      }

      StIcon {
        icon-size: $base_icon_size;
      }
    }

    &:hover {
      color: $panel-text;
      background-color: transparent;
      box-shadow: inset 0 0 0 1000px mix($panel-text, $panel, 15%);

      &.clock-display {
        box-shadow: none;
        color: $panel-text-secondary;

        .clock {
          color: $panel-text;
          box-shadow: inset 0 0 0 1000px mix($panel-text, $panel, 15%);
        }
      }
    }

    &:active, &:overview, &:focus, &:checked {
      &, &:hover {
        background-color: transparent;
        color: $panel-text;
        box-shadow: inset 0 0 0 1000px mix($panel-text, $panel, 25%);
      }

      &.clock-display {
        box-shadow: none;
        color: $panel-text-secondary;

        .clock {
          box-shadow: inset 0 0 0 1000px mix($panel-text, $panel, 25%);
          color: $panel-text;
        }
      }
    }

    .unlock-screen &,
    .login-screen &,
    .lock-screen & {
      color: $panel-text;

      &:focus, &:hover, &:active { color: $panel-text; }
    }

    // status area icons
    .system-status-icon {
      icon-size: $base_icon_size;
      padding: $base_padding;
      margin: 0;
      -st-icon-style: symbolic;
    }

    .appindicator-trayicons-box {
      margin: 0 $base_padding;
    }

    // .panel-status-indicators-box .system-status-icon,
    // .panel-status-menu-box .system-status-icon {
    //   margin: 0;
    // }

    // .panel-status-indicators-box,
    // .panel-status-menu-box {
    //   spacing: $base_padding / 2;
    // }
  
    // // spacing between power icon and (optional) percentage label
    // .power-status.panel-status-indicators-box {
    //   spacing: 0;
    // }

    // app menu icon
    .app-menu-icon {
      -st-icon-style: symbolic;
      // dimensions of the icon are hardcoded
    }

    &#panelActivities {
      -natural-hpadding: $base_padding * 3;

      StBoxLayout {
        spacing: $base_padding;
      }

      .workspace-dot {
        border-radius: $circular_radius;
        min-width: 8px;
        min-height: 8px;
        background-color: on($panel-solid);
      }
    }
  }

  // transparent panel on lock & login screens
  &:overview,
  &.unlock-screen,
  &.login-screen,
  &.lock-screen {
    background-color: transparent;
    box-shadow: none;

    StLabel, StIcon { color: on(dark, secondary); }

    .panel-button {
      @if $float == 'true' {
        box-shadow: inset 0 0 0 1000px overlay(dark, normal);
      }

      &.clock-display {
        .clock {
          box-shadow: inset 0 0 0 1000px overlay(dark, normal);
        }
      }

      &:hover {
        color: on(dark);
        background-color: transparent;
        box-shadow: inset 0 0 0 1000px overlay(dark, hover);

        &.clock-display {
          box-shadow: none;
          color: on(dark);

          .clock {
            color: on(dark);
            box-shadow: inset 0 0 0 1000px overlay(dark, hover);
          }
        }
      }

      &:active, &:overview, &:focus, &:checked {
        color: on(dark);
        background-color: transparent;
        box-shadow: inset 0 0 0 1000px overlay(dark, active);

        &.clock-display {
          box-shadow: none;
          color: on(dark);

          .clock {
            box-shadow: inset 0 0 0 1000px overlay(dark, active);
            color: on(dark);
          }
        }
      }

      &#panelActivities {
        .workspace-dot {
          background-color: on(dark);
        }
      }
    }

    .panel-corner {
      -panel-corner-radius: 0;
      -panel-corner-background-color: transparent;
      -panel-corner-border-color: transparent;
    }
  }

  // Input indicators
  Gjs_status_keyboard_InputSourceIndicator.panel-button, // Ibus
  Gjs_appindicatorsupport_rgcjonas_gmail_com_indicatorStatusIcon_IndicatorStatusIcon.panel-button,
  Gjs_appindicatorsupport_rgcjonas_gmail_com_indicatorStatusIcon_AppIndicatorsIndicatorStatusIcon.panel-button { // Fcitx
    -natural-hpadding: 12px + $base_padding !important;
    -minimum-hpadding: 12px + $base_padding !important;
  }

  // indicator for active
  .screencast-indicator,
  .remote-access-indicator { color: $warning; }
}
