// /**
//  * Copyright © Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .form-giftregistry-share,
    .form-giftregistry-edit {
        &:extend(.abs-add-fields all);
        .actions-toolbar:not(:last-child) {
            margin-bottom: @indent__xl;
        }

        .fieldset {
            .nested {
                .field:not(.choice) {
                    .control {
                        width: 100%;
                    }
                }
            }
        }
    }

    .form.giftregistry.items {
        .actions-toolbar {
            &:extend(.abs-reset-left-margin all);
        }
    }

    .giftregisty-dropdown {
        &:extend(.abs-dropdown-simple all);
        .action.toggle {
            .lib-css(color, @link__color);
        }
    }

    .table-giftregistry-items {
        .field.qty .qty {
            &:extend(.abs-input-qty all);
        }

        .product-image {
            .lib-css(margin-right, @indent__s);
            float: left;
        }
    }

    .form.giftregistry .fieldset {
        .cart-summary & {
            margin: 15px 0 @indent__xs;
            text-align: left;

            .field {
                margin: 0 0 @indent__s;

                .control {
                    float: none;
                    width: auto;
                }
            }

            .action.primary {
                &:extend(.abs-revert-to-action-secondary all);
            }
        }
    }

    .form-giftregistry-create {
        .fieldset {
            &:extend(.abs-forms-margin-small all);
        }
    }

    .form-giftregistry-edit {
        .field.date {
            &:extend(.abs-field-date all);
        }
    }

    .form-giftregistry-search {
        margin-bottom: @indent__l*2;

        .legend {
            &:extend(.abs-account-title all);
        }

        .fields-specific-options {
            .field {
                &:nth-last-of-type(1) {
                    margin-bottom: 0;
                }
            }

            .datetime-picker {
                &:extend(.abs-field-date-input all);
            }
        }
    }

    .block-giftregistry-results {
        .block-title {
            &:extend(.abs-account-title all);
        }

        .data.table {
            &:extend(.abs-table-striped all);
        }
    }

    .block-giftregistry {
        .actions-toolbar {
            margin: 17px 0 0;
        }
    }

    .block-giftregistry-shared {
        .item-options {
            .item-value {
                margin: 0 0 @indent__m;
            }
        }
    }

    .block-giftregistry-shared-items {
        .block-title {
            &:extend(.abs-account-title all);
        }

        .product-image-wrapper {
            &:extend(.abs-reset-image-wrapper all);
        }

        .item {
            .col {
                border: 0;
            }
        }

        th {
            border-bottom: @border-width__base solid @border-color__base;
        }

        .col {
            padding: @cart-item-cell-padding-top 11px 10px;

            .price-box {
                display: inline-block;
            }

            .price-wrapper {
                .lib-font-size(18);
                display: block;
                font-weight: @font-weight__bold;
                white-space: nowrap;
            }
        }

        .qty {
            .qty {
                &:extend(.abs-input-qty all);
            }
        }

        .product {
            .item-options {
                &:extend(.abs-product-options-list all);
                &:extend(.abs-add-clearfix all);
                margin: 0;
            }

            &-item-photo {
                display: block;
                max-width: 65px;
                padding: @indent__s 0;
            }

            &-item-name {
                .lib-font-size(18);
                display: block;
                margin: 0 0 @indent__xs;
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .account {
        .table-giftregistry {
            .col.actions {
                &:extend(.abs-col-no-prefix all);
            }
        }
    }

    .table-giftregistry-items {
        .col.product {
            &:before {
                &:extend(.abs-visually-hidden-mobile all);
            }
            &:extend(.abs-add-clearfix-mobile all);
        }

        .field.choice,
        .field.qty {
            display: inline-block;
        }
    }

    .form-giftregistry-search {
        .fieldset {
            margin-bottom: @indent__base;
        }
    }

    .block-giftregistry-results {
        .block-title {
            margin-bottom: 0;
        }

        .table-wrapper {
            border-top: none;
        }
    }

    .block-giftregistry-shared-items {
        .block-title {
            margin-bottom: @indent__s;
        }

        .table-wrapper {
            border-top: 0;
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    //  Shopping cart link
    .cart.table-wrapper {
        .action-giftregistry {
            .lib-icon-font(
            @icon-gift-registry,
            @_icon-font-size: 18px,
            @_icon-font-line-height: 20px,
            @_icon-font-text-hide: true,
            @_icon-font-color: @minicart-icons-color,
            @_icon-font-color-hover: @primary__color,
            @_icon-font-color-active: @minicart-icons-color
            );
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .form-giftregistry-share,
    .form-giftregistry-edit {
        &:extend(.abs-add-fields-desktop all);
        &:extend(.abs-form-field-column-2 all);
        .fieldset .field {
            width: 45%;
        }
    }

    .form-giftregistry-edit {
        .fieldset.shipping_address {
            .fieldset {
                margin-top: @form-field__vertical-indent;
            }
        }
    }

    .form-giftregistry-create {
        &:extend(.abs-forms-general-desktop all);
    }

    .table-giftregistry {
        .col.create {
            white-space: nowrap;
        }

        .col.message {
            width: 40%;
        }

        .col.actions {
            width: 30%;
        }
    }

    .table-giftregistry-items {
        .col.note {
            width: 30%;
        }

        .account .data.table& {
            .lib-table-bordered(
            @_table_type: horizontal
            );

            th {
                border-bottom: 0;
            }

            > tbody > tr:nth-child(even) {
                > td,
                > th {
                    background: none;
                }
            }
        }
    }

    .form-giftregistry-search {
        .fieldset {
            margin-bottom: @form-field__vertical-indent__desktop;

            .field {
                &.name,
                &.lastname {
                    .lib-form-field-column(@_column: true);
                    margin-bottom: auto;
                }

                &.lastname {
                    padding: 0;
                }
            }
        }
    }

    .toolbar-giftregistry-results {
        &:extend(.abs-pager-toolbar all);
    }

    .block-giftregistry-shared {
        .item-options {
            &:extend(.abs-product-options-list-desktop all);
            &:extend(.abs-add-clearfix-desktop all);
        }
    }

    .block-giftregistry-shared-items {
        .column.main & {
            .actions-toolbar {
                &:extend(.abs-reset-left-margin-desktop all);
            }
        }

        .item {
            border-bottom: @border-width__base solid @border-color__base;
            border-top: 0;
        }

        .product {
            &-item-photo {
                display: table-cell;
                max-width: 100%;
                padding: 0 @indent__base 0 0;
                vertical-align: top;
                width: 1%;
            }

            &-item-details {
                display: table-cell;
                vertical-align: top;
                width: 99%;
                word-break: normal;
            }
        }

        .col {
            &.product {
                width: 48%;
            }

            &:not(.product) {
                text-align: center;
            }

            &.price {
                padding-top: 17px;
            }
        }

        .input-text {
            &.qty {
                margin-top: -4px;
            }
        }
    }
}
