/* Image display improvements for TrustBiz */

/* Responsive images that maintain aspect ratio */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Images that cover their container without distortion */
.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Images that contain within their container (show entire image) */
.img-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background-color: #f8f9fa; /* Light background for transparent images */
}

/* Carousel images - responsive height based on aspect ratio */
.carousel-image-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio (9/16 = 0.5625) */
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.carousel-image-container img:hover {
    transform: scale(1.02);
}

/* Improved carousel controls */
.carousel-dark .carousel-control-prev-icon,
.carousel-dark .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.75);
    border-radius: 50%;
    padding: 1.5rem;
    background-size: 1.5rem;
    transition: all 0.2s ease;
}

.carousel-dark .carousel-control-prev-icon:hover,
.carousel-dark .carousel-control-next-icon:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.carousel-dark .carousel-control-prev {
    left: 10px;
}

.carousel-dark .carousel-control-next {
    right: 10px;
}

.carousel-indicators {
    position: static;
    margin-top: 1rem;
}

.carousel-indicators button {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    margin: 0 5px !important;
    border: none !important;
    opacity: 0.5 !important;
    transition: all 0.2s ease;
}

.carousel-indicators button:hover {
    opacity: 0.8 !important;
    transform: scale(1.2);
}

.carousel-indicators button.active {
    opacity: 1 !important;
    background-color: #2563eb !important;
    transform: scale(1.2);
}

/* Image error handling */
.image-error-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    animation: fadeIn 0.3s ease-in;
}

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

.image-error-caption .bg-danger {
    background-color: rgba(220, 53, 69, 0.85) !important;
}

/* Loading state for carousel */
.carousel-item {
    transition: transform 0.6s ease-in-out;
}

.carousel-fade .carousel-item {
    opacity: 0;
    transition-property: opacity;
    transform: none;
}

.carousel-fade .carousel-item.active {
    opacity: 1;
}

/* Card images - fixed height but responsive */
.card-img-fixed {
    width: 100%;
    height: 200px; /* Fixed height for consistency */
    object-fit: cover;
    object-position: center;
}

/* Thumbnail images - smaller fixed height */
.img-thumbnail-fixed {
    width: 100%;
    height: 100px;
    object-fit: cover;
    object-position: center;
}

/* Business photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.photo-grid-item {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

/* Modal images - responsive within modal */
.modal-img-container {
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-img-container img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* Aspect ratio containers for different image types */
.aspect-ratio-16-9 {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
}

.aspect-ratio-4-3 {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 */
}

.aspect-ratio-1-1 {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 (square) */
}

.aspect-ratio-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.aspect-ratio-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loading state for images */
.img-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; }
}

/* Image hover effects */
.img-hover-zoom {
    transition: transform 0.3s ease;
}

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

/* Image caption styling */
.img-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-img-fixed {
        height: 150px;
    }
    
    .img-thumbnail-fixed {
        height: 80px;
    }
    
    .photo-grid-item {
        height: 120px;
    }
}

@media (max-width: 576px) {
    .card-img-fixed {
        height: 120px;
    }
    
    .img-thumbnail-fixed {
        height: 60px;
    }
    
    .photo-grid-item {
        height: 100px;
    }
}