/* MN Logolist Widget Styles */

/* Base Styles */
.mn-logolist-wrapper {
    position: relative;
    width: 100%;
}

.mn-logolist-container {
    width: 100%;
}

/* Logo Item Base */
.mn-logo-item {
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.mn-logo-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.mn-logo-image {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mn-logo-image img {
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
    object-fit: contain;
}

/* Image Stretch */
.mn-image-stretch .mn-logo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Custom Resolution Support */
.mn-logolist-wrapper .mn-logo-image img {
    max-width: 100%;
    height: auto;
}

/* When custom resolution is used, respect the exact dimensions */
.mn-logolist-wrapper[data-image-resolution="custom"] .mn-logo-image img {
    max-width: none;
}

/* Custom resolution responsive behavior */
@media (max-width: 768px) {
    .mn-logolist-wrapper[data-image-resolution="custom"] .mn-logo-image img {
        max-width: 100%;
        width: auto !important;
        height: auto !important;
    }
}

.mn-logo-title {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.mn-logo-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* Grid Layout */
.mn-logolist-grid .mn-logolist-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.mn-logolist-grid .mn-logo-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 5px;    
}

.mn-logolist-grid .mn-logo-content {
    flex-direction: column;
}

.mn-logolist-grid .mn-logo-image {    
    height: 80px;
}

/* List Layout */
.mn-logolist-list .mn-logolist-container {
    display: flex;
    flex-direction: column;
}

.mn-logolist-list .mn-logo-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.mn-logolist-list .mn-logo-list-layout {
    flex-direction: row;
    align-items: center;
    text-align: left;
}

.mn-logolist-list .mn-logo-image {
    width: 80px;
    height: 60px;
    margin-right: 20px;
    flex-shrink: 0;
}

.mn-logolist-list .mn-logo-title {
    margin-top: 0;
    flex: 1;
}

/* Carousel Layout */
.mn-logolist-carousel {
    overflow: hidden;
    position: relative;
}

.mn-logolist-carousel .mn-logolist-container {
    display: flex;
    animation: mn-carousel-scroll linear infinite;
    width: max-content;
    --original-width: 0px;
}

.mn-logolist-carousel .mn-logo-item {
    flex: 0 0 auto;
    margin-right: 30px;
    background: #ffffff;
    border-radius: 8px;    
    width: 200px;
}

.mn-logolist-carousel .mn-logo-image {
    height: 80px;
    margin-bottom: 5px;
}

/* Carousel Animation - moves exactly the width of original items for seamless loop */
@keyframes mn-carousel-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-1 * var(--original-width)));
    }
}

/* Pause on Hover */
.mn-logolist-carousel:hover .mn-logolist-container {
    animation-play-state: paused;
}

/* Theme Variations */

/* Light Theme */
.mn-theme-light .mn-logo-item {
    background: #ffffff;
    border-color: #e0e0e0;
    color: #333333;
}

.mn-theme-light .mn-logo-item:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.mn-theme-light .mn-logo-title {
    color: #333333;
}

.mn-theme-light .mn-logo-item:hover .mn-logo-title {
    color: #007cba;
}

/* Dark Theme */
.mn-theme-dark .mn-logo-item {
    background: #2c3e50;
    border-color: #34495e;
    color: #ffffff;
}

.mn-theme-dark .mn-logo-item:hover {
    background: #34495e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.mn-theme-dark .mn-logo-title {
    color: #ffffff;
}

.mn-theme-dark .mn-logo-item:hover .mn-logo-title {
    color: #3498db;
}

/* Hover Effects */
.mn-logo-item:hover .mn-logo-image img {
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .mn-logolist-grid .mn-logolist-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .mn-logolist-carousel .mn-logo-item {
        width: 180px;
        margin-right: 20px;
    }
}

@media (max-width: 768px) {
    .mn-logolist-grid .mn-logolist-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .mn-logolist-list .mn-logo-list-layout {
        flex-direction: column;
        text-align: center;
    }
    
    .mn-logolist-list .mn-logo-image {
        margin-right: 0;
        margin-bottom: 10px;
        width: 60px;
        height: 45px;
    }
    
    .mn-logolist-carousel .mn-logo-item {
        width: 150px;
        padding: 15px;
    }
    
    .mn-logolist-carousel .mn-logo-image {
        height: 60px;
    }
}

@media (max-width: 480px) {
    .mn-logolist-grid .mn-logolist-container {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .mn-logolist-list .mn-logo-item {
        padding: 10px 15px;
    }
    
    .mn-logolist-carousel .mn-logo-item {
        width: 120px;
        padding: 10px;
    }
}

/* Print Styles */
@media print {
    .mn-logolist-carousel .mn-logolist-container {
        animation: none;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        width: 100%;
    }
    
    .mn-logolist-carousel .mn-logo-item {
        margin-right: 0;
        width: auto;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .mn-logolist-carousel .mn-logolist-container {
        animation: none;
    }
    
    .mn-logo-item,
    .mn-logo-image img {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .mn-logo-item {
        border-width: 2px;
    }
    
    .mn-theme-light .mn-logo-item {
        border-color: #000000;
    }
    
    .mn-theme-dark .mn-logo-item {
        border-color: #ffffff;
    }
}

/* Focus States for Accessibility */
.mn-logo-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.mn-logo-link:focus .mn-logo-item {
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

/* Loading State */
.mn-logo-item.loading {
    opacity: 0.6;
}

.mn-logo-item.loading .mn-logo-image {    
}

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

/* Carousel Fade Edges for Smooth Infinite Loop */
.mn-logolist-carousel::before,
.mn-logolist-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    border-radius:12px;
}

.mn-logolist-carousel::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.8), rgba(255,255,255,0));
}

.mn-logolist-carousel::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.8), rgba(255,255,255,0));
}

.mn-theme-dark .mn-logolist-carousel::before {
    background: linear-gradient(to right, rgba(44,62,80,0.8), rgba(44,62,80,0));
}

.mn-theme-dark .mn-logolist-carousel::after {
    background: linear-gradient(to left, rgba(44,62,80,0.8), rgba(44,62,80,0));
}

/* Ensure smooth animation performance */
.mn-logolist-carousel .mn-logolist-container {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
