/**
 * Betformatics Mixed Feed Styles
 *
 * Dependencies: betformatics-variables (loaded via PHP)
 *
 * @package Betformatics
 */

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */
.bf-mixed-feed {
    display: grid;
    gap: 1rem;
    width: 100%;
}

/* Column variations */
.bf-mixed-feed-cols-1 {
    grid-template-columns: 1fr;
}

.bf-mixed-feed-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.bf-mixed-feed-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.bf-mixed-feed-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ==========================================================================
   FEED ITEM - HORIZONTAL CARD
   ========================================================================== */
.bf-mixed-feed-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--bf-white);
    border-radius: var(--bf-radius-base);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    border: 1px solid var(--bf-border);
}

.bf-mixed-feed-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.bf-mixed-feed-item-inner {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 100px;
    flex: 1;
}

/* ==========================================================================
   IMAGE - LEFT SIDE (stretches to card height)
   ========================================================================== */
.bf-mixed-feed-image {
    position: relative;
    flex: 0 0 140px;
    width: 140px;
    align-self: stretch;
    overflow: hidden;
    background: #f5f5f5;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

/* Featured images (40:21 ratio / 1200x630) - ensure minimum height matches aspect ratio */
/* Applies to posts, kampagner with featured images */
.bf-mixed-feed-item-post .bf-mixed-feed-image,
.bf-mixed-feed-item-kampagne .bf-mixed-feed-image:not(.bf-mixed-feed-image-brandcolor) {
    min-height: calc(140px * 21 / 40); /* ~73.5px - matches 40:21 aspect ratio */
}

.bf-mixed-feed-item-post .bf-mixed-feed-image img,
.bf-mixed-feed-item-kampagne .bf-mixed-feed-image:not(.bf-mixed-feed-image-brandcolor) img {
    min-height: 100%;
    min-width: 100%;
    object-position: center top;
}

.bf-mixed-feed-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.bf-mixed-feed-item:hover .bf-mixed-feed-image img {
    transform: scale(1.05);
}

/* ==========================================================================
   BRANDCOLOR IMAGE (Anmeldelser + Kampagne fallback)
   ========================================================================== */
.bf-mixed-feed-image.bf-mixed-feed-image-brandcolor {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
}

.bf-mixed-feed-image-brandcolor img.bf-mixed-feed-logo {
    position: static;
    width: auto;
    height: auto;
    max-width: 70%;
    max-height: 50%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.bf-mixed-feed-item:hover .bf-mixed-feed-image-brandcolor img.bf-mixed-feed-logo {
    transform: scale(1.08);
}

/* ==========================================================================
   LABEL (Horizontal - in content area, top aligned)
   ========================================================================== */
.bf-mixed-feed-label {
    align-self: flex-start;
    background: #b45309; /* Darker orange for WCAG AA contrast */
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.25rem 0.5rem;
    line-height: 1.2;
    border-radius: 0 0 3px 0;
    margin: 0 0 0.25rem -1rem;
    white-space: nowrap;
}

/* Anmeldelse label - blue */
.bf-mixed-feed-item-anmeldelse .bf-mixed-feed-label {
    background: #1d4ed8; /* Darker blue for WCAG AA contrast */
}

/* Kampagne label - green */
.bf-mixed-feed-item-kampagne .bf-mixed-feed-label {
    background: #15803d; /* Darker green for WCAG AA contrast */
}

/* ==========================================================================
   CONTENT - RIGHT SIDE
   ========================================================================== */
.bf-mixed-feed-content {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
    min-width: 0;
}

/* When label is present, align content to top */
.bf-mixed-feed-content:has(.bf-mixed-feed-label) {
    justify-content: flex-start;
    padding-top: 0;
}

/* Date - improved contrast for accessibility (WCAG AA) */
.bf-mixed-feed-date {
    font-size: 0.7rem;
    color: #595959; /* Improved from #888 for better contrast ratio */
    margin: 0 0 0.375rem 0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Title */
.bf-mixed-feed-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 0.5rem 0;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bf-mixed-feed-item:hover .bf-mixed-feed-title {
    color: #1a1a1a;
}

/* Terms/Categories - Orange color with improved contrast for accessibility (WCAG AA) */
.bf-mixed-feed-terms {
    font-size: 0.75rem;
    color: #b45309; /* Improved from #f59e0b for better contrast ratio on white background */
    margin: 0;
    font-weight: 500;
}

.bf-mixed-feed-terms span {
    display: inline;
}

/* End date for kampagner - Green color with improved contrast for accessibility (WCAG AA) */
.bf-mixed-feed-end-date {
    font-size: 0.75rem;
    color: #0f7b3b; /* Improved from #16a34a for better contrast ratio */
    margin: 0;
    font-weight: 500;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.bf-mixed-feed-empty {
    padding: 2rem;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1200px) {
    .bf-mixed-feed-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .bf-mixed-feed-cols-3,
    .bf-mixed-feed-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .bf-mixed-feed-cols-2,
    .bf-mixed-feed-cols-3,
    .bf-mixed-feed-cols-4 {
        grid-template-columns: 1fr;
    }

    .bf-mixed-feed-image {
        flex: 0 0 120px;
        width: 120px;
    }

    .bf-mixed-feed-item-post .bf-mixed-feed-image,
    .bf-mixed-feed-item-kampagne .bf-mixed-feed-image:not(.bf-mixed-feed-image-brandcolor) {
        min-height: calc(120px * 21 / 40);
    }

    .bf-mixed-feed-label {
        font-size: 0.5rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .bf-mixed-feed-image {
        flex: 0 0 100px;
        width: 100px;
    }

    .bf-mixed-feed-item-post .bf-mixed-feed-image,
    .bf-mixed-feed-item-kampagne .bf-mixed-feed-image:not(.bf-mixed-feed-image-brandcolor) {
        min-height: calc(100px * 21 / 40);
    }

    .bf-mixed-feed-content {
        padding: 0.75rem;
    }

    .bf-mixed-feed-title {
        font-size: 0.875rem;
    }
}
