html, body {
    height: 100%;
    margin: 0;
}

/* Grid layout */
.grid-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 1fr auto 1fr;
    width: 100%;
    height: 100%;
}
.grid-item {
    display: flex;
    align-items: center;
    background-color: rgb(20, 20, 20);
    border: none;
}
.grid-item:nth-child(2) {
    position: relative;
}
.grid-item:nth-child(5) {
    justify-content: flex-start;
}

/* Login text */
.user-login-text {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 900;
    opacity: 0;
    transition: opacity 0.1s;
    text-align: center;
    white-space: nowrap;
}
.user-login-text.show {
    opacity: 1;
}
.user-portal {
    color: rgb(210, 210, 210);
}
.sign-in {
    color: rgb(70, 70, 70);
    margin-left: 8px;
}

/* Button container and buttons */
#buttonContainer {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 300px;
    margin: 0;
    padding: 0;
    background-color: rgb(20, 20, 20);
    position: relative;
    height: 40px;
}
#backButton,
#forgetPasswordButton {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgb(50, 50, 50);
    margin: 0 !important;
    position: absolute;
    padding: 0 !important;
    outline: none;
    box-shadow: none;
    min-width: 0;
    min-height: 0;
}
#backButton {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}
#forgetPasswordButton {
    left: 38px; /* 18px icon + 8px gap + some padding */
    top: 50%;
    transform: translateY(-50%);
}
#backButton:focus,
#forgetPasswordButton:focus {
    outline: none !important;
    box-shadow: none !important;
}
#backButton ion-icon {
    font-size: 30px;
    margin: 0 !important;
    margin-left: -2px !important; /* Pull icon flush left */
    padding: 0 !important;
    display: block;
    line-height: 1;
}
#forgetPasswordButton ion-icon {
    font-size: 30px;
    margin: 0 !important;
    margin-left: -5px !important; /* Pull icon flush left */
    padding: 0 !important;
    display: block;
    line-height: 1;
}
#loginButton {
    width: 150px;
    margin: 0;
    padding: 0px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}
#backButton:hover, #forgetPasswordButton:hover {
    color: rgb(170, 170, 170);
}

/* Login form container */
#loginFormDiv {
    opacity: 0;
    transition: opacity 0.1s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
#loginFormDiv.show {
    opacity: 1;
}

/* Login hint */
.login-hint {
    margin: 0px 0 10px 0;
    color: #aaa;
    font-size: 12px;
    text-align: center;
    max-width: 300px;
    user-select: none;
}
.login-hint .interactive-below {
    color: #1976d2;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}
.login-hint .interactive-below.active {
    color: #0d47a1;
}

/* Login form */
#loginForm {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    width: 300px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(.4,0,.2,1);
}
#loginForm.open {
    max-height: 700px;
}
#loginForm label {
    color: white;
    font-size: 14px;
}
#loginForm input::placeholder {
    color: rgb(200, 200, 200);
    font-style: italic;
}
#loginForm input {
    font-size: 14px;
    color: rgb(20, 25, 50);
    width: 100%;
    padding: 5px;
    background: white;
    border: none;
    border-radius: 5px;
    box-sizing: border-box;
}
#loginForm input[type="text"] {
    margin-bottom: 15px;
    background-color: rgb(230, 230, 230);
}
#loginForm input[type="password"] {
    margin-bottom: 5px;
    background-color: rgb(230, 230, 230);
}
#loginForm input[type="submit"] {
    background-color: rgb(30, 30, 30);
    color: rgb(230, 230, 230);
    border: 1px solid rgb(110, 110, 110);
    cursor: pointer;
    width: 70px;
    border-radius: 20px;
    font-size: 12px;
    font-style: normal;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 3px;
}
#loginForm input:focus {
    outline: none;
    box-shadow: none;
    border-bottom: none;
}

/* Passkey button */
#passkeyLoginButton {
    width: 300px;
    max-width: 300px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Avenir', sans-serif;
    font-weight: 100;
    padding: 12px 0;
    margin: 20px 0 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}
#passkeyLoginButton:hover, #passkeyLoginButton:focus {
    background: #1565c0;
    color: #fff;
}
#passkeyLoginButton ion-icon {
    font-size: 22px;
    margin-right: 6px;
}

/* Synology-style loader animation */
.sharentis-loader {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    height: 40px;
}
.sharentis-loader .block {
    width: 18px;
    height: 38px;
    background: #fff;
    border-radius: 6px;
    opacity: 0.85;
    animation: sharentisBounce 1s infinite;
}
.sharentis-loader .block:nth-child(2) {
    animation-delay: 0.15s;
}
.sharentis-loader .block:nth-child(3) {
    animation-delay: 0.3s;
}
.sharentis-loader .block:nth-child(4) {
    animation-delay: 0.45s;
}
@keyframes sharentisBounce {
    0%, 100% { transform: scaleY(1); opacity: 0.85; }
    20% { transform: scaleY(1.4); opacity: 1; }
    40% { transform: scaleY(0.7); opacity: 0.7; }
    60% { transform: scaleY(1.2); opacity: 0.9; }
    80% { transform: scaleY(1); opacity: 0.85; }
}