/**
 * Professional Mobile Brands Widget Styles
 * Clean, minimal design with white background only
 */

/* Main Container */
.mps-professional-brands-widget {
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.mps-professional-brands-widget .widget-title {
    background: #ffffff;
    color: #333333;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
}

/* Brands Container */
.mps-pro-brands-container {
    padding: 20px;
}

/* Brands Grid - Dynamic Columns */
.mps-pro-brands-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, 1fr); /* Default 2 columns */
}

/* Dynamic column support */
.mps-pro-brands-container[data-columns="1"] .mps-pro-brands-grid {
    grid-template-columns: 1fr;
}

.mps-pro-brands-container[data-columns="2"] .mps-pro-brands-grid {
    grid-template-columns: repeat(2, 1fr);
}

.mps-pro-brands-container[data-columns="3"] .mps-pro-brands-grid {
    grid-template-columns: repeat(3, 1fr);
}

.mps-pro-brands-container[data-columns="4"] .mps-pro-brands-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* Brand Item */
.mps-pro-brand-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #f5f5f5;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.mps-pro-brand-item:hover {
    background: #ffffff;
    border-color: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    text-decoration: none;
    color: inherit;
}

.mps-pro-brand-item:focus {
    outline: 2px solid #cccccc;
    outline-offset: 2px;
}

/* Brand Logo */
.mps-pro-brand-logo {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f5f5f5;
}

.mps-pro-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.mps-pro-brand-item:hover .mps-pro-brand-logo img {
    transform: scale(1.05);
}

/* Brand Info */
.mps-pro-brand-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mps-pro-brand-name {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mps-pro-brand-count {
    font-size: 12px;
    color: #888888;
    margin-top: 2px;
    line-height: 1.2;
}

/* Show More Button Styles */
.mps-pro-brands-actions {
    margin-top: 15px;
    text-align: center;
    padding: 0 20px 20px;
}

.mps-pro-show-more-btn {
    background: #ffffff;
    color: #333333;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 200px;
}

.mps-pro-show-more-btn:hover {
    background: #f8f8f8;
    border-color: #cccccc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mps-pro-show-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mps-pro-show-more-btn.mps-animating {
    pointer-events: none;
    opacity: 0.7;
}

/* Hidden brands */
.mps-hidden-brands {
    margin-top: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mps-professional-brands-widget {
        margin-bottom: 16px;
        border-radius: 6px;
    }
    
    .mps-professional-brands-widget .widget-title {
        font-size: 15px;
        padding: 14px 16px;
    }
    
    .mps-pro-brands-container {
        padding: 16px;
    }
    
    .mps-pro-brands-grid {
        gap: 10px;
    }
    
    /* Keep 2 columns on tablets */
    .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="2"] .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="3"] .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="4"] .mps-pro-brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mps-pro-brand-card {
        padding: 12px;
        min-height: 60px;
    }
    
    .mps-pro-brand-logo {
        width: 40px;
        height: 40px;
    }
    
    .mps-pro-brand-name {
        font-size: 13px;
    }
    
    .mps-pro-show-more-btn {
        font-size: 13px;
        padding: 8px 16px;
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .mps-professional-brands-widget {
        margin-bottom: 12px;
        border-radius: 4px;
    }
    
    .mps-professional-brands-widget .widget-title {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    .mps-pro-brands-container {
        padding: 12px;
    }
    
    .mps-pro-brands-grid {
        gap: 8px;
    }
    
    /* 2 columns on mobile phones */
    .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="2"] .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="3"] .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="4"] .mps-pro-brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mps-pro-brand-item {
        padding: 10px;
        min-height: 55px;
        border-radius: 4px;
        flex-direction: column;
        text-align: center;
    }
    
    .mps-pro-brand-logo {
        width: 35px;
        height: 35px;
        margin-right: 0;
        margin-bottom: 6px;
    }
    
    .mps-pro-brand-info {
        align-items: center;
    }
    
    .mps-pro-brand-name {
        font-size: 12px;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }
    
    .mps-pro-brand-count {
        font-size: 11px;
    }
    
    .mps-pro-show-more-btn {
        font-size: 12px;
        padding: 6px 14px;
        max-width: 160px;
        border-radius: 4px;
    }
}

/* Extra small devices - 3 columns */
@media (max-width: 360px) {
    .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="2"] .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="3"] .mps-pro-brands-grid,
    .mps-pro-brands-container[data-columns="4"] .mps-pro-brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Logo visibility control */
.mps-pro-brands-container.hide-logos .mps-pro-brand-logo {
    display: none !important;
}

.mps-pro-brands-container.hide-logos .mps-pro-brand-item {
    justify-content: center;
    text-align: center;
}

.mps-pro-brands-container.hide-logos .mps-pro-brand-info {
    text-align: center;
    width: 100%;
}

/* Keep white background even in dark mode preference */
@media (prefers-color-scheme: dark) {
    .mps-professional-brands-widget {
        background: #ffffff !important;
        border-color: #f0f0f0 !important;
    }
    
    .mps-professional-brands-widget .widget-title {
        background: #ffffff !important;
        color: #333333 !important;
        border-bottom-color: #f0f0f0 !important;
    }
    
    .mps-pro-brand-item {
        background: #ffffff !important;
        border-color: #f5f5f5 !important;
    }
    
    .mps-pro-brand-item:hover {
        background: #ffffff !important;
        border-color: #e0e0e0 !important;
    }
    
    .mps-pro-brand-name {
        color: #333333 !important;
    }
    
    .mps-pro-brand-count {
        color: #888888 !important;
    }
    
    .mps-pro-brand-logo {
        background: #ffffff !important;
        border-color: #f5f5f5 !important;
    }
    
    .mps-pro-show-more-btn {
        background: #ffffff !important;
        color: #333333 !important;
        border-color: #e0e0e0 !important;
    }
    
    .mps-pro-show-more-btn:hover {
        background: #f8f8f8 !important;
        border-color: #cccccc !important;
    }
}

/* Loading State */
.mps-pro-brands-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

.mps-pro-brands-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility Improvements */
.mps-pro-brand-item:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .mps-professional-brands-widget {
        border-width: 2px;
    }
    
    .mps-pro-brand-item {
        border-width: 2px;
    }
    
    .mps-pro-brand-item:hover {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mps-pro-brand-item,
    .mps-pro-brand-logo img {
        transition: none;
    }
    
    .mps-pro-brand-item:hover {
        transform: none;
    }
    
    .mps-pro-brand-item:hover .mps-pro-brand-logo img {
        transform: none;
    }
    
    @keyframes spin {
        to {
            transform: none;
        }
    }
}
