/* ==========================================
   Styles pour images de programmes - Ratio 922:615 (3:2)
   ========================================== */

/* Image dans les cartes de programmes (liste des programmes) */
.program-image {
    width: 100%;
    height: 0;
    padding-bottom: 66.67%; /* Ratio 922:615 = 66.67% */
    position: relative;
    overflow: hidden;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    background-color: #f8f9fa;
}

.program-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

/* Effet hover sur les images */
.card:hover .program-image img {
    transform: scale(1.05);
}

/* Container pour les pages de détails */
.program-image-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.program-image-container::before {
    content: '';
    display: block;
    padding-bottom: 66.67%; /* Ratio 922:615 */
}

.program-image-container .program-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding-bottom: 0;
}

.program-image-container .program-image img {
    border-radius: 0;
}

/* Styles pour l'upload d'images */
.program-image-upload {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.67%; /* Ratio 922:615 */
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.program-image-upload:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.program-image-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.program-image-upload-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    pointer-events: none;
}

.program-image-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.program-image-upload.has-image .program-image-preview {
    display: block;
}

.program-image-upload.has-image .program-image-upload-text {
    display: none;
}

/* Responsive pour tablettes */
@media (max-width: 992px) {
    .program-image-container {
        max-width: 600px;
    }
}

/* Responsive pour mobiles */
@media (max-width: 576px) {
    .program-image-container {
        max-width: 100%;
        margin-bottom: 1rem;
        border-radius: 0.375rem;
    }
    
    /* Réduire légèrement le ratio sur mobile pour économiser l'espace */
    .program-image,
    .program-image-container::before,
    .program-image-upload {
        padding-bottom: 60%; /* Ratio légèrement plus carré sur mobile */
    }
}

/* Fallback pour les images sans ratio défini */
img.program-image:not([style*="padding-bottom"]) {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
}

/* Styles pour les miniatures dans les listes */
.program-thumbnail {
    width: 100%;
    height: 0;
    padding-bottom: 66.67%;
    position: relative;
    overflow: hidden;
    border-radius: 0.25rem;
}

.program-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Assurer la cohérence avec les cartes Bootstrap */
.card .program-image {
    border-bottom: 1px solid rgba(0,0,0,.125);
}

/* État de chargement */
.program-image-loading {
    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; }
} 