/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

/* Label/tag denoting the user that shared a connection */
.jdbc-share-tag {

    background: #0095ff;
    padding: 0.25em;

    -moz-border-radius:    0.25em;
    -webkit-border-radius: 0.25em;
    -khtml-border-radius:  0.25em;
    border-radius:         0.25em;

    color: white;
    font-size: 0.75em;
    font-weight: bold;

}
.totp-enroll p,.totp-details{font-size:.8em}.totp-qr-code{text-align:center}.totp-qr-code img{margin:1em;border:1px solid rgba(0,0,0,0.25);box-shadow:1px 1px 2px rgba(0,0,0,0.25);cursor:pointer}h3.totp-details-header{font-size:.8em}h3.totp-details-header::before{content:'▸ '}.totp-details-visible h3.totp-details-header::before{content:'▾ '}.totp-details,.totp-hide-details{display:none}.totp-details-visible .totp-details{display:table}.totp-details-visible .totp-hide-details{display:inline}.totp-details-visible .totp-show-details{display:none}.totp-hide-details,.totp-show-details{color:blue;text-decoration:underline;cursor:pointer;margin:0 .25em;font-weight:normal}.totp-details{margin:0 auto}.totp-details th{padding-right:.25em;text-align:left}.totp-details td{font-family:monospace}.totp-detail{display:inline-block;margin:0 .25em}.login-ui, .home-view {
    --ink: #172d33;
    --muted: #465f66;
    --accent: #075b60;
    --line: #bfced0;
    color: var(--ink);
    font-family: system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    line-height: 1.5;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

div.login-ui, .home-view {
    background: radial-gradient(ellipse at 20% 0%, #dceae7 0, transparent 54%),
                #f2f5f3;
}

div.login-ui {
    height: auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 5vw, 4rem);
}

.login-ui .login-dialog-middle {
    display: block;
}

.login-ui .login-dialog,
.login-ui.continuation .login-dialog {
    border: 1px solid var(--line);
    border-top: 4px solid var(--accent);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 12px 42px #173c4020;
    max-width: 26rem;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    font-size: 1rem;
}

.login-ui.continuation .login-dialog {
    max-width: 34rem;
}

/* A compact front view of the host, drawn locally without a font or image request. */
.login-ui .login-dialog .logo {
    width: 3.5rem;
    height: 1.6rem;
    margin: 0 0 1rem;
    border: 1px solid #6a8183;
    border-bottom: 3px solid #456369;
    border-radius: .42rem;
    background: radial-gradient(circle at 84% 62%, #126b61 1.5px, transparent 2px),
                linear-gradient(#52686c, #52686c) 17% 66% / 6px 2px no-repeat,
                linear-gradient(#52686c, #52686c) 36% 66% / 6px 2px no-repeat,
                linear-gradient(165deg, #edf3ef, #bdccca);
}

.login-ui .login-dialog .version,
.remote-home-intro h1 {
    padding: 0;
}

.login-ui .login-dialog .version .app-name,
.remote-home-intro h1 {
    text-align: left;
    font-weight: 700;
    letter-spacing: -.045em;
    text-transform: none;
    color: var(--ink);
    line-height: 1.15;
}

.login-ui .login-dialog .version .app-name {
    font-size: 2rem;
}

.login-ui .login-dialog .version .version-number {
    position: static;
    display: inline-block;
    padding: 0;
    margin: .35rem 0 0;
    font: 500 .8rem/1.5 system-ui, sans-serif;
    color: var(--muted);
    background: transparent;
    opacity: 1;
}

.remote-login-intro {
    margin: 1.25rem 0;
    color: var(--muted);
}

.login-ui .login-fields .labeled-field .field-header {
    position: static;
    z-index: auto;
    margin: .875rem 0 .35rem;
    color: var(--ink);
    opacity: 1;
    font-size: .95rem;
    font-weight: 600;
}

.login-ui .login-dialog .login-fields input:is([type=text], [type=password], [type=email], [type=number]),
.home-view .header .filter input {
    min-height: 2.875rem;
    border: 1px solid #7b9094;
    border-radius: .55rem;
    color: var(--ink);
    background-color: #fff;
    font: inherit;
}

.login-ui .login-dialog .buttons input[type=submit] {
    width: 100%;
    min-height: 2.875rem;
    border: 1px solid var(--accent);
    border-radius: .55rem;
    background: var(--accent);
    font-family: inherit;
    text-shadow: none;
    box-shadow: none;
}

.login-ui .login-dialog .buttons input[type=submit]:hover:enabled {
    background: #03454b;
}

.login-ui .login-dialog .buttons input:disabled {
    opacity: .7;
}

.login-ui.error p.login-error {
    position: static;
    width: 100%;
    max-width: 34rem;
    margin: 0 0 1rem;
    border-radius: .6rem;
    text-align: left;
    color: #792b23;
    background: #fff1ed;
}

.login-ui .totp-qr-code img {
    max-width: 100%;
    height: auto;
    margin-inline: 0;
}

.home-view {
    min-height: 100vh;
    padding: clamp(1rem, 4vw, 3rem) clamp(.875rem, 3vw, 2rem) 5rem;
}

.home-view .connection-list-ui {
    max-width: 58rem;
    margin: 0 auto;
}

.remote-home-intro {
    margin-bottom: clamp(1.25rem, 3vw, 2.25rem);
    padding: clamp(1.25rem, 4vw, 2.5rem);
    border-radius: 1rem;
    background: #173e43;
    color: #fff;
}

.remote-home-intro h1 {
    color: inherit;
    font-size: clamp(2rem, 5vw, 3.25rem);
}

.remote-home-intro p {
    margin: .65rem 0 0;
}

.remote-home-intro .remote-development {
    margin-top: 1rem;
    color: #c3e0da;
    font-size: .875rem;
}

.home-view .connection-list-ui > .header {
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .75rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
}

.home-view .header h2 {
    padding: 0;
    font-size: 1.2rem;
    text-transform: none;
}

.home-view .header .filter {
    padding: 0;
    max-width: 100%;
}

.home-view .header .user-menu,
.home-view .header .menu-dropdown {
    max-width: 100%;
    min-width: 0;
}

.home-view .user-menu .menu-dropdown {
    min-height: 2.875rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
    background: #fff;
}

.home-view .user-menu .menu-contents {
    max-width: min(22rem, calc(100vw - 2rem));
    white-space: normal;
    background: white;
}

.home-view .user-menu .menu-contents a {
    padding-block: .65rem;
}

.home-view .all-connections, .home-view .recent-connections {
    margin: .875rem 0 1.5rem;
}

.home-view .recent-connections {
    text-align: left;
}

.home-view .recent-connections .placeholder {
    margin: .75rem 0;
    color: var(--muted);
    text-shadow: none;
    opacity: 1;
    text-align: left;
    font-size: 1rem;
    font-weight: 400;
}

.home-view .all-connections .list-item .caption:hover {
    background: transparent;
}

.home-view .home-connection {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .5rem;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: #fff;
    color: var(--ink);
}

.home-view .home-connection:hover, .home-view .home-connection:focus-visible {
    background: #edf7f4;
    border-color: var(--accent);
}

.home-view .home-connection .icon.type {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .6rem;
    background-color: #e0eeeb;
    background-size: 1.25rem;
}

.home-view .home-connection .name {
    flex: 1 1 7rem;
    margin: 0;
    padding: 0;
    font-weight: 650;
    color: var(--ink);
}

.home-view .home-connection .activeUserCount {
    margin: 0;
    color: var(--muted);
    font-size: .875rem;
}

.home-view .home-connection::after {
    content: "";
    width: .45rem;
    height: .45rem;
    border: solid var(--accent);
    border-width: 2px 2px 0 0;
    transform: rotate(45deg);
}

.home-view .recent-connections .remove-recent {
    visibility: visible;
    width: 1.75rem;
    height: 1.75rem;
    padding: .4rem;
    border-radius: 50%;
    background: white;
    opacity: .9;
}

.home-view .all-connections .icon.expand {
    width: 2.75rem;
    height: 2.75rem;
}

.login-ui :focus-visible, .home-view :focus-visible {
    outline: 3px solid #05777d;
    outline-offset: 2px;
}

@media (max-width: 38rem) {
    .home-view .home-connection {
        display: grid;
        grid-template-columns: 2.5rem minmax(0, 1fr) .6rem;
        grid-template-areas: "icon name arrow";
        row-gap: .125rem;
    }

    .home-view .home-connection:has(.activeUserCount:not(.ng-hide)) {
        grid-template-areas: "icon name arrow" "icon usage arrow";
    }

    .home-view .home-connection .icon { grid-area: icon; }
    .home-view .home-connection .name { grid-area: name; }
    .home-view .home-connection .activeUserCount { grid-area: usage; }
    .home-view .home-connection::after { grid-area: arrow; }

    .home-view .header .filter {
        order: 1;
        flex-basis: 100%;
    }

    .home-view .header .user-menu {
        margin-inline-start: auto;
    }

    .home-view .recent-connections .connection {
        margin-inline: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-ui, .login-ui.error .login-dialog {
        animation: none;
    }
}
