//
// _card.scss
//

.card {
    box-shadow: $card-box-shadow;
    margin-bottom: $spacer;

    &.card-collapse {
        .card-header {
            border-bottom: 0;
        }
    }

    &.card-collapsed {
        overflow: hidden;

        .card-header {
            border-bottom: 0;

            .card-action-item {
                &[data-action="card-toggle"] {
                    i, svg {
                        transform: rotate(-180deg);
                    }
                    iconify-icon {
                        display: inline-block;
                        transform: rotate(-180deg);
                    }
                }
            }
        }

        .card-body {
            margin-bottom: -$card-spacer-y * 2;

            & + .card-body,
            &.p-0 {
                margin-bottom: 0; // remove margin for 2nd
            }
        }

        .card-footer {
            margin-top: -$card-cap-padding-y;
            margin-bottom: -$card-cap-padding-y;
        }
    }

    &[class*='text'] {
        .card-action-item {
            background-color: rgba(var(--#{$prefix}white-rgb), 0.2) !important;
            color: $white !important;
        }
    }

    .card-title {
        font-size: 15px;
        text-transform: none;
    }

    &.card-bordered {
        border: none;
        border-inline-start: 3px solid;
    }
}

// Custom class for Card backgrouns color
.card-bg {
    background-color: $card-bg;
}

// Card Header
.card-header {
    display: flex;
    align-items: center;
    border-bottom: 1px dashed var(--#{$prefix}border-color);
    @extend .gap-3;
    @extend .flex-wrap;

    &.border-dashed {
        border-bottom-style: dashed !important;
    }
}

// Custom Card Style
.card-out-of-container {
    margin-inline-start: calc(calc($spacer + 1px) * -1);
    margin-inline-end: calc(calc($spacer + 1px) * -1);
    border-radius: 0;
    border-top: 0;

    html[data-layout='topnav'] & {
        margin-inline-start: 0;
        margin-top: $spacer;
        margin-inline-end: 0;
        border-radius: $card-border-radius;
    }
}

// Card Action
.card-action {
    display: flex;
    gap: 0.25rem;
    margin-inline-start: auto;

    .card-action-item {
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        height: 24px;
        width: 24px;
        line-height: 22px;
        text-align: center;
        border-radius: 50%;
        background-color: rgba(var(--#{$prefix}light-rgb), 0.75);
        color: $gray-700;
        transition: all 0.3s ease-out, transform 0.1s ease-in-out;

        i,svg, iconify-icon {
            vertical-align: middle;
            transition: transform 0.2s ease-in-out;
        }

        &:hover {
            background-color: rgba(var(--#{$prefix}primary-rgb), 0.2);
            color: var(--#{$prefix}primary);
        }
    }
}

// Card Overlay
.card-overlay {
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--#{$prefix}primary-rgb), 0.15);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: var(--#{$prefix}border-radius);
}

// Custom card height
.card-h-100 {
    height: calc(100% - #{$spacer});
}

// Code Body (Custom Component)
.code-body {
    display: none;

    pre {
        max-height: 300px;
        scrollbar-width: thin;
        @extend .bg-light-subtle;
    }
}

// Card Stick Style
.card-top-sticky {
    @extend .position-sticky;
    top: calc(var(--#{$prefix}topbar-height) + $spacer);
}

// Custom Card Tabs Support
.card-tabs {
    border-bottom: 1px solid var(--#{$prefix}border-color) !important;

    .card-header-tabs {
        margin-top: calc(var(--#{$prefix}card-cap-padding-y) * -1);
        border-bottom: 0 !important;
    }

    .nav-link {
        --#{$prefix}nav-link-padding-y: calc(var(--#{$prefix}card-cap-padding-y) + 2px);
    }
}