﻿/* ----------------------------------------------- */
/* Start Page Customisations, in one common place. */
/* Design philosophy:                              */
/*    Minimum width supported 375px (iPhone SE)    */
/* This file contains some common classes used by  */
/* various components displayed on the StartPage.  */
/* ----------------------------------------------- */

.ts-start-fade-in {
    opacity: 0;
    animation: fadeInAnimation 0.2s ease-in forwards;
}

@keyframes fadeInAnimation {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* --------- Panel sizes & common stuff ---------- */

.ts-startpage-panel-small {
    width: 356px;
    height: 160px;
    box-sizing: border-box;
    flex-shrink: 0;
    flex-grow: 0;
}

.ts-startpage-panel-medium {
    /* ReSharper gives warning for clamp! but it actually exists and works on all Browsers. */
    /*width: clamp(356px, 100%, 600px);*/
    width: 356px;
    height: 450px;
    box-sizing: border-box;
    flex-shrink: 0;
    flex-grow: 0;
}

/* Large panel card behavior and sizing */

.ts-startpage-panel-large {
    height: fit-content;
    box-sizing: border-box;
    flex-shrink: 1;
    flex-grow: 1;
    width: 100%;
    max-width: 100%; /* Don't exceed container */
}

@media (max-width: 1198px) {
    .ts-startpage-panel-large {
        width: 356px;
        min-width: 356px;
        max-width: 356px;
        flex-shrink: 0;
        flex-grow: 0;
    }
}

/* Below 1198px:
   Do NOT hard-lock the outer KPI card container to 356px.
   The inner panel (.ts-startpage-panel-large) is already fixed to 356px below 1198px,
   and the card itself has padding (StartPage.razor.css). Hard-locking the container
   makes this card visibly narrower than the others. */
@media (max-width: 1198px) {
    #ts-kpi-markedskjede-row > div {
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        max-width: none;
    }
}

.ts-startpage-panel-main-title {
    font-size: 17px;
    font-weight: 700;
}

.ts-startpage-link-title {
    font-size: 14px;
    font-weight: 400;
}

.ts-startpage-item-name {
    font-size: 15px;
    font-weight: 600;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* Critical for flex child text truncation */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Prevent hyphenation or word-breaks that can defeat ellipsis */
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
}

/* Wrapper around the name/date texts so they can shrink inside flex row */
.ts-startpage-item-text-container {
    flex: 1 1 auto;
    min-width: 0;
}

.ts-startpage-item-date {
    color: #7E92A2;
    font-size: 14px;
    font-weight: 400;
}

/* ----------------- Mine Kunder ----------------- */

.ts-startpage-minekunder-kunde-number {
    font-size: 48px;
}

/* --------------------- KPI --------------------- */

.ts-startpage-panel-kpi {
    width: 356px;
    height: 450px;
    box-sizing: border-box;
    flex-shrink: 0;
    flex-grow: 0;
}

.ts-startpage-panel-kpi-number {
    font-size: 18px;
}

/* KPI Markedskjede specific dropdown wrappers */

.kpi-markedskjede-select-wrapper,
.kpi-markedskjede-select-wrapper-wide {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto; /* No grow/shrink by default */
    min-width: 220px;
    width: 220px;
    max-width: 100%;
    white-space: nowrap;
    min-height: 30px;
}

/* Ensure inner SearchableSelect wrapper and input fills parent */
.kpi-markedskjede-select-wrapper .searchable-select-wrapper,
.kpi-markedskjede-select-wrapper-wide .searchable-select-wrapper {
    width: 100% !important;
    display: flex;
}

.kpi-markedskjede-select-wrapper .searchable-select-wrapper .form-select.filter-combobox,
.kpi-markedskjede-select-wrapper-wide .searchable-select-wrapper .form-select.filter-combobox {
    width: 100% !important;
    flex: 1 1 auto;
    min-width: 0;
}

/* Allow KPI Markedskjede dropdowns to grow with available space on wider viewports */
@media (min-width: 821px) {
    .kpi-markedskjede-select-wrapper {
        flex: 1 1 300px;
        width: 300px;
        max-width: 500px;
    }

    .kpi-markedskjede-select-wrapper-wide {
        flex: 1 1 300px;
        width: 300px;
        max-width: 500px;
    }

    .kpi-markedskjede-select-wrapper .searchable-select-wrapper,
    .kpi-markedskjede-select-wrapper-wide .searchable-select-wrapper {
        flex: 1 1 auto;
        width: 100% !important;
    }
}

/* ---- Responsive layout for smaller screens ---- */

/*@media (max-width: 820px) {*/
/* NOTE: KEEP THIS NEED TRICK CODE FOR FUTURE REFERENCE */
/* Restrict items to max 4 */
/*.ts-item-restriction {
        padding-bottom: 1rem;
    }

    .ts-item-restriction .row:nth-child(n+5) {
        display: none !important;
    }
}*/
