@import "../../../css/config/font";

$color-common: #75e1ff;
$color-common-fg: #004052;
$color-jvm: #79bf2d;
$color-native: #6d6dff;
$color-js: #ffb100;

$color-select-off: #d3d6d9;
$color-select-off-fg: #222222;
$color-select-on-pressed: #e4e6e8;

$platforms: (
    Common: (
        bg: #75e1ff,
        fg: #004052,
        select-hover: #3ad4ff
    ),
    JVM: (
        bg: #79bf2d,
        select-hover: #6bac25
    ),
    JS: (
        bg: #ffb100,
        select-hover: #ff9b00
    ),
    Native: (
        bg: #6d6dff,
        select-hover: #4b4bff
    )
);

@each $platform, $params in $platforms {
    .api-panel_toggle {
        .toggle-platform.#{$platform} {
            background-color: map-get($params, bg);
            @if map-has-key($params, fg) {
                color: map-get($params, fg);
            }
        }
        .toggle-platform.#{$platform}:hover {
            background-color: map-get($params, select-hover);
        }

        .toggle-platform.off.#{$platform}:hover {
            background-color: map-get($params, select-hover);
            @if map-has-key($params, fg) {
                color: map-get($params, fg);
            } @else {
                color: white;
            }
        }
        .toggle-platform.pressed.#{$platform} {
            background-color: map-get($params, bg);
        }
        .toggle-platform.off.pressed.#{$platform} {
            background-color: $color-select-off;
            color: $color-select-off-fg;
            span {
                opacity: 0.6;
            }
        }

        .toggle-platform.disabled.#{$platform},
        .toggle-platform.disabled.#{$platform}:hover {
            cursor: default;
            background-color: $color-select-off;
            color: $color-select-off-fg;
            span {
                opacity: 0.4;
            }
        }
    }



    .tags .platform.tag-value-#{$platform} {
        background-color: map-get($params, bg);
        @if map-has-key($params, fg) {
            color: map-get($params, fg);
        }
    }
}

//Enrichment:
$color-jvm-enrich: #62aa13;
$jvm-enrichment: JRE7, JRE8, JUnit, JUnit5, TestNG;
@each $enrich in $jvm-enrichment {
  .tags .platform.tag-value-#{$enrich} {
    background-color: $color-jvm-enrich;
  }
}

.api-page-panel {
    display: flex;
    flex-direction: column;
}

.api-docs-breadcrumbs {
    flex-grow: 1;
}

.api-panel__dropdown-title {
    padding-right: 10px;
}

.api-panel__switchers {
    display: flex;
    margin-left: auto;
    margin-right: 0;
    padding-bottom: 10px;
    padding-right: 0;
}

.api-panel_toggle {
    margin-left: auto;
    display: flex;
    .toggle-platform {
        height: 24px;
        border-radius: 12px;

        font-family: Inter, Arial, sans-serif;
        font-size: 14px;
        font-weight: normal;
        font-style: normal;
        font-stretch: normal;
        line-height: 24px;
        letter-spacing: normal;
        text-align: center;
        color: #ffffff;

        margin-left: 8px;
        padding: 0 16px;
        cursor: pointer;
    }

    .toggle-platform.off {
        background-color: $color-select-off;
        color: $color-select-off-fg;
        span {
            opacity: 0.4;
        }
    }

    .toggle-platform.off:hover {
        span {
            opacity: 1;
        }
    }
}

.api-panel__select {
    margin-top: auto;
    margin-bottom: auto;
    margin-left: 40px;

   .dropdown-selected-value {

     height: 24px;
     border-radius: 12px;
     background-color: #ffffff;
     border: solid 1px rgba(34, 34, 34, 0.2);

     font-family:  Inter, Arial, sans-serif;
     box-sizing: border-box;
     line-height: 24px;

     padding-left: 15px;
     padding-right: 25px;
   }
  .dropdown-selected-value:after {
    top: 10px;
    right: 10px;
  }
}

.tags {
    display: flex;
}

.api-docs-table tr > td:first-child p {
    margin-bottom: 0;
}

.tags__tag.platform {
    // To make text invisible
    text-indent: 100%;
    white-space: nowrap;
    overflow: hidden;

    // dot parameters
    width: 10px;
    height: 10px;
    max-width: 10px;
    max-height: 10px;
    border-radius: 8px;

    transition: width 1000ms, height 1000ms;

    margin-left: 14px;

    // center vertically
    margin-top: auto;
    margin-bottom: auto;

    // text properties
    font-family:  Inter, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    font-style: normal;
    font-stretch: normal;
    line-height: normal;
    letter-spacing: normal;
    text-align: center;

    // Text is basically white, unless overriden by concrete tag value
    color: white;
}

.declarations:hover .tags__tag.platform,
.tags:hover > .tags__tag.platform,
.overload-group:hover .tags__tag.platform,
.node-page-main:hover .tags__tag.platform {
        //Make text visible
        text-indent: 0%;
        white-space: nowrap;

        padding: 0 7px;

        border-radius: 9px;

        margin-left: 8px;

        width: auto;
        height: 15px;

        // To animate transition to width: auto, height: auto
        max-width: 500px;
        max-height: 500px;
        transition: max-width 1000ms, max-height 1000ms;
}

.tags__tag.kotlin-version {
    margin-left: 14px;
    width: 20px;
    font-size: 12px;
    font-family: Inter, Arial, sans-serif;
    text-align: right;

    font-weight: bold;
    font-style: normal;
    font-stretch: normal;
    line-height: normal;
    letter-spacing: normal;
}

.declarations:hover {
    border: solid 1px rgba(0, 0, 0, 0.2);

    > h4:first-of-type > a,
    > h5:first-of-type > a {
        color: #497bb7;
    }
}

:not(.declarations) > .tags {
    margin-bottom: 8px;
    margin-top: 20px;

    .spacer {
      flex-grow: 1;
    }
}

.declarations {
    cursor: pointer;
    background-color: #ffffff;
    border: solid 1px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    position: relative;
    padding-top: 27px;
    padding-left: 24px;
    padding-right: 26px;
    padding-bottom: 14px;
    font-family: Inter, Arial, sans-serif;


    > h4:first-of-type, > h5:first-of-type {
        font-family: Inter, Arial, sans-serif;
        font-weight: normal;
        margin-top: 0;
        margin-bottom: 13px;
        line-height: 24px;

        > a {
            text-decoration: none;
            color: #222222;
            font-size: 24px;
        }
    }
    > h5:first-of-type > a {
        font-size: 18px;
    }

    > .tags {
        position: absolute;
        top: 0px;
        right: 0px;
        margin-top: 9px;
        margin-right: 26px;
    }


}

.summary-group {
  margin-bottom: 20px;
  > p:last-of-type {
    margin-bottom: 10px;
  }
}

.tags__tag.kotlin-version.hidden-version {
  visibility: hidden;
}