:root {
    --blue: #06b4f2;
    --blue_hover: #0da4dc;
    --red: #c92e2e;
    --grey_btn: #e0e0e0;
    --grey_btn_hover: #c8c8c8;
    --text_muted: rgb(189, 189, 189);
    --surface: oklab(0.2303 -0.0008 -0.0083);
    --field_bg: rgba(255, 255, 255, 0.1);
    --field_border: #ccc;
    --focus_shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

/* ---------- Layout ---------- */

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    background: url('background.webp') center / cover no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    color: oklab(0.9067 -0 0);
    font-family: Arial, sans-serif;
}

.main_content {
    max-width: 35rem;
    min-width: 35rem;
    min-height: 35rem;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--surface);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    margin: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.main_content.auto_height {
    min-height: auto;
}

.l_logo {
    display: flex;
    justify-content: center;
}

.l_logo img {
    width: 80%;
    height: auto;
    border-radius: 4px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 10px 0 0;
    text-align: left;
}

strong {
    font-weight: 600;
}

.red_separator {
    width: 100%;
    height: 0;
    border-bottom: 2px dashed var(--red);
    border-image: linear-gradient(90deg, var(--red) 0%, var(--red) 70%, transparent 90%, transparent 100%) 1;
    margin-bottom: 20px;
}

.l_div {
    margin-top: 10px;
}

.text_blue {
    color: var(--blue);
}

.hidden {
    display: none!important;
}

.legal_information {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.505);
}

/* ---------- Form ---------- */

.l_div_form {
    height: 100%;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

form {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.l_div_input {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid var(--field_border);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: var(--field_bg);
    color: white;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: var(--blue);
    outline: none;
    box-shadow: var(--focus_shadow);
}

input::placeholder {
    color: var(--text_muted);
    opacity: 1;
}

.err_message {
    width: 100%;
    color: var(--red);
    padding: 5px 0;
    text-align: center;
    font-size: large;
    border: 1px rgb(56, 56, 56) solid;
    background-color: rgba(56, 56, 56, 0.564);
    border-radius: 8px;
    margin-bottom: 20px;
}

/* ---------- Buttons ---------- */

input[type="button"],
input[type="submit"],
.l_soft_open,
.l_soft_lm {
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: var(--blue);
    color: white;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

input[type="button"]:hover,
input[type="submit"]:hover,
.l_soft_open:hover {
    background-color: var(--blue_hover);
}

/* Full width button pushed at the bottom of the form */
.l_btn {
    width: 100%;
    margin-top: auto;
    margin-bottom: 10px;
}

/* Only the first button is pushed down, the next ones stay stacked under it */
.l_btn + .l_btn {
    margin-top: 0;
}

/* Secondary button: outlined, so it doesn't compete with Submit / Open */
input[type="button"].l_back {
    background-color: transparent;
    border: 1px solid var(--field_border);
    color: var(--text_muted);
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

input[type="button"].l_back:hover {
    background-color: var(--field_bg);
    border-color: var(--blue);
    color: white;
}

.l_soft_list + .l_back {
    margin-top: 20px;
}

/* ---------- Generated links ---------- */

.l_url_container, .l_sign_container {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 8px 0;
    border: 1px solid var(--field_border);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: var(--field_bg);
    color: white;
    transition: border-color 0.3s;
    overflow: hidden;
}

.l_url_container:hover, .l_sign_container:hover {
    box-shadow: var(--focus_shadow);
}

.l_url_text, .l_sign_text {
    padding: 14px 15px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: white;
    text-decoration: none;
}

.l_url_text:hover {
    text-decoration: underline;
    font-weight: 500;
}

.qr_code_div {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.qr_code_div img {
    object-fit: contain;
    width: 50%;
    max-width: 200px;
}

/* Icon buttons (info, open, copy, view) */
.row_btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 4px;
    padding: 0 8px;
}

.row_btn.on_input {
    position: absolute;
    right: 0;
    top: 8px;
    bottom: 8px;
}

/* Keep the typed text from going under the icon */
.l_div_input input[type="text"] {
    padding-right: 52px;
}

.row_btn > div, .row_btn > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.75;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s, transform 0.1s;
}

.row_btn > div:hover, .row_btn > a:hover {
    background-color: var(--field_bg);
    border-color: rgba(255, 255, 255, 0.25);
    opacity: 1;
}

.row_btn > div:active, .row_btn > a:active {
    transform: scale(0.9);
}

.row_btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
}

/* ---------- Modals ---------- */

.overlay_modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: rgba(64, 59, 59, 0.767);
}

.modal {
    width: 50rem;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 20px;
    background-color: rgb(32, 29, 29);
    border: solid 1px rgb(116, 106, 106);
    border-radius: 15px;
    box-shadow: 0 4px 12px black;
}

.head_modal {
    display: flex;
    align-items: center;
    gap: 15px;
}

.close_modal {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 32px;
    width: 32px;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text_muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s ease-out;
}

.close_modal:hover {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: var(--blue);
    color: white;
    transform: rotate(360deg);
}

.close_modal:active {
    transform: rotate(360deg) scale(0.9);
}

.display_id {
    text-align: left;
}

.display_soft {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.display_soft img {
    width: 220px;
    max-width: 70%;
    height: auto;
}

.display_soft p {
    margin: 0;
}

.display_soft .l_soft_actions {
    width: 100%;
    margin-top: 10px;
}

/* ---------- Deeplink redirection: one card per software ---------- */

.l_soft_list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.l_soft_card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.l_soft_card:hover {
    border-color: var(--blue);
    box-shadow: var(--focus_shadow);
}

.l_soft_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 5px;
}

.l_soft_logo {
    display: flex;
    align-items: center;
}

.l_soft_logo img {
    width: 138px;
    height: auto;
}

.l_soft_name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--blue);
}

.l_soft_desc {
    margin: 0;
    color: var(--text_muted);
}

.l_soft_actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.l_soft_open {
    flex: 1;
}

/* Spin loader shown while the deeplink is being opened */
.l_soft_open.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: wait;
    opacity: 0.85;
}

.l_soft_open.loading::before {
    content: "";
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: l_spin 0.8s linear infinite;
}

@keyframes l_spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .l_soft_open.loading::before {
        animation-duration: 2s;
    }
}

.l_soft_lm {
    background-color: var(--grey_btn);
    color: var(--surface);
    white-space: nowrap;
}

.l_soft_lm:hover {
    background-color: var(--grey_btn_hover);
}

/* ---------- Error page ---------- */

.l_err h1 {
    margin-top: 5px;
    margin-bottom: 10px;
}

.l_err span {
    display: block;
}

/* .l_err is not a flex container, so .l_btn's margin-top: auto does nothing here */
.l_err .l_back {
    margin-top: 20px;
    margin-bottom: 0;
}

/* ---------- Responsive ---------- */

@media screen and (max-width: 1000px) {
    .main_content {
        width: 90%;
        min-width: auto;
        min-height: auto;
        margin-left: 10px;
        margin-right: 10px;
    }
}

@media screen and (max-width: 799px) {
    .main_content {
        margin-left: 5px;
        margin-right: 5px;
    }

    .l_logo {
        margin-bottom: 15px;
    }

    .l_soft_head {
        flex-direction: column;
        align-items: flex-start;
    }

    .l_soft_actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media screen and (max-width: 399px) {
    .main_content {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}
