.portfolio-widget {
    position: relative;
    width: 100%;
}

.portfolio-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.portfolio-cat-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 8px 20px;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 5px;
}

.portfolio-cat-btn:hover,
.portfolio-cat-btn.active {
    background-color: var(--mn-portfolio-active-bg, #0073aa);
    color: var(--mn-portfolio-active-color, #fff) !important;
    border-color: var(--mn-portfolio-active-bg, #0073aa);
}

.portfolio-items-grid {
    display: grid;
    width: 100%;
    transition: all 0.3s ease;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #fff;
    /* Ensure items take up space correctly in grid */
    height: 100%;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.portfolio-item-inner {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.portfolio-thumbnail {
    position: relative;
    overflow: hidden;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
    width: 100%;
}

.portfolio-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-item:hover .portfolio-thumbnail img {
    transform: scale(1.1);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-content {
    padding: 15px;
    text-align: center;
}

.portfolio-title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.portfolio-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.portfolio-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
