/**
 * Post Cards Styles - Light & Modern Design
 *
 * @package Simdealz_Produktkarten
 * @since 1.1.0
 */

/* ==========================================================================
   CSS Variables - Light Theme
   ========================================================================== */

.pk-post-cards-wrapper {
    --pk-post-columns: 3;
    --pk-post-gap: 28px;
    --pk-image-padding: 0px;
    --pk-title-size: 20px;
    --pk-card-radius: 20px;
    --pk-primary: #EB0909;
    --pk-primary-light: #E61F28;
    --pk-primary-dark: #C00707;
    --pk-accent: #FDD01D;
    --pk-text: #000000;
    --pk-text-light: #555555;
    --pk-bg: #FFFFFF;
    --pk-bg-soft: #f5f5f5;
    --pk-border: #e0e0e0;
    --pk-transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.pk-post-cards-grid {
    display: grid;
    grid-template-columns: repeat(var(--pk-post-columns), 1fr);
    gap: var(--pk-post-gap);
}

@media (max-width: 1024px) {
    .pk-post-cards-grid {
        grid-template-columns: repeat(min(var(--pk-post-columns), 2), 1fr);
    }
}

@media (max-width: 640px) {
    .pk-post-cards-wrapper {
        --pk-post-gap: 12px;
    }
    .pk-post-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Empty State */
.pk-post-cards-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 32px;
    background: var(--pk-bg-soft);
    border-radius: var(--pk-card-radius);
    color: var(--pk-text-light);
    font-size: 17px;
    font-weight: 500;
}

/* ==========================================================================
   Card Base - Light & Airy
   ========================================================================== */

.pk-post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--pk-bg);
    border-radius: var(--pk-card-radius);
    overflow: hidden;
    border: 1px solid var(--pk-border);
    transition: var(--pk-transition);
}

.pk-post-card:hover {
    transform: translateY(-12px);
    border-color: transparent;
    box-shadow:
        0 25px 50px -12px rgba(235, 9, 9, 0.15),
        0 0 0 1px rgba(235, 9, 9, 0.1);
}

/* ==========================================================================
   Card Image
   ========================================================================== */

.pk-post-card-image {
    position: relative;
    overflow: hidden;
    background: var(--pk-bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--pk-image-padding);
}

/* Custom Height wenn gesetzt */
.pk-post-cards-wrapper[style*="--pk-image-height"] .pk-post-card-image {
    height: var(--pk-image-height);
}

.pk-post-card-image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.pk-post-card-image img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pk-post-card:hover .pk-post-card-image img {
    transform: scale(1.03);
}

/* Image Fit: Contain (ganzes Bild, kein Zuschneiden) - Standard */
.pk-image-fit-contain .pk-post-card-image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Image Fit: Cover (zuschneiden um zu fuellen) */
.pk-image-fit-cover .pk-post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image Ratios - nur bei cover oder fester Hoehe sinnvoll */
.pk-post-card-image.pk-ratio-16-9 { aspect-ratio: 16 / 9; }
.pk-post-card-image.pk-ratio-4-3 { aspect-ratio: 4 / 3; }
.pk-post-card-image.pk-ratio-1-1 { aspect-ratio: 1 / 1; }
.pk-post-card-image.pk-ratio-3-2 { aspect-ratio: 3 / 2; }
.pk-post-card-image.pk-ratio-auto { aspect-ratio: auto; }

/* No Image Placeholder */
.pk-post-card-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 180px;
    background: linear-gradient(135deg, var(--pk-bg-soft) 0%, #e2e8f0 100%);
    color: #cbd5e1;
}

.pk-post-card-no-image svg {
    width: 48px;
    height: 48px;
}

/* ==========================================================================
   Card Content
   ========================================================================== */

.pk-post-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 28px 32px 32px 32px;
}

/* Meta Top (Category/Tag) */
.pk-post-card-meta-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.pk-post-card-category,
.pk-post-card-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
}

.pk-post-card-category {
    background: #ffecec;
    color: var(--pk-primary);
}

.pk-post-card-tag {
    background: #fff9e0;
    color: #9a7800;
}

/* Title */
.pk-post-card-title {
    margin: 0 0 16px 0;
    font-size: var(--pk-title-size);
    font-weight: 700;
    line-height: 1.45;
    color: var(--pk-text);
    text-align: center;
}

.pk-post-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.pk-post-card-title a:hover {
    color: var(--pk-primary);
}

/* Excerpt */
.pk-post-card-excerpt {
    flex: 1;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--pk-text-light);
}

/* ==========================================================================
   Card Footer
   ========================================================================== */

.pk-post-card-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--pk-border);
}

/* Meta (Date/Author) */
.pk-post-card-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.pk-post-card-date,
.pk-post-card-author {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--pk-text-light);
}

.pk-post-card-date svg,
.pk-post-card-author svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* Button */
.pk-post-card-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff !important;
    background: var(--pk-primary);
    border-radius: 10px;
    text-decoration: none !important;
    transition: var(--pk-transition);
}

.pk-post-card-button:hover,
.pk-post-card-button:focus,
.pk-post-card-button:active,
.pk-post-card-button:visited {
    background: var(--pk-primary-dark);
    color: #fff !important;
    text-decoration: none !important;
    transform: translateX(4px);
}

.pk-post-card-button svg {
    transition: transform 0.3s ease;
}

.pk-post-card-button:hover svg {
    transform: translateX(4px);
}

/* ==========================================================================
   Style: Minimal
   ========================================================================== */

.pk-post-cards-style-minimal .pk-post-card {
    border: 2px solid var(--pk-border);
    border-radius: 16px;
}

.pk-post-cards-style-minimal .pk-post-card:hover {
    border-color: var(--pk-primary-light);
    box-shadow: 0 0 0 4px rgba(235, 9, 9, 0.08);
    transform: translateY(-6px);
}

.pk-post-cards-style-minimal .pk-post-card-content {
    padding: 20px;
}

.pk-post-cards-style-minimal .pk-post-card-title {
    font-size: 17px;
}

.pk-post-cards-style-minimal .pk-post-card-button {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
    color: #fff !important;
    text-decoration: none !important;
}

.pk-post-cards-style-minimal .pk-post-card-button:hover,
.pk-post-cards-style-minimal .pk-post-card-button:focus,
.pk-post-cards-style-minimal .pk-post-card-button:active,
.pk-post-cards-style-minimal .pk-post-card-button:visited {
    color: #fff !important;
    text-decoration: none !important;
}

/* ==========================================================================
   Style: Overlay
   ========================================================================== */

.pk-post-cards-style-overlay .pk-post-card {
    position: relative;
    min-height: 300px;
    border: none;
}

.pk-post-cards-style-overlay .pk-post-card-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.pk-post-cards-style-overlay .pk-post-card-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, 0.7) 100%
    );
    transition: var(--pk-transition);
}

.pk-post-cards-style-overlay .pk-post-card:hover .pk-post-card-image::after {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 20%,
        rgba(0, 0, 0, 0.8) 100%
    );
}

.pk-post-cards-style-overlay .pk-post-card-overlay-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px;
    z-index: 2;
}

.pk-post-cards-style-overlay .pk-post-card-title {
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.pk-post-cards-style-overlay .pk-post-card-title a {
    color: #fff;
}

.pk-post-cards-style-overlay .pk-post-card-title a:hover {
    color: #fff;
    opacity: 0.9;
}

.pk-post-cards-style-overlay .pk-post-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pk-post-cards-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--pk-border);
}

.pk-post-cards-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--pk-text);
    background: var(--pk-bg);
    border: 2px solid var(--pk-border);
    border-radius: 10px;
    text-decoration: none;
    transition: var(--pk-transition);
}

.pk-post-cards-pagination .page-numbers:hover {
    border-color: var(--pk-primary);
    color: var(--pk-primary);
}

.pk-post-cards-pagination .page-numbers.current {
    color: #fff;
    background: var(--pk-primary);
    border-color: var(--pk-primary);
}

.pk-post-cards-pagination .page-numbers.dots {
    border: none;
    background: none;
    color: var(--pk-text-light);
    min-width: auto;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

.pk-post-card {
    animation: fadeInUp 0.5s ease forwards;
}

.pk-post-card:nth-child(1) { animation-delay: 0.05s; }
.pk-post-card:nth-child(2) { animation-delay: 0.1s; }
.pk-post-card:nth-child(3) { animation-delay: 0.15s; }
.pk-post-card:nth-child(4) { animation-delay: 0.2s; }
.pk-post-card:nth-child(5) { animation-delay: 0.25s; }
.pk-post-card:nth-child(6) { animation-delay: 0.3s; }

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 640px) {
    .pk-post-card-content {
        padding: 24px;
    }

    .pk-post-card-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .pk-post-card-excerpt {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .pk-post-card-footer {
        flex-direction: column;
        align-items: stretch;
        padding-top: 20px;
    }

    .pk-post-card-button {
        justify-content: center;
    }

    .pk-post-cards-style-overlay .pk-post-card {
        min-height: 260px;
    }

    .pk-post-cards-style-overlay .pk-post-card-title {
        font-size: 17px;
    }
}

/* ==========================================================================
   Style: Device (Titel oben, Bild, Button unten)
   ========================================================================== */

.pk-post-cards-style-device .pk-post-card {
    border-radius: 6px;
    border: 1px solid rgba(125, 125, 125, 0.17);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 10px;
}

.pk-post-cards-style-device .pk-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.pk-post-cards-style-device .pk-post-card-content {
    display: flex;
    flex-direction: column;
    padding: 0;
    order: -1;
}

.pk-post-cards-style-device .pk-post-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 10px 0;
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pk-post-cards-style-device .pk-post-card-title a {
    color: #111;
}

.pk-post-cards-style-device .pk-post-card-title a:hover {
    color: var(--pk-primary);
}

.pk-post-cards-style-device .pk-post-card-image {
    order: 0;
    background: #fff;
    aspect-ratio: 1 / 1;
    padding: 10px;
}

.pk-post-cards-style-device .pk-post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pk-post-cards-style-device .pk-post-card-footer {
    order: 1;
    padding: 10px 0 0 0;
    border: none;
    margin-top: auto;
}

.pk-post-cards-style-device .pk-post-card-button {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    font-size: 13px;
    background: #dd0707;
    border-radius: 4px;
    color: #fff !important;
    text-decoration: none !important;
}

.pk-post-cards-style-device .pk-post-card-button:hover,
.pk-post-cards-style-device .pk-post-card-button:focus,
.pk-post-cards-style-device .pk-post-card-button:active,
.pk-post-cards-style-device .pk-post-card-button:visited {
    background: #eb0909;
    color: #fff !important;
    text-decoration: none !important;
}

.pk-post-cards-style-device .pk-post-card-excerpt,
.pk-post-cards-style-device .pk-post-card-meta,
.pk-post-cards-style-device .pk-post-card-meta-top,
.pk-post-cards-style-device .pk-post-card-date,
.pk-post-cards-style-device .pk-post-card-author {
    display: none;
}

/* Device Style Mobile - 3 Spalten */
@media (max-width: 640px) {
    .pk-post-cards-style-device .pk-post-card {
        padding: 6px;
    }

    .pk-post-cards-style-device .pk-post-card-title {
        font-size: 11px;
        min-height: 32px;
        margin-bottom: 6px;
    }

    .pk-post-cards-style-device .pk-post-card-image {
        padding: 4px;
    }

    .pk-post-cards-style-device .pk-post-card-button {
        padding: 8px 10px;
        font-size: 11px;
    }

    .pk-post-cards-style-device .pk-post-card-footer {
        padding-top: 6px;
    }
}

/* ==========================================================================
   Load More Button
   ========================================================================== */

.pk-post-load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.pk-post-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--pk-primary, #EB0909);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pk-post-load-more-btn:hover {
    background: var(--pk-primary-dark, #C00707);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(235, 9, 9, 0.3);
}

.pk-post-load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pk-post-load-more-btn.pk-loading {
    pointer-events: none;
}

.pk-post-load-more-btn.pk-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pk-post-spin 0.8s linear infinite;
}
