@import url("../../_style/_mixins.less");
@import url("../../_style/_theme.less");

.list-block {
    margin: 35px 0;
    font-size: 17px;
    ul {
        background: @listBlockBg;
        list-style: none;
        padding: 0;
        margin: 0;
        position: relative;
        .hairline(top, @listBlockBorderColor);
        .hairline(bottom, @listBlockBorderColor);
        ul {
            .hairline-remove(top);
            .hairline-remove(bottom);
            padding-left: 45px;
        }
    }

    .align-top.item-content, .align-top .item-inner {
        .align-items(flex-start);
    }

    .inset() {
        margin-left: 15px;
        margin-right: 15px;
        border-radius: 7px;
        .content-block-title {
            margin-left: 0;
            margin-right: 0;
        }
        ul {
            border-radius: 7px;
            .hairline-remove(top);
            .hairline-remove(bottom);
        }
        li:first-child > a{
            border-radius: 7px 7px 0 0;
        }
        li:last-child > a{
            border-radius: 0 0 7px 7px;
        }
        li:first-child:last-child > a {
            border-radius: 7px;
        }
    }
    &.inset {
        .inset()
    }

    // List items
    li {
        box-sizing: border-box;
        position: relative;
    }

    .item-media {
        .flexbox();
        .flex-shrink(0);
        .flex-wrap(nowrap);
        box-sizing: border-box;
        .align-items(center);
        padding-top: 7px;
        padding-bottom: 8px;
        i + i {
            margin-left: 5px;
        }
        i + img {
            margin-left: 5px;
        }
    }
    .item-media + .item-inner {
        margin-left: 15px;
    }
    .item-inner {
        padding-right: 15px;
        position: relative;
        .hairline(bottom, @listBlockBorderColor);
        width: 100%;
        padding-top: 8px;
        padding-bottom: 7px;
        min-height: 44px;
        box-sizing: border-box;
        .flexbox();
        -webkit-box-flex:1;
        -ms-flex:1;
        overflow: hidden;
        .justify-content(space-between);
        .align-items(center);
        .align-self(stretch);
    }
    .item-title {
        .flex-shrink(1);
        min-width: 0;
        white-space: nowrap;
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .item-after {
        white-space: nowrap;
        color: #8e8e93;
        .flex-shrink(0);
        margin-left: auto;
        padding-left: 5px;
        .flexbox();
        max-height: 28px;
    }

    .item-link, .list-button {
        .transition(300ms);
        display: block;
        color: inherit;

        .item-inner {
            padding-right: 35px;
            .encoded-svg-background("<svg viewBox='0 0 60 120' xmlns='http://www.w3.org/2000/svg'><path d='m60 61.5-38.25 38.25-9.75-9.75 29.25-28.5-29.25-28.5 9.75-9.75z' fill='#c7c7cc'/></svg>");
            background-size: 10px 20px;
            background-repeat: no-repeat;
            background-position: 95% center;
            background-position: -webkit-calc(~"100% - 15px") center;
            background-position: calc(~"100% - 15px") center;
        }
        html:not(.watch-active-state) &:active, &.active-state {
            .transition(0ms);
            background-color: #d9d9d9;
            .item-inner {
                .hairline-color(bottom, transparent);
            }
        }
    }
    .list-button {
        padding: 0 15px;
        text-align: center;
        color: @themeColor;
        display: block;
        .hairline(bottom, @listBlockBorderColor);
        line-height: 43px;
    }

    .item-content {
        box-sizing: border-box;
        padding-left: 15px;
        min-height: 44px;
        .flexbox();
        .justify-content(space-between);
        .align-items(center);
    }
    
    // Label after List block
    .list-block-label {
        margin: 10px 0 35px;
        padding: 0 15px;
        font-size: 14px;
        color: #8f8f94;
    }

    .item-subtitle {
        font-size: 15px;
        position: relative;
        overflow: hidden;
        white-space: nowrap;
        max-width: 100%;
        text-overflow:ellipsis;
    }
    .item-text {
        font-size: 15px;
        color: #8e8e93;
        line-height: 21px;
        position: relative;
        overflow: hidden;
        height: 42px;
        text-overflow:ellipsis;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        display: -webkit-box;
    }
    &.media-list, .media-item {
        .item-title {
            font-weight: 500;
            html.ios-gt-8 & {
                font-weight: 600;
            }
        }
        .item-inner {
            display: block;
            padding-top: 10px;
            padding-bottom: 9px;
            .align-self(stretch);
        }
        .item-link .item-inner {
            background: none;
            padding-right: 15px;
        }
        .item-link .item-title-row {
            padding-right: 20px;
            background: no-repeat right center;
            .encoded-svg-background("<svg viewBox='0 0 60 120' xmlns='http://www.w3.org/2000/svg'><path d='m60 61.5-38.25 38.25-9.75-9.75 29.25-28.5-29.25-28.5 9.75-9.75z' fill='#c7c7cc'/></svg>");
            background-size: 10px 20px;
        }
        .item-media {
            padding-top: 9px;
            padding-bottom: 10px;
            img {
                display: block;
            }
        }
        .item-title-row {
            .flexbox();
            .justify-content(space-between);
        }
        .item-content > .item-after {
            margin-right: 15px;
            margin-left: 15px;
        }
    }

    .list-group {
        ul {
            &:after, &:before {
                z-index: 25;
            }
        }
        + .list-group ul {
            .hairline-remove(top);
        }
    }
    .item-divider, .list-group-title {
        background: @dividerBg;
        .hairline(top, @listBlockBorderColor);
        margin-top: -1px;
        padding: 4px 15px;
        white-space: nowrap;
        position: relative;
        max-width: 100%;
        text-overflow: ellipsis;
        overflow: hidden;
        color: @dividerColor;
        z-index: 15;
    }
    .list-group-title {
        position: relative;
        position: -webkit-sticky;
        position: -moz-sticky;
        position: sticky;
        top: 0px;
        z-index: 20;
        margin-top: 0;
        .hairline-remove(top);
    }

    // Last-childs
    li {
        &:last-child {
            .list-button {
                .hairline-remove(bottom);
            }
        }
        &:last-child, &:last-child li:last-child {
            .item-inner {
                .hairline-remove(bottom);
            }
        }
        li:last-child, &:last-child li {
            .item-inner {
                .hairline(bottom, @listBlockBorderColor);
            }
        }
    }
    .no-hairlines();
    .no-hairlines-between();

    // input-item
    .item-title.label {
        width: 35%;
        .flex-shrink(0);
        vertical-align: top;
        + .item-input {
            margin-left: 5px;
        }
    }
    .item-input {
        width: 100%;
        margin-top: -8px;
        margin-bottom: -7px;
        -webkit-box-flex:1;
        -ms-flex:1;
        .flex-shrink(1);
    }
    
    // input
    input[type="text"], 
    input[type="password"], 
    input[type="search"], 
    input[type="email"],
    input[type="tel"], 
    input[type="url"], 
    input[type="date"], 
    input[type="datetime-local"], 
    input[type="time"], 
    input[type="number"], 
    select,
    textarea {
        .input-in-list()
    }
    input[type="date"], input[type="datetime-local"] {
        line-height: 44px;
    }
    select {
        -webkit-appearance: none;
        -moz-appearance: none;
        -ms-appearance: none;
        appearance: none;
    }
    textarea {
        height: 100px;
        resize: none;
        line-height: 1.4;
        padding-top: 8px;
        padding-bottom: 7px;
        &.resizable {
            height: 43px;
        }
    }
}
