﻿/* ========================================= */
/* WAREHOUSE                                 */
/* ========================================= */

.warehouse {
    width: 95%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
    font-family: monospace;
}


/* ========================================= */
/* HEADER                                    */
/* ========================================= */

.warehouse-header {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    padding: 15px;
    border-bottom: 2px solid;
    margin-bottom: 25px;
}

.reset-button {
    border: 1px solid #6b7280;
    background: #1f2937;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

    .reset-button:hover {
        background: #374151;
    }


/* ========================================= */
/* DOCK AREA                                 */
/* ========================================= */

.dock-area {
    display: flex;
    flex-direction: row;
    gap: 50px;
    width: 100%;
}

.dock-section {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.docks {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.dock {
    flex: 1;
    border: 2px solid;
    padding: 10px;
    min-width: 0;
    box-sizing: border-box;
}

.dock-title {
    font-weight: bold;
    margin-bottom: 10px;
    white-space: nowrap;
}


/* ========================================= */
/* DOCK CONTROLS                             */
/* ========================================= */

.dock-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.dock-controls button {
    width: 30px;
    height: 30px;
    padding: 0;
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}


/* ========================================= */
/* PALLET SLOTS                              */
/* ========================================= */

.pallet-slots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.pallet-slot {
    height: 28px;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-sizing: border-box;
}

.pallet-slot.occupied {
    background: #e6c300;
    font-size: 20px;
}

.capacity {
    margin-top: 10px;
    font-size: 13px;
}


/* ========================================= */
/* WORKERS                                   */
/* ========================================= */

.workers {
    margin-top: 15px;
    font-size: 22px;
}


/* ========================================= */
/* MAIN HORIZONTAL ROAD                      */
/* ========================================= */

.horizontal-road {
    position: relative;
    width: 100%;
    height: 60px;
    background: #fffbea;
    border-top: 5px solid #e6c300;
    border-bottom: 5px solid #e6c300;
    box-sizing: border-box;
}

.horizontal-road::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    background:
        repeating-linear-gradient(
            90deg,
            #e6c300 0px,
            #e6c300 25px,
            transparent 25px,
            transparent 45px
        );
    z-index: 1;
}


/* ========================================= */
/* DOCK ROAD                                 */
/* ========================================= */

.docks-road {
    margin-top: 25px;
    margin-bottom: 25px;
}


/* ========================================= */
/* DOCK TRANSFER POINTS                      */
/* ========================================= */

.dock-transfer-point {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    font-size: 20px;
    background: #fffbea;
    line-height: 1;
}

.point-d01 {
    left: 16%;
}

.point-d02 {
    left: 24%;
}

.point-d03 {
    left: 32%;
}

.sorting-exchange-point {
    left: 50%;
    top: 50%;
}

.point-d04 {
    left: 68%;
}

.point-d05 {
    left: 76%;
}

.point-d06 {
    left: 84%;
}

.point-d07 {
    left: 92%;
}


/* ========================================= */
/* MAIN MAP                                 */
/* ========================================= */

.warehouse-map {
    display: grid;

    /*
     * WAŻNE:
     *
     * zero gap oznacza, że boczne drogi
     * fizycznie dotykają dróg poziomych.
     */

    grid-template-columns:
        100px
        minmax(0, 1fr)
        100px;

    gap: 0;

    min-height: 700px;

    position: relative;

    overflow: visible;
}


/* ========================================= */
/* SIDE ROADS                                */
/* ========================================= */

.side-road {
    position: relative;

    background: #fffbea;

    border-left: 5px solid #e6c300;
    border-right: 5px solid #e6c300;

    min-height: 700px;

    display: flex;
    justify-content: center;

    z-index: 2;
}


/*
 * ŁĄCZNIK Z DOCK ROAD
 *
 * Bez tego między docks-road i side-road
 * byłaby biała przerwa.
 */

.side-road::before {
    content: "";

    position: absolute;

    left: -5px;
    right: -5px;

    top: -25px;

    height: 25px;

    background: #fffbea;

    border-left: 5px solid #e6c300;
    border-right: 5px solid #e6c300;

    box-sizing: border-box;
}


.road-label {
    position: sticky;
    top: 50%;

    font-size: 24px;
    color: #e6c300;
}


/* ========================================= */
/* CENTER                                    */
/* ========================================= */

.warehouse-center {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 0;

    position: relative;

    z-index: 3;
}


/* ========================================= */
/* SORTING                                   */
/* ========================================= */

.sorting-area {
    width: 100%;
    text-align: center;
    position: relative;
}

.sorting-area h3 {
    margin-top: 0;
    font-size: 20px;
}


/* ========================================= */
/* SORTING SPACE                             */
/* ========================================= */

.sorting-space {
    height: 260px;

    border: 3px solid;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 20px;

    box-sizing: border-box;
}


/* ========================================= */
/* SORTING PALLETS                           */
/* ========================================= */

.sorting-pallets {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(
            5,
            minmax(45px, 1fr)
        );

    justify-items: center;
    align-items: center;

    gap: 8px;

    font-size: 25px;

    margin-bottom: 15px;
}

.sorting-pallet {
    font-size: 25px;
    line-height: 1;
}


/* ========================================= */
/* RACK ROAD                                 */
/* ========================================= */

.rack-road {
    height: 80px;

    position: relative;

    display: flex;
    justify-content: center;
    align-items: center;

    background: #fffbea;

    border-top: 5px solid #e6c300;
    border-bottom: 5px solid #e6c300;

    margin-top: 25px;
    margin-bottom: 25px;

    z-index: 5;
}


.road-line {
    position: absolute;

    left: 0;
    right: 0;

    top: 50%;

    height: 4px;

    transform: translateY(-50%);

    background:
        repeating-linear-gradient(
            90deg,
            #e6c300 0px,
            #e6c300 25px,
            transparent 25px,
            transparent 45px
        );
}


/* ========================================= */
/* RACK TRANSFER POINTS                      */
/* ========================================= */

.rack-transfer-point {
    position: absolute;

    top: 50%;

    transform: translate(-50%, -50%);

    z-index: 20;

    font-size: 20px;

    background: #fffbea;

    line-height: 1;
}

.rack-a-point {
    left: 16.5%;
}

.rack-b-point {
    left: 50%;
}

.rack-c-point {
    left: 83.5%;
}


/* ========================================= */
/* RACKS                                     */
/* ========================================= */

.rack-area {
    display: flex;
    flex-direction: row;

    gap: 30px;

    width: 100%;
}

.rack {
    flex: 1;

    min-width: 0;

    height: 260px;

    border: 3px solid;

    padding: 15px;

    text-align: center;

    box-sizing: border-box;

    position: relative;
}

.rack h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 18px;
}

.destination {
    font-size: 12px;
    margin-bottom: 15px;
}


/* ========================================= */
/* RACK PALLETS                              */
/* ========================================= */

.rack-space {
    min-height: 120px;

    display: flex;

    justify-content: center;
    align-items: center;

    gap: 8px;

    font-size: 25px;

    flex-wrap: wrap;
}

.rack-pallet {
    font-size: 25px;
    line-height: 1;
}


/* ========================================= */
/* LOWER ROAD                                */
/* ========================================= */

.racks-parking-road {
    position: relative;

    width: 100%;
    height: 70px;

    margin-top: 25px;
    margin-bottom: 25px;

    background: #fffbea;

    border-top: 5px solid #e6c300;
    border-bottom: 5px solid #e6c300;

    box-sizing: border-box;

    z-index: 5;
}

.racks-parking-road::after {
    content: "";

    position: absolute;

    left: 0;
    right: 0;

    top: 50%;

    height: 4px;

    transform: translateY(-50%);

    background:
        repeating-linear-gradient(
            90deg,
            #e6c300 0px,
            #e6c300 25px,
            transparent 25px,
            transparent 45px
        );
}


/* ========================================= */
/* PARKING                                   */
/* ========================================= */

.forklift-parking {
    width: 100%;

    margin-top: 0;

    border: 3px solid;

    box-sizing: border-box;

    padding: 15px;

    background: #fafafa;
}

.forklift-parking h3 {
    margin: 0 0 15px 0;

    text-align: center;

    font-size: 18px;
}


/* ========================================= */
/* PARKING SLOTS                             */
/* ========================================= */

.parking-slots {
    display: grid;

    grid-template-columns:
        repeat(
            10,
            minmax(0, 1fr)
        );

    gap: 8px;

    width: 100%;
}


.parking-slot {
    min-width: 0;

    height: 90px;

    border: 2px solid;

    box-sizing: border-box;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    overflow: visible;

    background: white;

    position: relative;

    z-index: 10;
}


/*
 * ŻÓŁTY PAS PRZEZ PARKING
 *
 * Dzięki temu pierwszy odcinek:
 *
 * PARKING → LOWER ROAD
 *
 * też znajduje się na żółtej drodze.
 */

.parking-slot::after {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;

    left: 50%;

    transform: translateX(-50%);

    width: 16px;

    background:
        repeating-linear-gradient(
            180deg,
            #e6c300 0px,
            #e6c300 14px,
            transparent 14px,
            transparent 24px
        );

    z-index: 0;

    pointer-events: none;
}


/*
 * ŻÓŁTY ŁĄCZNIK:
 *
 * PARKING → LOWER ROAD
 */

.parking-slot::before {
    content: "";

    position: absolute;

    left: 50%;

    transform: translateX(-50%);

    top: -25px;

    width: 16px;

    height: 25px;

    background: #e6c300;

    z-index: -1;

    pointer-events: none;
}


/* ========================================= */
/* PARKING LABEL                             */
/* ========================================= */

.parking-label {
    position: relative;

    z-index: 3;

    font-weight: bold;

    font-size: 13px;

    margin-bottom: 8px;
}


/* ========================================= */
/* PARKING POSITION                          */
/* ========================================= */

.parking-position {
    position: relative;

    z-index: 3;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    min-height: 40px;
}


/* ========================================= */
/* EMPTY PARKING                             */
/* ========================================= */

.empty-parking {
    font-size: 16px;
    color: #999;
}


/* ========================================= */
/* MOVING FORKLIFT                           */
/* ========================================= */

.forklift {
    position: absolute;

    z-index: 1000;

    left: 0;
    top: 0;

    font-size: 32px;

    pointer-events: none;

    white-space: nowrap;

    /*
     * WAŻNE:
     *
     * left/top wskazuje ŚRODEK wózka.
     */

    transform:
        translate(
            -50%,
            -50%
        );
}


.forklift-icon {
    display: block;
    line-height: 1;
}


.worker-label {
    position: absolute;

    top: -18px;
    left: 50%;

    transform:
        translateX(-50%);

    font-size: 10px;

    font-weight: bold;

    background: white;

    padding: 2px 4px;

    white-space: nowrap;
}


.forklift.busy {
    filter:
        drop-shadow(
            0 0 4px #e6c300
        );
}


.forklift.scanning {
    animation:
        forklift-scan 0.3s infinite alternate;
}


@keyframes forklift-scan {

    from {
        filter:
            drop-shadow(
                0 0 2px #e6c300
            );
    }

    to {
        filter:
            drop-shadow(
                0 0 10px #e6c300
            );
    }
}


/* ========================================= */
/* CARRIED PALLET                            */
/* ========================================= */

.carried-pallet {
    position: absolute;

    display: none;

    left: 0;
    top: -28px;

    font-size: 20px;

    line-height: 1;

    z-index: 2000;

    pointer-events: none;
}


/* ========================================= */
/* CONTROL PANEL                             */
/* ========================================= */

.control-panel {
    margin-top: 25px;

    text-align: center;

    padding: 15px;
}

.control-panel button {
    padding: 10px 18px;

    font-family: monospace;

    font-weight: bold;

    cursor: pointer;
}


/* ========================================= */
/* TASK BUTTONS                              */
/* ========================================= */

.task-button {
    padding: 8px 12px;

    margin-top: 8px;

    font-family: monospace;

    font-weight: bold;

    cursor: pointer;
}


/* ========================================= */
/* TEST CASES                                */
/* ========================================= */

.test-cases {
    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    gap: 10px;

    margin-top: 15px;
}


/* ========================================= */
/* STATUS                                    */
/* ========================================= */

.transport-message {
    margin: 10px auto;

    text-align: center;

    font-size: 16px;

    font-weight: bold;
}


/* ========================================= */
/* INVENTORY                                 */
/* ========================================= */

.inventory-bar {
    border-top: 2px solid;

    margin-top: 30px;

    padding-top: 15px;

    display: flex;

    justify-content: space-between;

    font-size: 14px;
}


/* ========================================= */
/* RESPONSIVE                                */
/* ========================================= */

@media (max-width: 1100px) {

    .parking-slots {
        grid-template-columns:
            repeat(
                5,
                minmax(
                    90px,
                    1fr
                )
            );
    }

    .sorting-pallets {
        grid-template-columns:
            repeat(
                5,
                minmax(
                    40px,
                    1fr
                )
            );
    }
}


@media (max-width: 1000px) {

    .warehouse-map {
        grid-template-columns:
            60px
            minmax(0, 1fr)
            60px;
    }

    .dock-area {
        gap: 20px;
    }

    .docks {
        gap: 5px;
    }

    .rack-area {
        gap: 10px;
    }

    .horizontal-road {
        height: 50px;
    }
}


@media (max-width: 700px) {

    .parking-slots {
        grid-template-columns:
            repeat(
                2,
                1fr
            );
    }

    .sorting-pallets {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    50px,
                    1fr
                )
            );
    }

    .dock-area {
        flex-direction: column;
    }



}



.steal-button {
    background: #7f1d1d;
    color: #ffffff;
    border: 2px solid #ef4444;
    padding: 8px 12px;
    margin-top: 8px;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
}

    .steal-button:hover {
        background: #991b1b;
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    }