/*
 * Kirjokampus site-wide fixes
 */

/* LearnDash's own blue replaced with the site palette */
:root,
body,
body .learndash-wrapper,
body .ld-focus,
body .learndash-wrapper--modern {
    --ld-color-brand-primary: #1b2432;
    --ld-color-button-bg: #1b2432;
    --ld-color-button-bg-hover: #374151;
    --ld-color-button-secondary-border: #1b2432;
    --ld-color-field-border-active: #8160c2;
    --ld-color-field-text-active: #1b2432;
    --ld-color-field-text-error: #1b2432;
    --ld-color-field-text-valid: #1b2432;
    --ld-color-label: #1b2432;
    --ld-color-system-dark: #1b2432;
    --ld-color-system-light-1: #f6f4fb;
    --ld-color-field-bg: #f6f4fb;
    --ld-color-primitives-blue-100: #f6f4fb;
    --ld-color-primitives-blue-150: #e4ddf4;
    --ld-color-primitives-blue-200: #c9bdea;
    --ld-color-primitives-blue-500: #1b2432;
    --ld-color-primitives-blue-800: #374151;
    --ld-color-semantic-alert-success-background: #eef7f1;
    --ld-color-semantic-alert-success-border: #7cd09d;
    --ld-color-semantic-alert-success-icon: #7cd09d;
    --ld-color-semantic-button-primary-background: #1b2432;
    --ld-color-semantic-button-primary-background-hover: #374151;
    --ld-color-semantic-button-secondary-background-hover: #f6f4fb;
    --ld-color-semantic-button-secondary-border: #1b2432;
    --ld-color-semantic-button-secondary-border-hover: #374151;
    --ld-color-semantic-button-tertiary-border: #1b2432;
    --ld-color-semantic-button-tertiary-focus: #e4ddf4;
    --ld-color-semantic-button-tertiary-text-hover: #8160c2;
    --ld-color-semantic-field-background-active: #f6f4fb;
    --ld-color-semantic-field-background-hover: #f6f4fb;
    --ld-color-semantic-text-link: #8160c2;
    --ld-color-semantic-text-link-hover: #1b2432;
    --ld-progress-bar-foreground-color: #3a9b5c;
}

/* Focus mode header: LearnDash hardcodes its blue for this button */
.learndash-wrapper .ld-focus .ld-focus-header .learndash_mark_complete_button,
.learndash-wrapper .ld-focus .ld-focus-header #learndash_mark_complete_button {
    color: #1b2432 !important;
    border-color: #1b2432 !important;
}

/* Completed steps are green */
.learndash-wrapper .ld-status-icon.ld-status-complete,
.learndash-wrapper .ld-status-complete.ld-secondary-background,
.learndash-wrapper .ld-progress .ld-progress-bar .ld-progress-bar-percentage {
    background: #3a9b5c !important;
}

.learndash-wrapper .ld-status-complete:not(.ld-status-icon),
.learndash-wrapper .ld-progress-bar__label-icon--complete,
.learndash-wrapper .ld-navigation__icon--lesson-complete,
.learndash-wrapper .ld-navigation__icon--topic-complete,
.learndash-wrapper .ld-navigation__label--completed,
.learndash-wrapper .ld-navigation__progress-completed-action {
    color: #3a9b5c !important;
}

/* Course page: the "Enroll" button of paid courses duplicates the purchase box */
.ld-course-status-seg-action.status-closed {
    display: none;
}

/* Section headings (e.g. profile "Kurssisi") aligned with their actions */
.learndash-wrapper .ld-section-heading {
    align-items: center;
}

.learndash-wrapper .ld-section-heading > h3 {
    margin: 0 !important;
}

/* Reviews: replying opens a single review page that isn't public */
.reply_to_review_link {
    display: none !important;
}

/* Course cards: rating stars link to the course reviews */
.jet-listing-grid__item .rating-container,
.jet-listing-grid__item .rating-container * {
    cursor: pointer !important;
}

/* "Katso myös" section is hidden when the course has no related courses */
.elementor-element-8d7ae61:has(+ .elementor-element-37851b0 .jet-listing-not-found),
.elementor-element-37851b0:has(.jet-listing-not-found) {
    display: none;
}

/* Search results: keep the title below the floating header */
body.search .elementor-location-archive,
body.search-results .elementor-location-archive,
body.search-no-results .elementor-location-archive {
    padding-top: 140px;
}

/* Footer: "Luo tunnus" link on the dark background */
.elementor-location-footer .elementor-widget-text-editor a {
    color: #ebc408;
    text-decoration: underline;
}

/* Contact form in the site style */
.elementor-widget-form .elementor-field-group {
    margin-bottom: 14px;
}

.elementor-widget-form .elementor-field-label {
    font-weight: 600;
    margin-bottom: 6px;
}

.elementor-widget-form .elementor-field-textual {
    border: 1px solid #1b2432;
    border-radius: 20px;
    background: #f7f9f9;
    padding: 12px 18px;
}

.elementor-widget-form textarea.elementor-field-textual {
    min-height: 160px;
}

.elementor-widget-form .elementor-button {
    background: #1b2432;
    border-radius: 999px;
    font-weight: 700;
}

.elementor-widget-form .elementor-button:hover {
    background: #374151;
}

/* WooCommerce cart & checkout fields in the site style */
.woocommerce-cart .coupon .input-text,
.woocommerce-checkout .form-row .input-text,
.woocommerce-checkout .form-row textarea,
.woocommerce-checkout .select2-container .select2-selection--single {
    border: 1px solid #1b2432 !important;
    border-radius: 20px !important;
    background: #f7f9f9;
}

.woocommerce-cart .coupon .input-text {
    padding: 12px 18px !important;
}

.woocommerce-checkout .select2-container .select2-selection--single {
    height: 50px !important;
    display: flex;
    align-items: center;
}

.woocommerce-checkout .select2-container .select2-selection__rendered {
    line-height: normal !important;
    padding: 0 18px !important;
}

.woocommerce-checkout .select2-container .select2-selection__arrow {
    height: 100% !important;
    right: 12px !important;
}

.woocommerce-cart .coupon .e-apply-coupon {
    border: 2px solid #1b2432 !important;
    border-radius: 999px !important;
    color: #1b2432 !important;
    background: transparent !important;
    font-weight: 700;
}

.woocommerce-cart .coupon .e-apply-coupon:hover {
    background: #1b2432 !important;
    color: #fff !important;
}

/* Side cart ("Esikatselu") in the site style */
.xoo-wsc-container,
.xoo-wsc-modal .xoo-wsc-container * {
    font-family: inherit;
}

.xoo-wsc-header {
    font-weight: 700;
}

.xoo-wsc-product {
    border-radius: 20px;
}

.xoo-wsc-product dl,
.xoo-wsc-product dd,
.xoo-wsc-product dt,
.xoo-wsc-product .variation {
    font-style: normal !important;
}

.xoo-wsc-ft-buttons-cont .xoo-wsc-ft-btn,
.xoo-wsc-ft-btn {
    border-radius: 999px !important;
    font-weight: 700;
    margin-bottom: 8px;
}

.xoo-wsc-ft-btn.xoo-wsc-ft-btn-continue,
.xoo-wsc-ft-btn.xoo-wsc-ft-btn-cart {
    background: transparent !important;
    color: #1b2432 !important;
    border: 2px solid #1b2432 !important;
}

/* Text pages (e.g. Ohjeita) built with the block editor: readable width and spacing */
body.page .elementor-widget-theme-post-content:has(.wp-block-heading) {
    max-width: 820px !important;
    margin: 0 auto !important;
    line-height: 1.65;
}

body.page .elementor-widget-theme-post-content h2.wp-block-heading {
    margin: 48px 0 16px;
}

body.page .elementor-widget-theme-post-content .wp-block-list {
    margin: 0 0 20px;
    padding-left: 1.4em;
}

body.page .elementor-widget-theme-post-content .wp-block-list li {
    margin-bottom: 8px;
}

body.page .elementor-widget-theme-post-content p a,
body.page .elementor-widget-theme-post-content li a {
    color: #8160c2;
    text-decoration: underline;
}

/* Course cards: "Lue lisää" buttons at the bottom of every card */
.jet-listing-grid__item > .elementor,
.jet-listing-grid__item .elementor-element-1b55ceb,
.jet-listing-grid__item .elementor-element-1b55ceb > .e-con-inner {
    height: 100%;
}

.jet-listing-grid__item .elementor-element-0bc1a9c {
    flex-grow: 1;
}

.jet-listing-grid__item .elementor-element-1ca29b8 {
    margin-top: auto;
}

/* My Account notices: buttons like "Katso koulutustarjonta" in the site style */
.woocommerce-account .woocommerce-info .button,
.woocommerce-account .woocommerce-message .button,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Button {
    background: #1b2432 !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 999px !important;
    padding: 10px 24px !important;
    font-weight: 700;
    text-decoration: none;
}

.woocommerce-account .woocommerce-info .button:hover,
.woocommerce-account .woocommerce-message .button:hover,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Button:hover {
    background: #374151 !important;
}

/* Text pages: lead paragraph and highlighted quote (e.g. Tarinamme) */
body.page .elementor-widget-theme-post-content .kk-lead {
    font-size: 1.25em;
    font-weight: 600;
    color: #1b2432;
}

body.page .elementor-widget-theme-post-content .wp-block-quote.kk-highlight {
    margin: 32px 0 16px;
    padding: 20px 28px;
    border-left: 4px solid #8160c2;
    border-radius: 0 16px 16px 0;
    background: #fff;
    font-size: 1.2em;
    color: #1b2432;
}

body.page .elementor-widget-theme-post-content .wp-block-quote.kk-highlight p {
    margin: 0;
}

body.page .elementor-widget-theme-post-content .kk-tagline {
    color: #8160c2;
}
