:root {
    --map-width: 75%;
    --map-offset-x: -30px;
    --map-offset-y: -30px;
}

html,
body {
    overflow-x: hidden;
}

/* Fix for selection changing width inside tooltip
   https://github.com/MudBlazor/MudBlazor/issues/1167#issuecomment-826156057 */
.mud-tooltip-root {
    display: flex !important;
}

ul {
    margin-left: 20px;
}

.page-container {
    margin-top: 0;
    padding-left: 12px;
    padding-right: 12px;
}

.site-header {
    min-width: 0;
}

.logo-image {
    display: block;
    width: 100%;
    max-width: 470px;
    height: auto;
}

.logo-text {
    display: block;
    color: #cb1574;
    font-size: clamp(24px, 6vw, 34px);
    font-weight: bold;
    letter-spacing: 3px;
    position: static;
    margin: 0.5rem 0 0 0;
}

.co2-planner-text {
    color: #5aaf00;
    font-size: clamp(12px, 4vw, 20px);
    font-weight: bold;
    letter-spacing: 3px;
    position: relative;
    top: -18px;
}

.return-link {
    float: none;
    display: block;
    margin-top: 1rem;
}

.return-link .fab-container-vertical {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.return-link .fab-container-vertical .mud-fab {
    margin-top: 0 !important;
}

.infoscreen-border {
    border: 1px solid #cb1574;
    border-top: 3px solid #cb1574;
}

.filter-row {
    min-height: 0;
}

.filter-row .mud-input-control,
.filter-row .mud-select {
    width: 100%;
}

.download-button,
.download-button * {
    white-space: nowrap !important;
}

.download-button,
.download-button .mud-button-label {
    flex-wrap: nowrap !important;
}

.download-button .mud-button-icon-start,
.download-button .mud-button-icon-end {
    flex: 0 0 auto;
}

.mud-drawer {
    max-width: 100vw;
}

.drawer-inner {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; 
    margin: 0;
}

.drawer-main {
    flex: 1;
    background-color: #f0f0f0;
    overflow: auto;
    margin: 0;
}

.drawer-bottom {
    height: 50px;
    background-color: #333;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.panel-item {
    display: block;
}

.full-height-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1 1 auto;
}

.left-panel,
.map-panel {
    padding: 0.75rem;
    box-sizing: border-box;
    height: auto;
}

.left-panel {
    padding: 5px;
}

.left-panel-inner {
    flex: 1 1 auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: scroll;
}

.map-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-box {
    position: relative;
    background-image: none;
}

.map-box::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
}

.map-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.25rem;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.campaign-box {
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    min-height: 149px;
    text-align: center;
    border: 5px solid #cb1574;
    border-radius: 10px;
    background: #ffffff;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.campaign-box .screens-header {
    font-weight: bold;
    font-size: 24px;
}

.campaign-box .screens-number {
    font-size: 40px;
    color: #cb1574;
    font-weight: bold;
    line-height: 1.1;
}

.campaign-box .screens-text {
    font-weight: bold;
}

.austria-map-box {
    display: none;
}

.region-info {
    flex: 0 0 auto;
    margin: 0;
    position: relative;
    z-index: 2;
    visibility: hidden;
}

.region-title {
    color: #cb1574;
}

.region-details strong {
    color: #cb1574;
}

.austria-map {
    display: block;
    width: 100%;
    max-width: 810px;
    height: auto;
}

.co2item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
    position: relative;
    flex: 0 0 auto;
}

.co2item .co2img {
    width: 50px;
    height: auto;
    flex: 0 0 auto;
}

.co2item .co2text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-grid {
    margin-top: auto;
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
}

.kpi-grid-inner {
    margin-top: 0.5rem;
}

.kpi-grid-inner span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    line-height: 1.35;
}

.kpi-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kpi-actions .download-button {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: none;
    margin: 0 !important;
}

@media (min-width: 600px) {
    .kpi-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .kpi-actions .download-button {
        display: inline-flex;
        width: auto;
        min-width: 260px;
    }

    .campaign-box {
        max-width: 300px;
        margin: 0;
    }
}

@media (min-width: 960px) {
    .page-container {
        margin-top: -50px;
    }

    .logo-image {
        display: inline-block;
        width: 470px;
        height: 70px;
    }

    .logo-text {
        display: inline;
        font-size: 34px;
        position: relative;
        top: -18px;
        margin: 0 0 0 10px;
    }

    .return-link {
        float: right;
        display: inline-block;
        margin-top: 0;
    }

    .return-link .fab-container-vertical {
        flex-direction: column;
        gap: 0;
    }

    .return-link .fab-container-vertical .mud-fab + .mud-fab {
        margin-top: 10px !important;
    }

    .filter-row {
        min-height: 66px;
    }

    .panel-item {
        display: flex;
    }

    .left-panel,
    .map-panel {
        height: clamp(520px, calc(100vh - 260px), 1400px);
        max-height: clamp(520px, calc(100vh - 260px), 1400px);
    }

    .left-panel-inner {
        max-height: 100%;
        overflow-y: auto;
    }

    .map-box {
        background-image: linear-gradient(to right, transparent 15%, white 75%),
        url('../images/background_ulf_trans.svg');
        background-position: 0 0, -230px -190px;
        background-repeat: no-repeat;
        background-size: 100% auto;
    }
    
    .map-section {
        padding: 0.5rem 0.5rem 64px 0.5rem;
        gap: 0.75rem;
        min-height: 0;
        flex: 1 1 auto;
    }

    .austria-map-box {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        width: 100%;
        position: relative;
        z-index: 1;
        flex: 1 1 auto;
        min-height: 0;
        overflow: visible;
    }

    .region-info {
        position: absolute;
        top: 0;
        left: 0;
        width: 340px;
        min-width: 220px;
        z-index: 2;
    }
    
    .austria-map {
        flex: 0 0 auto;
        width: var(--map-width);
        max-width: none;
        min-width: 0;
        height: auto;
        max-height: none;
        position: relative;
        top: var(--map-offset-y);
        left: var(--map-offset-x);
        z-index: 1;
        align-self: center;
        margin: 0 auto;
    }

    .campaign-box {
        margin-top: 0.5rem;
    }
    
    .co2item {
        position: absolute;
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.25rem;
        margin: 0;
        z-index: 4;
    }

    .kpi-grid-inner span {
        font-size: 1rem;
    }

    .kpi-actions {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }

    .kpi-actions .download-button {
        display: inline-flex;
        width: auto;
        min-width: 260px;
        max-width: none;
        margin: 0 !important;
    }
    
    .kpi-grid-inner > .mud-grid-item:nth-child(3) {
        margin-right: 25%;
    }
}

@media (min-width: 1280px) {
    .kpi-grid > .mud-grid-item.kpi-actions {
        flex: 0 0 auto;
        width: auto;
        min-width: 270px;
        max-width: none;
    }

    .kpi-grid > .mud-grid-item:not(.kpi-actions) {
        flex: 1 1 0;
        width: auto;
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 599.98px) {
    .mud-drawer {
        width: min(400px, 92vw) !important;
    }

    .campaign-box {
        padding: 14px;
        min-height: 0;
    }

    .campaign-box .screens-header {
        font-size: 20px;
    }

    .campaign-box .screens-number {
        font-size: 34px;
    }

    .left-panel,
    .map-panel {
        padding: 0.5rem;
    }
}

@media (min-width: 960px) and (max-height: 640px) {
    .left-panel,
    .map-panel {
        height: auto;
        max-height: none;
        min-height: 480px;
    }
}