/* ==========================================================================
   Intelligo Complex Shipping - Cart Freight Groups

   File:
   app/code/Intelligo/ComplexShipping/view/frontend/web/css/freight-groups.css
   ========================================================================== */


/* ==========================================================================
   Main shipping groups container
   ========================================================================== */

.intelligo-freight-groups {
    position: relative;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;

    width: 100%;

    margin: 12px 0;
    padding: 12px 20px 14px;

    border: 1px solid #e3e3e3;
    background: #fafafa;

    box-sizing: border-box;
}


/* ==========================================================================
   Introduction text
   ========================================================================== */

.intelligo-freight-groups__intro {
    grid-column: 1 / -1;

    margin: 0 0 0px;

    line-height: 1.5;
}


/* ==========================================================================
   Individual shipping group
   ========================================================================== */

.intelligo-freight-group {
    width: 100%;
    min-width: 0;

    margin: 0;
    padding: 16px;

    border: 1px solid #ddd;
    background: #fff;

    box-sizing: border-box;
}


/* ==========================================================================
   Shipping group header
   ========================================================================== */

.intelligo-freight-group__header {
    display: flex;
    flex-direction: column;

    justify-content: flex-start;
    align-items: flex-start;

    gap: 8px;
}


.intelligo-freight-group__name {
    margin: 0;

    font-size: 1.4rem;
    line-height: 1.3;
}


/* ==========================================================================
   Shipping group price information
   ========================================================================== */

.intelligo-freight-group__meta {
    display: flex;
    flex-direction: column;

    gap: 4px;

    width: 100%;
}


.intelligo-freight-group__meta span {
    display: block;

    margin: 0;

    line-height: 1.5;
}


/* ==========================================================================
   Free shipping progress
   ========================================================================== */

.intelligo-freight-group__progress {
    margin-top: 14px;
}


.intelligo-freight-group__progress p {
    margin: 8px 0 0;

    line-height: 1.4;
}


.intelligo-freight-group__progress-bar {
    width: 100%;
    height: 8px;

    margin: 10px 0;

    background: #ececec;

    border-radius: 4px;

    overflow: hidden;
}


.intelligo-freight-group__progress-bar span {
    display: block;

    height: 100%;
    max-width: 100%;

    background: #006bb4;

    border-radius: 4px;
}


/* ==========================================================================
   Jepotech / fixed shipping note
   ========================================================================== */

.intelligo-freight-group__note {
    margin: 14px 0 0;

    line-height: 1.5;
}


/* ==========================================================================
   Products inside each shipping group
   ========================================================================== */

.intelligo-freight-group__items {
    margin: 16px 0 0;
    padding: 0;

    list-style: none;

    border-top: 1px solid #eee;
}


.intelligo-freight-group__items li {
    display: flex;

    justify-content: space-between;
    align-items: flex-start;

    gap: 10px;

    padding: 8px 0;

    border-bottom: 1px solid #eee;

    line-height: 1.4;
}


.intelligo-freight-group__item-name {
    flex: 1 1 auto;

    min-width: 0;
}


.intelligo-freight-group__item-qty {
    flex: 0 0 auto;

    white-space: nowrap;
}


/* ==========================================================================
   Estimated total shipping

   Desktop:
   columns 1 + 2 = estimated freight
   column 3      = checkout button
   ========================================================================== */

.intelligo-freight-groups__total {
    grid-column: 1 / 3;

    display: flex;

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

    gap: 6px;

    margin: 4px 0 0;
    padding: 8px 0 0;

    border-top: 0;

    font-size: 1.4rem;
    line-height: 1.4;

    white-space: nowrap;
}


.intelligo-freight-groups__total strong {
    font-weight: 600;
}


/* ==========================================================================
   Checkout
   ========================================================================== */

.intelligo-freight-groups__checkout {
    grid-column: 3 / 4;

    display: flex;

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

    width: 100%;

    margin: 0 0 0;
    padding: 0 0 0;

    box-sizing: border-box;
}


.intelligo-freight-groups__checkout-button {
    display: inline-flex !important;

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

    width: 280px;
    min-width: 280px;
    min-height: 50px;

    margin: 0 !important;
    padding: 14px 30px !important;

    box-sizing: border-box;

    background-color: #f05252 !important;
    border: 1px solid #f05252 !important;

    color: #ffffff !important;

    font-size: 16px !important;
    font-weight: 600;
    line-height: 1.2 !important;

    text-align: center;
    text-decoration: none !important;

    cursor: pointer;

    visibility: visible !important;
    opacity: 1 !important;
}


.intelligo-freight-groups__checkout-button span {
    display: block;

    width: auto;

    margin: 0;
    padding: 0;

    color: #ffffff !important;

    font-size: 16px !important;
    font-weight: 600;
    line-height: 1.2 !important;

    text-align: center;
    text-decoration: none !important;

    visibility: visible !important;
    opacity: 1 !important;
}


.intelligo-freight-groups__checkout-button:hover,
.intelligo-freight-groups__checkout-button:focus {
    background-color: #f05252 !important;
    border-color: #f05252 !important;

    color: #ffffff !important;

    text-decoration: none !important;

    outline: none;
}


.intelligo-freight-groups__checkout-button:hover span,
.intelligo-freight-groups__checkout-button:focus span {
    color: #ffffff !important;
}


/* ==========================================================================
   Freight breakdown
   ========================================================================== */

.intelligo-freight-breakdown {
    margin-top: 20px;
    padding: 16px;

    border: 1px solid #e3e3e3;
    background: #fafafa;

    box-sizing: border-box;
}


.intelligo-freight-breakdown__header {
    display: flex;

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

    gap: 12px;
}


.intelligo-freight-breakdown__message td {
    padding-top: 0;

    border-top: 0;

    color: #666;

    font-size: 1.2rem;
}


/* ==========================================================================
   Freight groups initial loading overlay

   Absolute positioning prevents loader from becoming another grid item.
   ========================================================================== */

.intelligo-freight-groups__loader {
    position: absolute;

    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    z-index: 100;

    display: flex;

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

    background: rgba(250, 250, 250, 0.96);
}


/* ==========================================================================
   Loader spinner
   ========================================================================== */

.intelligo-freight-groups__spinner {
    display: block;

    width: 42px;
    height: 42px;

    border: 4px solid #e3e3e3;
    border-top-color: #006bb4;

    border-radius: 50%;

    animation: intelligo-freight-spinner 0.8s linear infinite;
}


@keyframes intelligo-freight-spinner {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* ==========================================================================
   Desktop
   ========================================================================== */

@media (min-width: 1024px) {

    .intelligo-freight-group {
        min-height: 100%;
    }

}


/* ==========================================================================
   Tablet
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1023px) {

    .intelligo-freight-groups {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    .intelligo-freight-groups__intro {
        grid-column: 1 / -1;
    }


    .intelligo-freight-groups__total {
        grid-column: 1 / 2;

        justify-content: flex-start;

        margin: 4px 0 0;
        padding: 8px 0 0;

        border-top: 0;

        white-space: nowrap;
    }


    .intelligo-freight-groups__checkout {
        grid-column: 2 / 3;

        display: flex;

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

        margin: 4px 0 0;
        padding: 8px 0 0;
    }


    .intelligo-freight-groups__checkout-button {
        width: 100%;
        min-width: 0;
    }

}


/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 768px) {

    .intelligo-freight-groups {
        display: block;

        width: 100%;

        margin: 10px 0;
        padding: 12px;
    }


    .intelligo-freight-groups__intro {
        margin: 0 0 10px;
    }


    .intelligo-freight-group {
        width: 100%;

        margin: 0 0 15px;
        padding: 15px;
    }


    .intelligo-freight-group:last-of-type {
        margin-bottom: 0;
    }


    .intelligo-freight-group__header {
        gap: 6px;
    }


    .intelligo-freight-group__meta {
        gap: 3px;
    }


    .intelligo-freight-group__items li {
        align-items: flex-start;
    }


    /*
     * Keep:
     *
     * Estimeret fragt i alt: 218,00 DKK
     *
     * on ONE line.
     */
    .intelligo-freight-groups__total {
        display: flex;
        flex-direction: row;

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

        gap: 6px;

        width: 100%;

        margin: 8px 0 0;
        padding: 8px 0 0;

        border-top: 0;

        font-size: 1.3rem;
        line-height: 1.4;

        white-space: nowrap;
    }


    /*
     * Checkout button remains below estimated freight.
     */
    .intelligo-freight-groups__checkout {
        display: block;

        width: 100%;

        margin: 8px 0 0;
        padding: 0;
    }


    .intelligo-freight-groups__checkout-button {
        display: flex !important;

        width: 100%;
        min-width: 0;
        min-height: 50px;
    }

}


/* ==========================================================================
   Small mobile
   ========================================================================== */

@media (max-width: 480px) {

    .intelligo-freight-groups {
        padding: 10px;
    }


    .intelligo-freight-group {
        padding: 12px;
    }


    .intelligo-freight-group__items li {
        flex-direction: column;

        gap: 3px;
    }


    .intelligo-freight-group__item-qty {
        align-self: flex-start;
    }


    /*
     * IMPORTANT:
     * Do NOT use flex-direction: column here.
     *
     * Keep estimated freight label + amount on one line.
     */
    .intelligo-freight-groups__total {
        flex-direction: row;

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

        gap: 5px;

        font-size: 1.2rem;

        white-space: nowrap;
    }

}