/* MN Terms Widget Styles */

.mn-terms-wrapper {
    width: 100%;
}

.mn-terms-notice {
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    color: #666;
}

/* Grid Layout */
.mn-terms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    align-items: start;
}

/* Grid Centered Mode — last row items center themselves */
.mn-terms-grid.mn-terms-grid-centered {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.mn-terms-grid.mn-terms-grid-centered .mn-terms-item {
    flex: 0 0 calc((100% - (var(--mn-terms-columns, 3) - 1) * var(--mn-terms-gap, 15px)) / var(--mn-terms-columns, 3));
    min-width: 0;
    box-sizing: border-box;
}

/* List Layout */
.mn-terms-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Term Item */
.mn-terms-item {
    background: #f5f5f5;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mn-terms-item-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

a.mn-terms-item-inner:hover {
    text-decoration: none;
}

/* Thumbnail Positions */
.mn-terms-item.mn-terms-thumb-left .mn-terms-item-inner {
    flex-direction: row;
}

.mn-terms-item.mn-terms-thumb-right .mn-terms-item-inner {
    flex-direction: row-reverse;
}

.mn-terms-item.mn-terms-thumb-top .mn-terms-item-inner {
    flex-direction: column;
    text-align: center;
}

.mn-terms-item.mn-terms-thumb-top .mn-terms-content {
    width: 100%;
}

/* Thumbnail */
.mn-terms-thumbnail {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 4px;
}

.mn-terms-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mn-terms-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mn-terms-thumbnail-placeholder::before {
    content: '';
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Content */
.mn-terms-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

/* Item Content Alignment */
.mn-terms-item.mn-terms-align-center {
    text-align: center;
}

.mn-terms-item.mn-terms-align-center .mn-terms-item-inner {
    justify-content: center;
}

.mn-terms-item.mn-terms-align-center .mn-terms-content {
    align-items: center;
}

.mn-terms-item.mn-terms-align-right {
    text-align: right;
}

.mn-terms-item.mn-terms-align-right .mn-terms-item-inner {
    justify-content: flex-end;
}

.mn-terms-item.mn-terms-align-right .mn-terms-content {
    align-items: flex-end;
}

.mn-terms-item.mn-terms-align-left {
    text-align: left;
}

.mn-terms-item.mn-terms-align-left .mn-terms-item-inner {
    justify-content: flex-start;
}

.mn-terms-item.mn-terms-align-left .mn-terms-content {
    align-items: flex-start;
}

.mn-terms-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
}

.mn-terms-count {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

/* List alignment adjustments */
.mn-terms-list .mn-terms-item-inner {
    justify-content: flex-start;
}

.mn-terms-list[style*="text-align: center"] .mn-terms-item-inner,
.mn-terms-list .mn-terms-item[style*="justify-content: center"] .mn-terms-item-inner {
    justify-content: center;
}

.mn-terms-list[style*="text-align: right"] .mn-terms-item-inner,
.mn-terms-list .mn-terms-item[style*="justify-content: right"] .mn-terms-item-inner {
    justify-content: flex-end;
}

/* Hover Effects */
.mn-terms-item:hover {
    transform: translateY(-2px);
}

/* Top thumbnail specific styles */
.mn-terms-item.mn-terms-thumb-top .mn-terms-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 0;
}

.mn-terms-item.mn-terms-thumb-top .mn-terms-content {
    padding: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
    .mn-terms-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .mn-terms-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .mn-terms-thumbnail {
        width: 40px;
        height: 40px;
    }
    
    .mn-terms-name {
        font-size: 13px;
    }
    
    .mn-terms-count {
        font-size: 11px;
    }
}
