/**
 * KS Recent Posts v2.2.0 - Frontend Styles
 * Grid + optional slider with auto-slide.
 * v2.2.0: frachtbedarf style — one-line header (title + subtitle + link, bottom
 * border like the product showcase header), transparent cards without outline,
 * rounded featured images (--ksrp-img-radius).
 */

/* ═══════════════════════════════════════════
   SECTION
   ═══════════════════════════════════════════ */
.ksrp-section {
    padding: 40px 15px;
    position: relative;
}

/* ═══════════════════════════════════════════
   HEADER — title left-aligned, "vis alle" right
   ═══════════════════════════════════════════ */
.ksrp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1.5px solid #e2e8f0;
    max-width: inherit;
}

/* v2.2.0: left group keeps title + subtitle on one line
   (matches .ksps-section-header / frachtbedarf module-header) */
.ksrp-header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.ksrp-section-title {
    font-weight: 700;
    color: #222;
    margin: 0;
    padding: 0;
    line-height: 1.3;
    white-space: nowrap;
}

.ksrp-section-subtitle {
    margin: 0;
    padding: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ksrp-header-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--ksrp-accent, #e74c3c);
    text-decoration: none !important;
    white-space: nowrap;
    transition: opacity 0.2s;
    margin-left: auto;
}

.ksrp-header-link:hover {
    opacity: 0.7;
}

/* ═══════════════════════════════════════════
   GRID MODE
   ═══════════════════════════════════════════ */
.ksrp-grid {
    display: grid;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ═══════════════════════════════════════════
   CARD
   ═══════════════════════════════════════════ */
.ksrp-card {
    background: transparent;
    border: none;
    border-radius: var(--ksrp-radius, 0);
    overflow: visible;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* v2.2.0 frachtbedarf style: no card shadow (card is transparent) */
.ksrp-card:hover {
    transform: translateY(-3px);
}

/* ═══════════════════════════════════════════
   THUMBNAIL — uses <img> tag for proper sizing
   ═══════════════════════════════════════════ */
.ksrp-thumb-link {
    display: block;
    overflow: hidden;
    border-radius: var(--ksrp-img-radius, 8px);
}

.ksrp-thumb {
    width: 100%;
    height: var(--ksrp-img-h, 220px);
    overflow: hidden;
    border-radius: var(--ksrp-img-radius, 8px);
}

.ksrp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.ksrp-card:hover .ksrp-thumb img {
    transform: scale(1.05);
}

.ksrp-thumb-placeholder {
    width: 100%;
    height: var(--ksrp-img-h, 220px);
    background-color: #e5e5e5;
    border-radius: var(--ksrp-img-radius, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ksrp-thumb-placeholder::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    background: #ccc;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════
   BODY
   ═══════════════════════════════════════════ */
.ksrp-body {
    padding: 16px 0 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Title */
.ksrp-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px;
    padding: 0;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ksrp-title a {
    color: inherit;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.ksrp-title a:hover {
    color: var(--ksrp-accent, #e74c3c);
}

/* Excerpt */
.ksrp-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
    flex: 1;
}

.ksrp-excerpt p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta */
.ksrp-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #999;
    flex-wrap: wrap;
    margin-top: auto;
}

.ksrp-meta-label {
    color: #bbb;
}

.ksrp-author a {
    color: #666;
    text-decoration: none !important;
    font-weight: 500;
}

.ksrp-author a:hover {
    color: #333;
}

.ksrp-date {
    color: #999;
}

.ksrp-author + .ksrp-date::before {
    content: '·';
    margin-right: 12px;
    color: #ccc;
}

/* ═══════════════════════════════════════════
   SLIDER MODE
   ═══════════════════════════════════════════ */
.ksrp-slider {
    position: relative;
    overflow: hidden;
}

.ksrp-slider-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.ksrp-slide {
    flex-shrink: 0;
}

/* Slider: disable card hover transform (conflicts with sliding) */
.ksrp-slider .ksrp-card:hover {
    transform: none;
}

/* ═══════════════════════════════════════════
   SLIDER ARROWS
   ═══════════════════════════════════════════ */
.ksrp-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.ksrp-arrow:hover {
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    color: var(--ksrp-accent, #e74c3c);
    border-color: var(--ksrp-accent, #e74c3c);
}

.ksrp-arrow-prev {
    left: -8px;
}

.ksrp-arrow-next {
    right: -8px;
}

/* Hide arrows when not needed */
.ksrp-arrow[disabled] {
    opacity: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   SLIDER DOTS
   ═══════════════════════════════════════════ */
.ksrp-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.ksrp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.ksrp-dot.active {
    background: var(--ksrp-accent, #e74c3c);
    transform: scale(1.2);
}

.ksrp-dot:hover {
    background: var(--ksrp-accent, #e74c3c);
    opacity: 0.7;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 991px) {
    .ksrp-arrow-prev { left: 4px; }
    .ksrp-arrow-next { right: 4px; }
}

@media (max-width: 575px) {
    .ksrp-section { padding: 25px 10px; }
    .ksrp-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .ksrp-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .ksrp-section-title { white-space: normal; }
    .ksrp-section-subtitle { white-space: normal; }
    .ksrp-arrow { width: 34px; height: 34px; }
    .ksrp-arrow svg { width: 16px; height: 16px; }
}
