@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --default-font-size: 16px;
    --default-line-height: 1.5;
    --default-color: #161616;
    --default-background: #f3f3f3;
    --sidebar-width: 5rem;
    --sidebar-width-expand: 12.5rem;
    --header-height: 70px;
    --header-height-long: 78px;
    --footer-height: 50px;
    --sidebar-background: #29201d;
    --sidebar-color: #fff;
    --header-background: #fff;
    --header-color: #161616;
    --footer-background: #f3f3f3;
    --footer-color: #161616;
    --app-border-color: #dbdbdb;
    --widget-background: #fff;
    --widget-color: #161616;
    --wide-mode: 1200px;
    --main-padding: 8px;
    --grid-padding: 4px;
    --entities-panel-size: 220px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Roboto, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: var(--default-line-height);
    color: var(--default-color);
    background-color: var(--default-background);
    height: 100vh;
}

header {
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-start;
    align-items: center;
    padding: 0 10px;
    background-color: var(--header-background);
    color: var(--header-color);
    position: relative;
    
    .app-title {
        font-size: clamp(1.25rem, 2vw, 2rem);
        font-weight: 600;
        display: flex;
        align-items: center;
    }
    
    .query-name {
        display: flex;
        flex: 0 0 100%;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font-size: 16px;
        font-weight: 500;
        flex-flow: row nowrap;
        margin-left: auto;
        border: 1px dashed #ccc;
        padding: 2px;
        border-radius: 6px;
    }

    .main-toolbar {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        padding: 10px 0;
        gap: 2px;
        position: relative;
        margin-left: auto;
    }
    
    @media (min-width: 768px) {
        .main-toolbar {
            gap: 10px;
        }
    }
    
    @media (min-width: 1200px) {
        border-bottom: 1px solid var(--app-border-color);
        .query-name {
            flex-basis: auto;
            margin-bottom: 0;
            border: none;
        }
        
        .main-toolbar {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            padding: 0;
            
            .tool-button {
                width: 36px;
                height: 36px;
            }
        }
    }
}

#sidebar {
    grid-area: sidebar;
    background-color: var(--sidebar-background);
    color: var(--sidebar-color);
    padding: 10px;
    
    .logo {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        line-height: 1.3;
        height: 48px;
        font-size: 2rem;
        margin-left: 10px;
        
        img {
            width: auto;
            height: 100%;
        }
        
        .close-sidebar-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            background-color: transparent;
            color: #ffffff;
            cursor: pointer;
            position: absolute;
            inset: 0.5rem 0.5rem auto auto;

            @media (min-width: 768px) {
                display: none;
            }
        }
    }
    
    .btn-toggle-sidebar {
        position: absolute;
        inset: 3.5rem -0.75rem auto auto;
        width: 1.5rem;
        aspect-ratio: 1 / 1;
        background-color: var(--sidebar-background);
        border: transparent;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 0 0 1px #ccc;
        transition: all 0.2s ease-in-out;
        color: #fff;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        @media (hover: hover) {
            &:hover {
                background-color: #ffffff;
                color: #191919;
            }
        }
        @media (hover: none) {
            &:active {
                background-color: #ffffff;
                color: #191919;
            }
        }
    }
    
    .sidebar-menu {
        display: flex;
        margin-top: 2rem;
        flex-direction: column;
        
        li, a {
            display: flex;
            align-items: center;
        }
        
        a {
            padding: 0.5rem 1rem;
            color: var(--sidebar-color);
            text-decoration: none;
            font-size: 14px;
        }
        
        .icon {
            width: 1.5rem;
            height: 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 0.5rem;
            position: relative;
            
            * {
                width: 100%;
                height: 100%;
            }
        }
        
        .caption {
            display: none;
        }
        
        .separator {
            height: 1px;
            background-color: #6a6a6a;
            margin: 0.5rem 0;
        }
    }
}

body.sb-expand #sidebar {
    .sidebar-menu {
        .caption {
            display: flex;
        }
    }
}

main {
    grid-area: content;
    padding: var(--main-padding);
    background-color: #fff;
    container-name: content;
    container-type: inline-size;
    height: calc(100vh - var(--header-height-long));
    overflow: auto;
    
    @media (min-width: 768px) {
        height: calc(100vh - var(--header-height));
    }
}

.easyquery-container {
    & > div {
        padding: 0 6px;
        border: 1px solid var(--app-border-color);
        border-radius: 8px;
    }
    
    .expand-vertical-icon { display: flex; }
    .expand-horizontal-icon { display: none; }
}

.easyquery-container {
    @media (min-width: 1400px) {
        .expand-vertical-icon { display: none; }
        .expand-horizontal-icon { display: flex; }
    }
}

.widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    
    .widget-title {
        font-size: 1rem;
        font-weight: 600;
        height: 36px;
        border-bottom: 1px solid var(--app-border-color);
        display: flex;
        align-items: center;
        gap: 10px;
        
        .widget-toolbar {
            margin-left: auto;
        }
    }
    
    .widget-content {
        height: 100%;
        overflow-y: auto;
    }
    
    .expand-horizontal-icon, .expand-vertical-icon {
        padding: 0!important;
    }
}

.toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    background-color: var(--widget-background);
    gap: 2rem;
    position: relative;
    
    .tool-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--app-border-color);
        border-radius: 4px;
        background-color: var(--widget-background);
        color: var(--widget-color);
        cursor: pointer;
        transition: background-color 0.2s ease-in-out;
        gap: 6px;
        height: 24px;
        width: 24px;
        
        @media (hover: hover) {
            &:hover {
                background-color: #f0f0f0;
            }
        }
        
        @media (hover: none) {
            &:active {
                background-color: #f0f0f0;
            }
        }

        .icon {
            width: 1rem;
            height: 1rem;
            font-size: 1rem;
            object-fit: contain;
            
            * {
                width: 100%;
                height: 100%;
                object-fit: contain;
            }
        }
        
        &.thin-button {
            padding: 6px;
            border: none
        }
    }
    
    .toolbar-group {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
    }
}

.widget-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 400;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.export-toolbar {
    margin: 0 0 0 auto;
}

.transform-button {
    width: 36px;
    height: 36px;
    background-size: 1rem 1rem;
    background: center center no-repeat;
    text-indent: -9999px;
    border: 0;
    display: inline-block;
    cursor: pointer;
    z-index: 2;
    position: relative;
    outline: none;
    margin-right: .5rem;

    span {
        position: absolute;
        left: .5rem;
        width: 1.2rem;
        height: 2px;
        margin: 0 0 0;
        background: #191919;
        rotate: 0;
        transition: rotate .3s linear;

        &:before, &:after {
            content: '';
            position: absolute;
            top: -.35rem;
            right: 0;
            width: 1.2rem;
            height: 2px;
            background: #191919;
            transition: rotate .3s linear;
        }

        &:after {
            top: .35rem;
        }
    }
    
    &.transform {
        span {
            rotate: 180deg;

            &:before, &:after {
                content: '';
                top: -5px;
                right: 0;
                width: .75rem;
                rotate: 45deg;
            }

            &:after {
                top: 5px;
                rotate: -45deg;
            }
        }
    }
    
    @media (min-width: 1200px) {
        display: none;
    }
}

.no-wrap {
    white-space: nowrap;
}

.columns-panel, .conditions-panel {
    padding-bottom: 6px!important;
}

.result-panel {
    width: 100%;
    overflow: auto;
}