@import "~theme/globals";

:host {
    ion-card {
        display: flex;
        flex-direction: column;
        align-self: stretch;
        height: calc(100% - 20px);

        @for $i from 0 to length($core-course-image-background) {
            &[course-color="#{$i}"] .core-course-thumb {
                background: nth($core-course-image-background, $i + 1);
            }
        }

        .core-course-thumb {
            padding-top: 40%;
            width: 100%;
            overflow: hidden;
            cursor: pointer;
            pointer-events: auto;
            position: relative;
            background-position: center;
            background-size: cover;
            -webkit-transition: all 50ms ease-in-out;
            transition: all 50ms ease-in-out;

            &.core-course-color-img {
                background: white;
            }

            img {
                position: absolute;
                top: 0;
                bottom: 0;
                margin: auto;
            }
        }

        .core-course-additional-info {
            margin-bottom: 8px;
        }

        .core-course-header {
            padding-top: 8px;
            padding-bottom: 8px;
            .core-course-title {
                margin: 5px 0;
                flex-grow: 1;

                h2 ion-icon {
                    margin-right: 4px;
                    color: var(--core-star-color);
                }
            }

            &.core-course-more-than-title {
                padding-bottom: 0;
            }

            .core-button-spinner {
                margin: 0;
            }
            .core-button-spinner ion-spinner {
                vertical-align: top; // the better option for most scenarios
                vertical-align: -webkit-baseline-middle; // the best for those that support it
            }

            .core-button-spinner .core-icon-downloaded {
                font-size: 28.8px;
                margin-top: 8px;
                vertical-align: top;
            }

            .item-button[icon-only] {
                min-width: 50px;
                width: 50px;
            }
        }
    }

    button {
        z-index: 1;
    }
}

:host-context(.core-horizontal-scroll) {
    @include horizontal_scroll_item(80%, 250px, 300px);

    ion-card {
        .core-course-thumb {
            padding-top: 30%;
        }

        .core-course-header {
            padding-top: 4px;
            padding-bottom: 4px;

            .core-course-title {
                margin: 3px 0;

                h2 ion-icon {
                    margin-right: 2px;
                }

                &.core-course-with-buttons {
                    max-width: calc(100% - 40px);
                }
            }
            .core-button-spinner {
                min-height: 40px;
                min-width: 40px;

                ion-spinner {
                    width: 20px;
                    height: 20px;
                }
            }
            .item-button[icon-only] {
                min-width: 40px;
                width: 40px;
                padding: 8px;
            }

        }
    }
}

:host-context(body.version-3-1) {
    .core-course-thumb{
        display: none;
    }
}
