﻿@font-face {
    font-family: 'Montserrat';
    src: url(Montserrat-VariableFont_wght.ttf) format('ttf');
}

:root {
    --blue: #005887;
    --white: #fff;
    --ink: #0f2b3a;
    --header: 60px;
    --footer: 64px;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Montserrat',sans-serif;
    background: var(--blue);
    color: var(--white);
    overflow: hidden;
}

/* ====== SCHERMI BASE ====== */
.screen {
    position: fixed;
    inset: 0;
    display: none;
}

    .screen.active {
        display: flex;
    }

/* ====== INTRO ====== */
.intro {
    align-items: center;
    justify-content: center;
    background: var(--blue);
}

    .intro .container {
        text-align: center
    }

    .intro .logo img {
        max-width: 200px;
        height: auto;
        margin-bottom: 30px
    }

.progress-bar {
    width: 260px;
    height: 14px;
    background: rgba(255,255,255,.35);
    border-radius: 7px;
    overflow: hidden;
    margin: 0 auto
}

.progress {
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 7px;
    animation: load 2s forwards
}

@keyframes load {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

/* ====== LOGIN ====== */
.login {
    align-items: center;
    justify-content: center;
    background: var(--blue);
    padding: 20px
}

.card {
    width: min(94vw,420px);
    background: #ffffff;
    color: var(--ink);
    border-radius: 20px;
    padding: 26px 22px;
    box-shadow: 0 18px 50px rgba(0,0,0,.25)
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 8px
}

    .brand img {
        width: 60px;
        height: auto
    }

h1 {
    margin: 0;
    font-size: 1.4rem;
    color: #1b5c76;
    font-weight: 600
}

p.sub {
    margin: .2rem 0 1rem;
    color: #33515f;
    opacity: .85
}

label {
    display: block;
    font-weight: 600;
    margin: .6rem 0 .35rem
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #dbe5ea;
    font: inherit;
    outline: none;
}

input:focus {
    border-color: #7cc4e6;
    box-shadow: 0 0 0 3px rgba(124,196,230,.25)
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: .8rem 0 1.1rem
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .95rem;
    color: #375463
}

.showpass {
    font-size: .9rem;
    color: #375463;
    cursor: pointer;
    user-select: none
}

.btn {
    appearance: none;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer
}

.btn-primary {
    background: #1b5c76;
    color: #fff;
    width: 100%;
    box-shadow: 0 10px 18px rgba(27,92,118,.35)
}

    .btn-primary:active {
        transform: translateY(1px)
    }

.foot {
    margin-top: 10px;
    font-size: .82rem;
    color: #375463;
    opacity: .8
}

.error {
    color: #b40000;
    font-weight: 600;
    display: none;
    margin-bottom: .4rem
}

/* ====== HOME (I TUOI DOCUMENTI) ====== */
.home {
    background: var(--blue);
    color: var(--white);
}

header.app {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--header);
    background: var(--blue);
    color: var(--white);
    display: grid;
    place-items: center;
    padding-top: calc(8px + env(safe-area-inset-top));
    font-weight: 500;
    font-size: 1.2rem;
}

main.app {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header);
    bottom: var(--footer);
    height: calc(100svh - var(--header) - var(--footer));
    background: #f2f8fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    overflow: hidden;
}

    main.app img.illustration {
        max-width: 200px;
        margin-bottom: 20px;
    }

    main.app h2 {
        color: var(--ink);
        margin-bottom: 8px;
    }

    main.app p {
        color: #375463;
        max-width: 320px;
    }

footer.app {
    position: fixed;
    inset: auto 0 0 0;
    height: var(--footer);
    background: var(--blue);
    color: var(--white);
    display: flex;
    /*justify-content: space-around;*/
    justify-content: end;
    align-items: center;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

    footer.app a {
        color: var(--white);
        text-decoration: none;
        font-weight: 500;
    }

.fab {
    position: fixed;
    right: 20px;
    bottom: calc(var(--footer) + 16px + env(safe-area-inset-bottom));
}

.action-pill {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border: none;
    cursor: pointer;
    background: linear-gradient(180deg, #0a72a8, #005887);
    color: #fff;
    border-radius: 28px;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

    .action-pill .icon {
        width: 22px;
        height: 22px;
        display: grid;
        place-items: center;
    }

    .action-pill .divider {
        width: 1px;
        height: 24px;
        background: rgba(255,255,255,.45);
    }

    .action-pill svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: #fff;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .action-pill:active {
        transform: translateY(1px);
    }

/* ====== REVIEW (post-scan) ====== */
.review {
    position: fixed;
    inset: 0;
    background: #eef3f6;
    color: #0b2d3a;
    display: none;
    flex-direction: column;
}

    .review.active {
        display: flex;
    }

    .review header {
        background: #005887;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        font-weight: 500;
    }

        .review header .title {
            font-weight: 500;
        }

        .review header .link {
            font-weight: 500;
            cursor: pointer;
        }

    .review .meta {
        background: #7e8c95;
        color: #fff;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        font-weight: 500;
    }

        .review .meta input {
            background: transparent;
            border: none;
            color: #fff;
            font-weight: 500;
            width: 100%;
            outline: none;
            border-bottom: 1px dashed rgba(255,255,255,.7);
        }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: #0b2d3a;
    border-radius: 10px;
    padding: 6px 10px;
    font-weight: 500;
}

.canvas-area {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    padding-bottom:80px;
}

.page {
    background: #cfd7dd;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 3px 18px rgba(0,0,0,.18);
    max-width: 92vw;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .page img {
        max-width: 100%;
        max-height: 68vh;
        display: block;
    }

.page-indicator {
    margin: 8px auto 0;
    background: #8fa2ad;
    color: #fff;
    border-radius: 12px;
    padding: 6px 10px;
    width: max-content;
}

.link {
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #fff;
    font-size: .85rem;
    cursor: pointer;
}

.toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #005887;
    color: #fff;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    gap: 8px;
}

.tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #fff;
    font-size: .85rem;
    cursor: pointer;
}

    .tool svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: #fff;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

     .link svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: #fff;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        margin-right:4px;
    }

.tool:hover, .link:hover{
    color: yellow;
}

.tool:hover svg, .link:hover svg {
    stroke: yellow
}

@media (prefers-color-scheme: dark) {
    main.app {
        background: #0f2b3a;
    }

        main.app h2, main.app p {
            color: #e6f0f4;
        }
}


.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.custom-modal {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-family: sans-serif;
}

    .custom-modal p {
        margin-bottom: 20px;
        font-size: 16px;
        color: #464646;
    }

    .custom-modal button {
        margin: 5px;
        padding: 8px 16px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
    }

.custom-ok-btn {
    background: #005987;
    color: white;
}

.custom-cancel-btn {
    background: #ccc;
}