/*
 * Licata in Comune v1.4.0
 * Ottimizzazione browser Android e iPhone
 */

html{
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
    scroll-behavior:smooth;
}

body{
    min-height:100vh;
    min-height:100dvh;
    padding-left:env(safe-area-inset-left);
    padding-right:env(safe-area-inset-right);
    overflow-x:hidden;
}

button,
input,
select,
textarea{
    font-size:16px;
}

button,
.btn,
a,
input,
select,
textarea,
.upload-button{
    touch-action:manipulation;
}

.mobile-menu-button{
    display:none;
    width:46px;
    height:46px;
    padding:11px;
    border:0;
    border-radius:12px;
    background:#eef5f8;
    cursor:pointer;
    flex:0 0 46px;
}

.mobile-menu-button span{
    display:block;
    width:100%;
    height:2px;
    margin:5px 0;
    border-radius:999px;
    background:var(--navy);
    transition:
        transform .2s ease,
        opacity .2s ease;
}

.mobile-menu-button[aria-expanded="true"] span:nth-child(1){
    transform:translateY(7px) rotate(45deg);
}

.mobile-menu-button[aria-expanded="true"] span:nth-child(2){
    opacity:0;
}

.mobile-menu-button[aria-expanded="true"] span:nth-child(3){
    transform:translateY(-7px) rotate(-45deg);
}

.mobile-menu-backdrop{
    position:fixed;
    inset:0;
    z-index:39;
    background:rgba(16,24,40,.42);
    backdrop-filter:blur(2px);
}

.mobile-menu-backdrop[hidden]{
    display:none;
}

.mobile-menu-open{
    overflow:hidden;
}

@media(max-width:900px){

    .site-header{
        height:68px;
        padding:
            env(safe-area-inset-top)
            14px
            0;
        z-index:40;
    }

    .brand{
        min-width:0;
    }

    .brand-logo{
        width:40px;
        height:40px;
        flex:0 0 40px;
    }

    .brand-copy{
        min-width:0;
    }

    .brand strong{
        white-space:nowrap;
    }

    .brand small{
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }

    .mobile-menu-button{
        display:block;
    }

    .site-navigation{
        position:fixed;
        top:calc(68px + env(safe-area-inset-top));
        right:10px;
        left:10px;
        z-index:41;
        display:none;
        max-height:calc(
            100dvh
            - 82px
            - env(safe-area-inset-top)
            - env(safe-area-inset-bottom)
        );
        padding:12px;
        overflow-y:auto;
        border:1px solid var(--line);
        border-radius:16px;
        background:#ffffff;
        box-shadow:0 22px 55px rgba(16,24,40,.22);
    }

    .site-navigation.is-open{
        display:grid;
        gap:5px;
    }

    .site-navigation a,
    .site-navigation .user-pill{
        display:flex !important;
        width:100%;
        min-height:46px;
        align-items:center;
        padding:11px 13px;
        border-radius:10px;
        font-size:.9rem;
    }

    .site-navigation a:hover,
    .site-navigation a:focus-visible{
        background:#eef5f8;
    }

    .site-navigation .btn{
        justify-content:center;
    }

    .site-navigation .user-pill{
        min-height:auto;
        margin-top:5px;
        background:var(--sky);
    }

    .navigation-logout{
        margin-top:5px;
        border-top:1px solid var(--line);
        color:var(--red);
    }

    .container{
        width:calc(100% - 24px);
        padding:20px 0 calc(45px + env(safe-area-inset-bottom));
    }

    .hero{
        min-height:auto;
        gap:28px;
        padding:20px 0;
    }

    .hero h1{
        font-size:clamp(2rem,10vw,2.7rem);
    }

    .hero-actions,
    .inline-actions,
    .filter-bar,
    .map-actions,
    .modal-actions{
        flex-direction:column;
        align-items:stretch;
    }

    .hero-actions .btn,
    .inline-actions .btn,
    .filter-bar .btn,
    .map-actions .btn,
    .modal-actions .btn{
        width:100%;
        min-height:48px;
    }

    .phone-mock{
        width:min(255px,85vw);
    }

    .form-grid,
    .detail-grid,
    .features,
    .kpi-grid,
    .map-filters{
        grid-template-columns:1fr !important;
    }

    .form-grid .full{
        grid-column:1;
    }

    .page-head{
        gap:12px;
        align-items:stretch;
    }

    .page-head .btn{
        width:100%;
    }

    .panel,
    .auth-card,
    .service-note,
    .report-card{
        border-radius:14px;
    }

    .auth-card{
        width:100%;
        margin:10px auto;
    }

    .report-card{
        gap:12px;
        align-items:flex-start;
    }

    dl{
        grid-template-columns:1fr;
        gap:3px;
    }

    dd{
        margin-bottom:12px;
        font-size:.9rem;
    }

    .table-wrap{
        margin-right:-2px;
        padding-bottom:6px;
        -webkit-overflow-scrolling:touch;
    }

    table{
        min-width:720px;
    }

    th,
    td{
        padding:12px 10px;
    }

    .map,
    #pickMap,
    #reportMap{
        height:min(58vh,460px) !important;
        min-height:330px !important;
    }

    #adminMap{
        height:min(68vh,620px) !important;
        min-height:420px !important;
    }

    .leaflet-control-zoom a{
        width:38px !important;
        height:38px !important;
        line-height:38px !important;
    }

    .photo-buttons{
        display:grid;
        grid-template-columns:1fr;
    }

    .upload-button{
        min-height:48px;
        width:100%;
    }

    .photo-preview-grid{
        grid-template-columns:repeat(2,1fr);
    }

    .photo-preview-grid img{
        height:120px;
    }

    .checkbox{
        min-height:50px;
    }

    .checkbox input[type="checkbox"]{
        width:22px !important;
        height:22px !important;
        min-width:22px;
    }

    .modal-overlay{
        align-items:end;
        padding:
            12px
            12px
            calc(12px + env(safe-area-inset-bottom));
    }

    .modal-card{
        max-height:88dvh;
        overflow-y:auto;
        border-radius:18px 18px 14px 14px;
        padding:21px 18px;
    }

    .duplicate-list>div{
        gap:9px;
        align-items:flex-start;
    }

    .site-footer{
        padding:
            26px
            16px
            calc(26px + env(safe-area-inset-bottom));
    }
}

@media(max-width:480px){

    .site-header{
        padding-left:10px;
        padding-right:10px;
    }

    .brand small{
        display:none;
    }

    .container{
        width:calc(100% - 18px);
    }

    .panel,
    .auth-card,
    .service-note{
        padding:16px;
    }

    .features,
    .kpi-grid{
        grid-template-columns:1fr !important;
    }

    .kpi strong{
        font-size:1.7rem;
    }

    .photo-preview-grid{
        grid-template-columns:1fr 1fr;
        gap:7px;
    }

    .photo-preview-grid img{
        height:105px;
    }

    .map,
    #pickMap,
    #reportMap{
        min-height:300px !important;
    }

    #adminMap{
        min-height:390px !important;
    }
}

@media(hover:none) and (pointer:coarse){

    .btn,
    button,
    input,
    select,
    textarea,
    .upload-button{
        min-height:46px;
    }

    a:focus-visible,
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible{
        outline:3px solid rgba(34,163,198,.35);
        outline-offset:2px;
    }
}

/* Release 1.1: barra mobile inferiore rimossa */
.mobile-bottom-nav,.bottom-navigation,.bottom-nav{display:none!important;}
@media(max-width:900px){body{padding-bottom:env(safe-area-inset-bottom)!important}.filter-bar{gap:8px}.filter-bar label{margin:0}.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}}
