@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;
}

/* ====== */
#optimize-banner { display: none!important; }

.api-docs-to-core {
    position: relative;
    padding: 0;
}

.api-docs-to-core__link {
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 52px;

    background: linear-gradient(90.12deg, #7F52FF 23%, #A952FF 34.23%, #9952FF 44.65%, #8952FF 100%);
}

.api-docs-to-core__link, .api-docs-to-core__link:hover {
    color: #fff;
    text-decoration: none;
}

.api-docs-to-core__text {
    display: inline-flex;
    align-items: center;
    background: url("/assets/images/core-launch.png") 24px 2px no-repeat;
    background-size: 48px;
    padding: 0 2px 0 calc(24px + 48px + 8px);
    margin-left: -24px;

    animation-duration: 300ms, 300ms;
    animation-delay: 0s, 300ms;
    animation-timing-function: ease-in, ease-out;
}
@keyframes rocket-in {
    from {
        background-position: 24px 2px;
    }

    to {
        background-position: calc(24px + 48px) -52px;
    }
}
@keyframes rocket-out {
    from {
        background-position: calc(24px - 48px) 52px;
    }

    to {
        background-position: 24px 2px;
    }
}
.api-docs-to-core_hover .api-docs-to-core__text {
    animation-name: rocket-in, rocket-out;
}

.api-docs-to-core__close {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    height: 52px;
    width: 52px;
    box-sizing: border-box;
}

.api-docs-to-core-mobile {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 12px;
    background: linear-gradient(108.46deg, #7F52FF 0%, #A852FF 10.78%, #7F52FF 100%);
    border-radius: 8px;
    width: 456px;
    z-index: 100;
    color: #fff;
}

@media (max-width: 479px) {
    .api-docs-to-core-mobile {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }
}

.api-docs-to-core-mobile__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 12px;
}

.api-docs-to-core-mobile__text::before {
    display: block;
    content: '';
    background: url("/assets/images/core-launch.png") center center no-repeat;
    background-size: 48px;
    height: 48px;
    width: 48px;
}

.api-docs-to-core-mobile__controls {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 52px;
}

.api-docs-to-core__text, .api-docs-to-core-mobile__text {
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.0015em;
    text-align: center;
}

.api-docs-to-core-mobile__link, .api-docs-to-core-mobile__link:hover,
.api-docs-to-core-mobile__close, .api-docs-to-core-mobile__close:hover {
    flex: 1 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;

    background-color: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-decoration: none;

    font-size: 13px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.0045em;
}

.api-docs-to-core, .api-docs-to-core-mobile {
    font-family: "JetBrains Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Droid Sans", "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: 'ss20';
}

.api-docs-to-core-mobile__link:hover, .api-docs-to-core-mobile__close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.api-docs-to-core-mobile__close {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: -1px;
}

.api-docs-to-core-closed {
    display: none;
}

@media (max-width: 704px) { .api-docs-to-core { display: none; } }
@media (min-width: 705px) { .api-docs-to-core-mobile { display: none; } }
