/**
 * MedLek Category Articles - Style CSS
 * Sekcja artykułów na stronach kategorii produktów WooCommerce
 *
 * @version 1.0.0
 */

/* ============================================
   Kontener sekcji
   ============================================ */

.medlek-category-articles {
    margin: 60px 0 40px;
    padding: 50px 40px;
    background: linear-gradient(135deg, #f8fafb 0%, #eef3f6 100%);
    border-radius: 16px;
    border: 1px solid rgba(0, 80, 120, 0.08);
}

/* ============================================
   Header sekcji
   ============================================ */

.medlek-articles-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid rgba(0, 80, 120, 0.1);
}

.medlek-articles-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0077a3 0%, #005577 100%);
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 85, 119, 0.25);
}

.medlek-articles-title-wrap {
    flex: 1;
}

.medlek-articles-title {
    margin: 0 0 8px !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    color: #1a3a4a !important;
    letter-spacing: -0.02em;
    line-height: 1.2 !important;
}

.medlek-articles-subtitle {
    margin: 0 !important;
    font-size: 15px;
    color: #5a7a8a;
    line-height: 1.5;
}

.medlek-articles-subtitle strong {
    color: #0077a3;
    font-weight: 600;
}

/* ============================================
   Grid artykułów
   ============================================ */

.medlek-articles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* ============================================
   Karta artykułu
   ============================================ */

.medlek-article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 40, 60, 0.06);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 80, 120, 0.06);
}

.medlek-article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 60, 90, 0.12);
    border-color: rgba(0, 119, 163, 0.2);
}

/* ============================================
   Thumbnail
   ============================================ */

.medlek-article-thumbnail {
    display: block;
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: linear-gradient(135deg, #e8f0f4 0%, #d0dfe6 100%);
}

.medlek-article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.medlek-article-card:hover .medlek-article-thumbnail img {
    transform: scale(1.05);
}

.medlek-article-thumbnail.medlek-no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ab;
}

/* ============================================
   Treść karty
   ============================================ */

.medlek-article-content {
    padding: 20px;
}

.medlek-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #7a9aaa;
}

.medlek-article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.medlek-article-meta svg {
    opacity: 0.7;
}

.medlek-article-heading {
    margin: 0 0 10px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

.medlek-article-heading a {
    color: #1a3a4a !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.medlek-article-heading a:hover {
    color: #0077a3 !important;
}

.medlek-article-excerpt {
    margin: 0 0 15px !important;
    font-size: 13px;
    line-height: 1.6;
    color: #6a8a9a;
}

.medlek-article-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #0077a3 !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.medlek-article-link:hover {
    color: #005577 !important;
    gap: 10px;
}

.medlek-article-link svg {
    transition: transform 0.2s ease;
}

.medlek-article-link:hover svg {
    transform: translateX(3px);
}

/* ============================================
   Footer - link do wszystkich
   ============================================ */

.medlek-articles-footer {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(0, 80, 120, 0.1);
    text-align: center;
}

.medlek-articles-view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #0077a3 0%, #005577 100%);
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 85, 119, 0.25);
}

.medlek-articles-view-all:hover {
    background: linear-gradient(135deg, #005577 0%, #003d55 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 85, 119, 0.35);
    color: #fff !important;
}

.medlek-articles-view-all svg {
    transition: transform 0.2s ease;
}

.medlek-articles-view-all:hover svg {
    transform: translateX(4px);
}

/* ============================================
   Badge "Naukowy" (opcjonalnie)
   ============================================ */

.medlek-article-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    background: rgba(0, 119, 163, 0.9);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

/* ============================================
   Responsive - Tablet
   ============================================ */

@media (max-width: 1200px) {
    .medlek-articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Responsive - Mobile
   ============================================ */

@media (max-width: 640px) {
    .medlek-articles-grid {
        grid-template-columns: 1fr;
    }

    .medlek-category-articles {
        padding: 30px 20px;
        margin: 40px 0 30px;
        border-radius: 12px;
    }

    .medlek-articles-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    .medlek-articles-icon {
        width: 48px;
        height: 48px;
    }

    .medlek-articles-icon svg {
        width: 24px;
        height: 24px;
    }

    .medlek-articles-title {
        font-size: 22px !important;
    }

    .medlek-articles-subtitle {
        font-size: 14px;
    }

    .medlek-article-content {
        padding: 16px;
    }

    .medlek-article-heading {
        font-size: 15px !important;
    }

    .medlek-articles-view-all {
        padding: 12px 24px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Animacje
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.medlek-category-articles {
    animation: fadeInUp 0.5s ease-out;
}

.medlek-article-card {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.medlek-article-card:nth-child(1) { animation-delay: 0.1s; }
.medlek-article-card:nth-child(2) { animation-delay: 0.2s; }
.medlek-article-card:nth-child(3) { animation-delay: 0.3s; }
.medlek-article-card:nth-child(4) { animation-delay: 0.4s; }

/* ============================================
   Print styles
   ============================================ */

@media print {
    .medlek-category-articles {
        background: none;
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .medlek-article-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .medlek-articles-view-all {
        display: none;
    }
}

/* ============================================
   OBRAZY W ARTYKUŁACH - Pływający układ
   Desktop: obok tekstu | Mobile: pod tekstem
   ============================================ */

/* Kontener figure - wspólne style */
.medlek-article-figure {
    margin: 0 0 1.5rem 0;
    padding: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Obraz wewnątrz figure */
.medlek-article-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 60, 90, 0.12);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.medlek-article-figure:hover .medlek-article-img {
    box-shadow: 0 8px 25px rgba(0, 60, 90, 0.18);
}

/* Figcaption - podpis pod obrazem */
.medlek-article-figure figcaption {
    margin-top: 10px;
    padding: 0 5px;
    font-size: 13px;
    color: #5a7a8a;
    text-align: center;
    font-style: italic;
    line-height: 1.4;
}

/* DESKTOP - Pływające obrazy obok tekstu */
@media (min-width: 769px) {

    /* Obraz po prawej stronie */
    .medlek-article-figure.medlek-img-right {
        float: right;
        width: 42%;
        max-width: 380px;
        margin: 0.3rem 0 1.5rem 2rem;
        clear: right;
    }

    /* Obraz po lewej stronie */
    .medlek-article-figure.medlek-img-left {
        float: left;
        width: 42%;
        max-width: 380px;
        margin: 0.3rem 2rem 1.5rem 0;
        clear: left;
    }

    /* Clearfix dla nagłówków H2 - tekst nie nachodzi */
    .entry-content h2,
    .post-content h2,
    .single-post h2,
    article h2 {
        clear: both;
    }
}

/* TABLET - Mniejsze pływające lub wyśrodkowane */
@media (min-width: 641px) and (max-width: 768px) {

    .medlek-article-figure.medlek-img-right,
    .medlek-article-figure.medlek-img-left {
        float: none;
        width: 65%;
        max-width: 320px;
        margin: 1.5rem auto;
        display: block;
    }
}

/* MOBILE - Obrazy na pełnej szerokości, pod tekstem */
@media (max-width: 640px) {

    .medlek-article-figure.medlek-img-right,
    .medlek-article-figure.medlek-img-left {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 1.5rem 0;
        display: block;
    }

    .medlek-article-figure figcaption {
        font-size: 12px;
        padding: 0 10px;
    }

    .medlek-article-img {
        border-radius: 8px;
    }
}

/* Clearfix - zapobieganie problemom z float */
.entry-content::after,
.post-content::after,
.single-post .content::after,
article .content::after {
    content: "";
    display: table;
    clear: both;
}

/* Print styles dla obrazów w artykułach */
@media print {
    .medlek-article-figure {
        float: none !important;
        width: 50% !important;
        margin: 1rem auto !important;
        page-break-inside: avoid;
    }

    .medlek-article-img {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
