﻿:root {
    --gis-popup-backdrop: rgba(0, 0, 0, 0.4);
    --gis-popup-shadow: 0 0 25px rgba(0, 0, 0, 0.3);
    --gis-popup-border: 1px solid #ccc;
    --gis-popup-bg: #fff;
    --gis-z-index: 1050;
    /* Colori Pulsanti Header */
    --gis-btn-hover-bg: #e0e0e0;
    --gis-btn-close-hover-bg: #e81123;
    --gis-btn-close-hover-color: #333;
}

dialog.gis-dialog-frame {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: var(--gis-popup-shadow);
    color: inherit;
    z-index: var(--gis-z-index);
    max-width: 100vw !important;
    max-height: 100vh !important;
    position: fixed;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    outline: none;

    &[open] {
        animation: gis-fade-in 0.2s ease-out;
    }

    &::backdrop {
        background-color: var(--gis-popup-backdrop);
        animation: gis-fade-in 0.2s ease-out;
    }
}

@keyframes gis-fade-in {
    from {
        opacity: 0;
        transform: scale(0.99);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gis-popup {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    flex: 1;
    background-color: var(--gis-popup-bg);
    border: var(--gis-popup-border);
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 0;
}

.gis-popup-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 7px 0 15px;
    height: 50px;
    border-bottom: 0px solid #eee;
    background-color: #ffffff;
    cursor: default;
    user-select: none;
    touch-action: none;
    max-width: 100dvw;
}

.gis-header-shadow {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    z-index: 10;
    position: relative;
}

.gis-popup-header > span {
    order: 0;
    flex-grow: 1;
    padding-left: 0px;
    font-size: 21px;
    font-weight: 600;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: grab;
    height: 100%;
    display: flex;
    align-items: center;
}

    .gis-popup-header > span:active {
        cursor: grabbing;
    }

.gis-header-btn {
    width: 28px;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #888;
    transition: background-color 0.2s, color 0.2s;
    outline: none;
}

    .gis-header-btn:hover {
        color: var(--gis-btn-close-hover-color);
    }

.gis-btn-minimize {
    order: 90;
    font-size: 22px;
    line-height: 18px;
}

.gis-btn-maximize {
    order: 95;
    font-size: 19px;
}

.gis-btn-close {
    order: 100;
    font-size: 15px;
}

.gis-popup-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px 10px 15px 15px;
    border-right: 5px solid transparent;
    scrollbar-gutter: stable;
    position: relative;
    background-color: #fff;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.gis-popup-footer {
    padding: 10px 15px;
    background-color: #ffffff;
    border-top: 0px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.gis-footer-shadow {
    box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.1), 0 -2px 4px -1px rgba(0,0,0,0.06);
    z-index: 10;
    position: relative;
}

dialog.gis-dialog-frame[data-maximized="true"] {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    border: none;

    .gis-popup {
        border: none;
    }

    .gis-resize-handle {
        display: none;
    }
}

dialog.gis-dialog-frame[data-minimized="true"] {
    position: fixed;
    top: auto !important;
    bottom: 0 !important;
    left: 10px !important;
    width: 350px !important;
    height: auto !important;
    min-height: 0 !important;
    height: 50px !important;
    margin: 0;

    .gis-popup {
        grid-template-rows: auto 0 0;
        border-bottom: none;
        border-radius: 0;
    }

    .gis-popup-body, .gis-popup-footer {
        padding: 0;
        opacity: 0;
        overflow: hidden;
    }

    .gis-resize-handle {
        display: none;
    }
}

.gis-resize-handle {
    position: absolute;
    z-index: 100;
    touch-action: none;
}

.gis-resize-se {
    width: 15px;
    height: 15px;
    bottom: 0;
    right: 0;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, #ccc 50%);
}

.gis-resize-e {
    width: 8px;
    top: 0;
    bottom: 15px;
    right: 0;
    cursor: e-resize;
}

.gis-resize-s {
    height: 8px;
    left: 0;
    right: 15px;
    bottom: 0;
    cursor: s-resize;
}
