/*!
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       

*/
// Card
.k-card {
    .border-radius( @card-border-radius );
    // .box-shadow( @card-box-shadow );
    border-width: @card-border-width;
    border-style: solid;
    display: flex;
    flex-direction: column;
    position: relative;

    .k-card-callout {
        position: absolute;
        width: @card-callout-width;
        height: @card-callout-height;
        border-width: @card-border-width @card-border-width 0 0;
        border-style: solid;
        margin: 0;

        &.k-callout-n {
            top: 0;
            transform: translate(-50%, -50%) rotate(-45deg);
            left: 50%;
        }

        &.k-callout-e {
            top: 50%;
            left: auto;
            right: 0;
            transform: translate(50%, -50%) rotate(135deg) scaleX(-1);
        }

        &.k-callout-s {
            top: auto;
            bottom: 0;
            transform: translate(-50%, 50%) rotate(135deg);
            left: 50%;
        }

        &.k-callout-w {
            top: 50%;
            left: 0;
            transform: translate(-50%, -50%) rotate(-135deg);
        }
    }
}
.k-card.k-card-flat {
    box-shadow: none;
}


// Placeholder selectors
// %top-rounded-child {
//     .k-card > &:first-child {
//         .border-top-radius( @card-border-radius );
//     }
// }
// %bottom-rounded-child {
//     .k-card > &:last-child {
//         .border-bottom-radius( @card-border-radius );
//     }
// }

 // Orientation
 .k-card-horizontal {
    flex-direction: row;
}


// Header
.k-card-header {
    // @extend %top-rounded-child;
    // @extend %bottom-rounded-child;
    padding: @card-header-padding-y @card-header-padding-x;
    border-width: 0 0 @card-header-border-width;
    border-style: solid;
    overflow: hidden;
    position: relative;
    z-index: 1;

    .k-card > &:first-child {
        .border-top-radius( @card-border-radius );
    }
    .k-card > &:last-child {
        .border-bottom-radius( @card-border-radius );
    }

    > h1,
    > h2,
    > h3,
    > h4,
    > h5,
    > h6 {
        margin: 0;
    }

    .k-card-title+.k-card-subtitle {
        margin-top: 0;
    }
}

 // Footer
 .k-card-footer {
    padding: @card-footer-padding-y @card-footer-padding-x;
    border-width: @card-footer-border-width 0 0;
    border-style: solid;
    display: block;
}


// Body
.k-card-body {
    // @extend %top-rounded-child;
    // @extend %bottom-rounded-child;
    padding: @card-body-padding-y @card-body-padding-x;
    flex: 1 1 auto;

    .k-card > &:first-child {
        .border-top-radius( @card-border-radius );
    }
    .k-card > &:last-child {
        .border-bottom-radius( @card-border-radius );
    }

    p {
        margin: 0 0 @paragraph-margin-bottom;
    }

    > .k-last,
    > :last-child {
        margin-bottom: 0;
    }
}


// Card image
.k-card-image,
.k-card-media {
    // @extend %top-rounded-child;
    // @extend %bottom-rounded-child;
    border: 0;
    max-width: 100%;
    overflow: hidden;

    .k-card > &:first-child {
        .border-top-radius( @card-border-radius );
    }
    .k-card > &:last-child {
        .border-bottom-radius( @card-border-radius );
    }

    > img {
        border: 0;
        max-width: 100%;
    }

    .k-card-horizontal & {
        flex-shrink: 0;
        max-width: @card-img-max-width;
        object-fit: cover;
    }
}


// Card title
.k-card-title {
   // @include typography-styles( card-title );
    font-size: @card-title-font-size;
    margin: 0 0 @card-title-margin-bottom;
}


// Card subtitle
.k-card-subtitle {
    // @include typography-styles( card-subtitle );
    font-size: @card-subtitle-font-size;
    margin: 0 0 @card-subtitle-margin-bottom;
    opacity: .6;
}
.k-card-title + .k-card-subtitle {
    margin-top: ( -@card-title-margin-bottom * .75 );
}

 // Separator
 .k-card-separator {
    margin: 0;
    border-width: 1px 0 0;
    border-style: solid;
    display: block;
    flex: 0 0 auto;

    &.k-separator-vertical {
        width: 0;
        border-width: 0 0 0 1px;
    }
}

// Separator
.k-card > .k-hr {
    margin: 0;
    flex: 0 0 auto;
    border-color: inherit;
}


// Card actions
.k-card-actions {
    // @extend %top-rounded-child;
    // @extend %bottom-rounded-child;
    padding: @card-actions-padding-y @card-actions-padding-x;
    border-width: 0;
    border-style: solid;
    border-color: inherit;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    flex-basis: auto;

    .k-card > &:first-child {
        .border-top-radius( @card-border-radius );
    }
    .k-card > &:last-child {
        .border-bottom-radius( @card-border-radius );
    }

    .k-card > & {
        border-top-width: @card-actions-border-width;
        border-color: inherit;
    }

    .k-card-horizontal &,
    .k-card-vertical & {
        border: 0;
    }

    .k-button {
        max-width: 100%;
        white-space: normal;
    }

    > .k-button.k-flat:first-child {
        margin-left: (-@card-button-padding-x);
    }

    &.k-card-actions-start { justify-content: flex-start; }
    &.k-card-actions-end { justify-content: flex-end; }
    &.k-card-actions-center { justify-content: center; }
}
.k-card-action {
    border-width: 0;
    border-style: solid;
    border-color: inherit;
    display: inline-flex;
    flex: 1 1 auto;

    > .k-button {
        .border-radius( 0 );
        padding: (@card-actions-padding-y + @card-button-padding-y) @card-actions-padding-x;
        flex: 1 1 auto;
    }
}

.k-card-actions-vertical {
    padding: 0;
    display: flex;
    flex-direction: column;

    .k-button {
        padding: (@card-actions-padding-y + @button-padding-y) @card-actions-padding-x;

        &.k-flat:first-child {
            margin-left: 0;
        }
    }

    .k-card-action + .k-card-action {
        border-top-width: @card-actions-border-width;
    }

    .k-card-horizontal & {
        border-top-width: 0;
        border-left-width: @card-actions-border-width;
    }

    .k-card-vertical & {
        &.k-card-actions-start { align-items: flex-start; }
        &.k-card-actions-end { align-items: flex-end; }
        &.k-card-actions-center { align-items: center; }

        &.k-card-actions-start,
        &.k-card-actions-end,
        &.k-card-actions-center {
            padding: @card-actions-padding-y @card-actions-padding-x;

            .k-button {
                padding: @button-padding-y @button-padding-x;
            }
        }
    }
}
.k-card-actions-stretched {
    padding: 0;
    display: flex;
    flex-direction: row;

    .k-button {
        padding: (@card-actions-padding-y + @button-padding-y) @card-actions-padding-x;
        flex-grow: 1;
        border-radius: 0;

        &.k-flat:first-child {
            margin-left: 0;
        }
    }

    .k-card-action + .k-card-action {
        border-left-width: @card-actions-border-width;
    }

    &.k-card-actions-vertical {
        flex-direction: column;
    }
}


// List
.k-card-list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    flex: 0 0 auto;

    .k-card {
        flex: 0 0 auto;
    }
    .k-card + .k-card {
        margin-top: @card-deck-gap;
    }
}


// Deck
.k-card-deck {
    display: flex;
    margin-top: @card-deck-gap;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    flex: 0 0 auto;

    .k-card {
        flex: 0 0 auto;
    }
    .k-card + .k-card {
        margin-left: @card-deck-gap;
    }
}
.k-card-deck-scrollwrap {
    display: flex;
    position: relative;
    align-items: center;

    > .k-button {
        .border-radius( @card-deck-scroll-button-radius );
        flex: 0 0 auto;
        position: absolute;
        z-index: 1;

        &:first-child {
            left: @card-deck-scroll-button-offset;
        }

        &:last-child {
            right: @card-deck-scroll-button-offset;
        }
    }

    > .k-card-deck {
        flex: 1 1 auto;
    }
}


// Group
.k-card-group {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    flex: 0 0 auto;

    .k-card {
        .border-radius(0);
        flex: 0 0 auto;

        > .k-card-header {
            .border-radius(0);
        }
    }
    .k-card + .k-card {
        margin-left: -1px;
    }


    // Border-radius
    .k-card.k-first {
        .border-left-radius( @card-border-radius );

        > .k-card-header {
            border-top-left-radius: @card-border-radius;
        }
    }
    .k-card.k-last {
        .border-right-radius( @card-border-radius );

        > .k-card-header {
            border-top-right-radius: @card-border-radius;
        }
    }
    .k-card.k-only {
        .border-radius( @card-border-radius );

        > .k-card-header {
            .border-top-radius( @card-border-radius );
        }
    }
}




// RTL
.k-rtl,
[dir="rtl"] {

    // Deck
    .k-card-deck {
        .k-card + .k-card {
            margin-left: 0;
            margin-right: @card-deck-gap;
        }
    }
}




// IE 11
.k-ie11 {

    // IE11 needs units to be added to flex-basis when in shorthand
    // Thus, `flex: x x 0` will be ignored and we need `flex: x x auto`
    // See https://github.com/philipwalton/flexbugs#flexbug-4
    .k-card-body {
        flex: 1 1 auto;
    }

}
