/**
 * MDG98 Filter Articles - Stili per le card degli articoli
 */


/* Card styling */
#mdg98-articles-grid .card {
    border: 1px solid #e9ecef;
    border-radius: 0px;
    transition: all 0.3s ease;
    overflow: hidden;
    background: #fff;
    position: relative;
}

#mdg98-articles-grid .text-muted {
    color: #C7C7C7 !important;
}


/* Card image container */
#mdg98-articles-grid .card-img-top-wrapper {
    position: relative;
    width: 100%;
    height: 245px;
    overflow: hidden;
    background: #f8f9fa;
}
#mdg98-articles-grid .card-img-top-wrapper img{
    object-fit: cover;
    object-position: center;
    height: 100%;
    width: 100%;
}

.card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Placeholder per immagini mancanti */
.placeholder-img {
    width: 100%;
    height: 245px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e9ecef;
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-content i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.placeholder-content span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Card body */
#mdg98-articles-grid .card-body {
    padding: 1.25rem;
    min-height: 180px;
}

/* Card title */
#mdg98-articles-grid .card-title {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 1rem;
    font-weight: 600;
}

#mdg98-articles-grid .card-title a {
    color: #BA0C2F;
    text-decoration: none;
    transition: color 0.2s ease;
}

#mdg98-articles-grid .card-title a:hover {
    color: #0A2C3D;
}

/* Stretched link per click area estesa */
.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    pointer-events: auto;
    content: "";
    background-color: transparent;
}

/* Card meta informazioni */
.card-meta {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f8f9fa;
}

.card-meta small {
    font-size: 0.8rem;
    color: #6c757d;
}

.card-meta i {
    color: #0d6efd;
}

/* Card categories */
.card-categories {
    margin-top: 0.5rem;
}

.card-categories .badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    border-radius: 0px;
}

.card-categories .badge.bg-secondary {
    background-color: #6c757d !important;
    color: #fff;
}

/* Card tags */
.card-tags {
    margin-top: 0.25rem;
}

.card-tags .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0px;
    border: 1px solid #dee2e6;
}

.card-tags .badge.bg-light {
    background-color: #f8f9fa !important;
    color: #495057 !important;
}

/* Results info bar */
.results-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 0px;
    margin-top: 2rem;
}

.results-info .text-muted {
    font-size: 0.875rem;
}

/* Paginazione */
.mdg98-pagination {
    margin-top: 1.5rem;
}

.mdg98-pagination .pagination {
    margin-bottom: 0;
}
.mdg98-pagination .page-item {
    border-radius: 100px 100px 100px 100px;
}
.mdg98-pagination .page-item:last-child .page-link {
    border-top-right-radius: 100px !important;
    border-bottom-right-radius: 100px !important;
}
.mdg98-pagination .page-link {
    color: #BA0C2F;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 100px 100px 100px 100px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

.mdg98-pagination .page-link:hover {
    background-color: #BA0C2F;
    border-color: #BA0C2F;
    color: #fff;
    font-weight: 600;
}

.mdg98-pagination .page-item.active .page-link {
    background-color: #BA0C2F;
    border-color: #BA0C2F;
    color: #fff;
    font-weight: 600;
}

.mdg98-pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
    cursor: not-allowed;
    border-radius: 100px 100px 100px 100px;
}

.mdg98-pagination .page-item:not(.active):not(.disabled) .page-link:focus {
    outline: 2px solid #BA0C2F;
    outline-offset: 2px;
}

.pagination-info {
    margin-top: 1rem;
}

.pagination-info small {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 0px;
    border: 1px solid #e9ecef;
}

/* Animazioni di caricamento per le card */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card.fade-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* Stati di caricamento */
.card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* Alert per nessun risultato */
#mdg98-articles-grid .alert {
    border-radius: 0px;
    border: none;
    padding: 2rem;
}

#mdg98-articles-grid .alert.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #0d47a1;
    border-left: 4px solid #2196f3;
}

#mdg98-articles-grid .alert h4 {
    margin-bottom: 1rem;
    font-weight: 600;
}

#mdg98-articles-grid .alert i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Responsive design */
@media (max-width: 992px) {
    #mdg98-articles-grid .card-img-top-wrapper {
        height: 180px;
    }
    
    #mdg98-articles-grid .card-body {
        min-height: 160px;
        padding: 1rem;
    }
    
    #mdg98-articles-grid .card-title {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    #mdg98-articles-grid .card-img-top-wrapper {
        height: 160px;
    }
    
    #mdg98-articles-grid .card-body {
        min-height: 140px;
        padding: 0.875rem;
    }
    
    #mdg98-articles-grid .card-title {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .results-info {
        padding: 1rem !important;
    }
    
    .results-info .d-flex {
        flex-direction: column !important;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    #mdg98-articles-grid .card-img-top-wrapper {
        height: 140px;
    }
    
    #mdg98-articles-grid .card-body {
        min-height: 120px;
        padding: 0.75rem;
    }
    
    #mdg98-articles-grid .card-meta {
        padding-top: 0.75rem;
    }
    
    #mdg98-articles-grid .card-categories .badge,
    #mdg98-articles-grid .card-tags .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.35rem;
    }
}

/* Lazy loading placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #mdg98-articles-grid .card {
        border-width: 2px;
        border-color: #000;
    }
    
    #mdg98-articles-grid .card-title a {
        color: #000;
        text-decoration: underline;
    }
    
    .card-meta {
        border-top-color: #000;
    }
}

/* Print styles */
@media print {
    #mdg98-articles-grid .card {
        break-inside: avoid;

        border: 1px solid #000;
    }
    
    #mdg98-articles-grid .card:hover {
        transform: none;
    }
    
    .card-img-top {
        filter: grayscale(100%);
    }
}
