/**
 * Style dla widoku stanowisk
 * GÃ³rna sekcja: maÅ‚e kafle, dolna sekcja: sÅ‚upki z paletami
 */

/* ============================================
   KONTENER STANOWISK
   ============================================ */
.stations-container {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    gap: 6px;
    overflow: hidden;
}

/* ============================================
   GÃ“RNA SEKCJA: MaÅ‚e kafle (wszystkie stanowiska)
   ============================================ */
.stations-grid-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    padding: 0px;
    flex-shrink: 0;
    width: 92%;
    margin: auto;
    overflow: hidden;
}

/* MaÅ‚y box stanowiska */
.station-box-small {
    display: grid;
    grid-template-rows: auto 1fr;
    /* background-color: var(--grey); */
    border-radius: 4px;
    padding: 0.5rem;
    font-family: var(--fsecond);
}

/* TytuÅ‚ stanowiska (maÅ‚y) */
.station-title-small {
    font-family: var(--fmain);
    text-align: center;
    margin: 12px 0;
    color: var(--lgrey);
    text-transform: uppercase;
    font-size: 1.25rem;
    line-height: 1.2;
}

/* Wrapper stosÃ³w (maÅ‚y) */
.stacks-wrapper-small {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: stretch;
    background-color: var(--grey);
    padding: 0.5rem;
}

/* Pojedynczy stos (maÅ‚y) */
.stack-small {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 7rem;
    /* border-radius: 2px; */
    padding: 0.25rem;
}

/* Liczba palet (maÅ‚a) */
.stack-small .pallets-small {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    font-family: var(--fmain);
    line-height: 1;
}

.stack-small .pallets-small.color-off {
    font-size: 1.2rem;
}

/* Etykieta sensora (maÅ‚a) */
.stack-small .sensor-label-small {
    position: absolute;
    bottom: 0px;
    left: 0;
    /* right: 50%; */
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    background-color: var(--grey);
    color: var(--lgrey);
    /* border-radius: 2px; */
    width: fit-content;
}

/* ============================================
   SEPARATOR
   ============================================ */
.separator {
    width: 100%;
    height: 2px;
    background-color: var(--grey);
    margin: 8px 0;
    flex-shrink: 0;
}

/* ============================================
   DOLNA SEKCJA: SÅ‚upki z paletami (tylko rzeczywiste)
   ============================================ */
.bars-section {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: space-evenly;
    gap: 1rem;
    padding: 6px;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;
}

/* Stanowisko ze sÅ‚upkami */
.station-bars {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.station-title-bars {
    font-family: var(--fmain);
    text-align: center;
    color: var(--white);
    text-transform: uppercase;
    font-size: 1.25rem;
    margin: 0;
}

/* Box sÅ‚upkÃ³w (3 w poziomie) */
.stacks-box-bars {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 2vw;
    flex-wrap: wrap;
}

/* Pojedynczy sÅ‚upek */
.stack-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.35rem;
    flex-grow: 1;
    max-width: 24rem;
    min-width: 200px;
}

/* NagÅ‚Ã³wek stosu */
.stack-bar .head-bar {
    display: grid;
    row-gap: 0.35rem;
}

.stack-bar .head-bar .title-bar {
    text-align: center;
    color: var(--lgrey);
    margin: 0;
    font-size: 1.15rem;
    font-family: var(--fmain);
}

.stack-bar .head-bar .date-wrapper-bar {
    text-align: center;
    font-weight: 300;
    margin: 0;
    font-size: 0.75rem;
    font-family: var(--fsecond);
    color: var(--lgrey);
}

.stack-bar .head-bar .datetime-bar {
    color: var(--green);
    font-weight: 500;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.stack-bar .head-bar .datetime-bar.color-off {
    color: var(--lgrey);
}

/* SÅ‚upek z paletami (beÅ¼owe rzÄ™dy) */
.stack-bar .pallets-bar {
    border-bottom: 6px solid var(--grey); /* Linia podÅ‚ogi */
    display: flex;
    flex-direction: column; /* Odwraca kolejnoÅ›Ä‡ - wizualnie od 1 (na dole) do 14 (na gÃ³rze) */
    gap: 0px;
    min-height: 300px;
}

/* RzÄ…d palety */
.stack-bar .stack-row {
    display: grid;
    grid-template-columns: 2.25rem auto;
    width: 72%;
    margin: 0 auto;
}

/* Numer palety (po lewej) - BG koloru statusu gdy jest paleta */
.stack-bar .stack-row .number {
    padding: 0.25rem;
    background-color: var(--grey); /* DomyÅ›lnie szary */
    text-align: center;
    line-height: 1.15em;
    font-size: 0.75rem;
    border: 1px solid var(--bg);
    border-left: 0;
    border-radius: 0;
    color: white;
    font-family: var(--fsecond);
}

/* Kolor BG numeru w zaleÅ¼noÅ›ci od statusu - ÅšWIECI SIÄ˜ gdy jest paleta */
.stack-bar .stack-row .number.bg-color-high,
.stack-bar .stack-row .number.bg-color-full {
    background-color: var(--green) !important;
    /* color: var(--bg) !important; */
}

.stack-bar .stack-row .number.bg-color-mid {
    background-color: var(--orange) !important;
    /* color: var(--bg) !important; */
}

.stack-bar .stack-row .number.bg-color-low {
    background-color: var(--red) !important;
}

/* Gdy off - wszystkie boxy wygaszone (szare) */
.stack-bar.off .stack-row .number {
    background-color: var(--grey) !important;
    color: var(--lgrey) !important;
}

/* BeÅ¼owy box palety (po prawej) */
.stack-bar .pallet-decor {
    width: 82%;
    height: 16px;
    background-color: var(--beige);
    border-radius: 12px;
    align-items: end;
    display: grid;
    margin: auto;
    margin-bottom: 2px;
}

.stack-bar .pallet-decor.hide {
    opacity: 0;
    visibility: hidden;
}

/* Liczba palet (duÅ¼a POD podÅ‚ogÄ…) - kolor statusu */
.stack-bar .counted {
    text-align: center;
    font-size: 5rem;
    margin: 0;
    text-transform: uppercase;
    font-family: var(--fmain);
    font-weight: bold;
}

.stack-bar .counted.color-high,
.stack-bar .counted.color-full {
    color: var(--green);
}

.stack-bar .counted.color-mid {
    color: var(--orange);
}

.stack-bar .counted.color-low {
    color: var(--red);
}

.stack-bar .counted.color-off {
    color: var(--lgrey);
}

/* ============================================
   KOLORY STATUSÃ“W - TÅ‚o
   ============================================ */
.bg-color-high,
.bg-color-full {
    background-color: var(--green) !important;
}

.bg-color-mid {
    background-color: var(--orange) !important;
}

.bg-color-low {
    background-color: var(--red) !important;
}

.bg-color-off {
    background-color: var(--grey) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stations-grid-top {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stacks-box-bars {
        gap: 1.5rem;
    }
    
    .stack-bar {
        max-width: 100%;
    }
    
    .stack-bar .counted {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .stations-grid-top {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 4px;
    }
    
    .stack-small .pallets-small {
        font-size: 1.2rem;
    }
    
    .stack-small .pallets-small.color-off {
        font-size: 1rem;
    }
    
    .stacks-box-bars {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stack-bar {
        max-width: 100%;
        min-width: 100%;
    }
    
    .stack-bar .counted {
        font-size: 2rem;
    }
    
    .stack-bar .pallets-bar {
        min-height: 200px;
    }
}

/* ============================================
   LARGE SCREENS (TV) - 2K/QHD i większe
   ============================================ */
@media (min-width: 2560px) {
    .stations-container {
        gap: 2rem;
    }
    
    .stations-grid-top {
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
        gap: 16px;
        padding: 16px;
        width: 95%;
    }
    
    .station-box-small {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .station-title-small {
        font-size: 1.75rem;
        margin: 20px 0;
    }
    
    .stacks-wrapper-small {
        gap: 1rem;
        padding: 1rem;
    }
    
    .stack-small {
        min-height: 11rem;
        padding: 0.5rem;
    }
    
    .stack-small .pallets-small {
        font-size: 4.5rem;
    }
    
    .stack-small .pallets-small.color-off {
        font-size: 1.6rem;
    }
    
    .stack-small .sensor-label-small {
        font-size: 12px;
        padding: 4px 12px;
    }
    
    .separator {
        height: 4px;
        margin: 16px 0;
    }
    
    .bars-section {
        gap: 2rem;
        padding: 16px;
    }
    
    .station-bars {
        gap: 2rem;
    }
    
    .station-title-bars {
        font-size: 1.75rem;
    }
    
    .stacks-box-bars {
        gap: 4vw;
    }
    
    .stack-bar {
        max-width: 34rem;
        min-width: 280px;
        gap: 0.75rem;
    }
    
    .stack-bar .head-bar {
        row-gap: 0.75rem;
    }
    
    .stack-bar .head-bar .title-bar {
        font-size: 1.6rem;
    }
    
    .stack-bar .head-bar .date-wrapper-bar {
        font-size: 1rem;
    }
    
    .stack-bar .head-bar .datetime-bar {
        font-size: 16px;
    }
    
    .stack-bar .pallets-bar {
        border-bottom-width: 10px;
        min-height: 480px;
    }
    
    .stack-bar .stack-row {
        grid-template-columns: 3.25rem auto;
        width: 78%;
    }
    
    .stack-bar .stack-row .number {
        padding: 0.45rem;
        font-size: 1rem;
    }
    
    .stack-bar .pallet-decor {
        width: 88%;
        height: 24px;
        border-radius: 16px;
        margin-bottom: 4px;
    }
    
    .stack-bar .counted {
        font-size: 7.5rem;
    }
}

/* 4K i większe */
@media (min-width: 3840px) {
    .stations-container {
        gap: 2.5rem;
    }
    
    .stations-grid-top {
        grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
        gap: 24px;
        padding: 24px;
        width: 96%;
    }
    
    .station-box-small {
        padding: 1.5rem;
        border-radius: 10px;
    }
    
    .station-title-small {
        font-size: 2.25rem;
        margin: 28px 0;
    }
    
    .stacks-wrapper-small {
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .stack-small {
        min-height: 15rem;
        padding: 0.75rem;
    }
    
    .stack-small .pallets-small {
        font-size: 6rem;
    }
    
    .stack-small .pallets-small.color-off {
        font-size: 2rem;
    }
    
    .stack-small .sensor-label-small {
        font-size: 14px;
        padding: 5px 16px;
    }
    
    .separator {
        height: 5px;
        margin: 20px 0;
    }
    
    .bars-section {
        gap: 2.5rem;
        padding: 24px;
    }
    
    .station-bars {
        gap: 2.5rem;
    }
    
    .station-title-bars {
        font-size: 2.25rem;
    }
    
    .stacks-box-bars {
        gap: 5vw;
    }
    
    .stack-bar {
        max-width: 42rem;
        min-width: 360px;
        gap: 1rem;
    }
    
    .stack-bar .head-bar {
        row-gap: 1rem;
    }
    
    .stack-bar .head-bar .title-bar {
        font-size: 2rem;
    }
    
    .stack-bar .head-bar .date-wrapper-bar {
        font-size: 1.25rem;
    }
    
    .stack-bar .head-bar .datetime-bar {
        font-size: 20px;
    }
    
    .stack-bar .pallets-bar {
        border-bottom-width: 12px;
        min-height: 600px;
    }
    
    .stack-bar .stack-row {
        grid-template-columns: 4rem auto;
        width: 80%;
    }
    
    .stack-bar .stack-row .number {
        padding: 0.6rem;
        font-size: 1.25rem;
    }
    
    .stack-bar .pallet-decor {
        width: 90%;
        height: 32px;
        border-radius: 20px;
        margin-bottom: 5px;
    }
    
    .stack-bar .counted {
        font-size: 10rem;
    }
}